Compare commits

..

766 Commits

Author SHA1 Message Date
Steven Nance 2ba5e44785 docs(core): show correct types for oneOf schema properties in executor docs
The getPropertyType() function was hardcoded to return 'string' for any
oneOf schema property. This caused the args and readyWhen options in
run-commands to display as 'string' when they actually accept both
string and string[] types. Now properly extracts and joins types from
oneOf variants.

Also updated the args description to mention that args can be specified
as properties on the target configuration and linked to the Pass Args
to Commands guide instead of a broken anchor reference.
2026-02-23 14:21:43 +01:00
Steven Nance 942744fb27 docs(core): clarify run-commands args option accepts both string and array
The `args` option for the `nx:run-commands` executor accepts both a
string and an array of strings, but the docs only showed the array
form with a comment mentioning the string form. Updated the schema
description to explicitly state both types are accepted and split the
docs into separate tabs showing each format clearly.
2026-02-22 20:39:50 +01:00
Altan Stalker 5180e64863 chore(repo): force nx-dev:prebuild-banner onto linux-extra-large (#34535)
Temp fix while scheduling is fixed for real

---------

Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2026-02-22 20:39:50 +01:00
Craigory Coppola 9de5b9ec91 feat(core): add commands for debugging cache inputs / outputs (#34414)
## Current Behavior
There's not a great way to troubleshoot or test inputs and outputs
configurations on tasks.

## Expected Behavior
Adds `nx show target` to enable users to debug inputs and outputs. It
has flags `--inputs`, `--check-input`, `--outputs`, and `--check-output`
to list or test specific file patterns.

<img width="1077" height="198" alt="image"
src="https://github.com/user-attachments/assets/7ffd4502-1542-40e6-867c-37f70440a421"
/>

<img width="1077" height="105" alt="image"
src="https://github.com/user-attachments/assets/eb5b09e1-23fb-4710-9fb0-84f0c8e80c14"
/>

<img width="1077" height="538" alt="image"
src="https://github.com/user-attachments/assets/74c60668-285c-4195-ba77-6693a66e4897"
/>

<img width="1077" height="318" alt="image"
src="https://github.com/user-attachments/assets/ee228c43-98c2-441d-8b9d-277b38213e4d"
/>

<img width="1077" height="92" alt="image"
src="https://github.com/user-attachments/assets/8cca6553-4362-4662-b948-723abcc75671"
/>

<img width="1077" height="74" alt="image"
src="https://github.com/user-attachments/assets/6dc2188e-5dc5-4b5f-afd4-2a492a896e1d"
/>

---

<img width="492" height="430" alt="image"
src="https://github.com/user-attachments/assets/ae22bb2e-92c2-4c75-ad6f-b9cccda3def4"
/>

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2026-02-22 20:39:49 +01:00
Jack Hsu 03751de76a fix(misc): prevent nxCloudId from being generated for new workspaces (#34532)
## Current Behavior

When creating a new workspace using `create-nx-workspace` with the
"custom" preset flow, an `nxCloudId` is generated and added to
`nx.json`. This happens even though the onboarding flow is supposed to
handle Cloud setup separately via a short URL.

## Expected Behavior

New workspaces created via `create-nx-workspace` should not have
`nxCloudId` set in `nx.json`. Instead, a short URL is provided for users
to finish Cloud onboarding on their own. The `nxCloud: 'skip'` option is
now passed for the custom flow to prevent the ID from being generated.

E2E tests are updated to verify that `nxCloudId` is undefined in the
generated `nx.json` across all workspace presets.

## Related Issue(s)

N/A - internal fix for workspace creation behavior.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-22 20:39:48 +01:00
Craigory Coppola e755124667 fix(core): commands shouldn't hang when passing --help (#34506)
## Current Behavior
`--help` on commands that hit yargs help are hanging

## Expected Behavior
It doesn't hang. This contains a quick fix in adding the process.exit
call, but also adds the unref needed to maintain previous working
behavior. We'll need to investigate long term if additional areas keep
commands alive, but adding this unref theoretically allows removing the
process.exit calls from `nx show`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2026-02-22 20:39:47 +01:00
Jason Jean ad150b3421 chore(repo): re-enable e2e tests disabled by api-extractor issue (#34519)
## Current Behavior

14 e2e test suites were disabled (`xdescribe`) due to an ESM import
issue in `@microsoft/api-extractor@7.57.0` (see
https://github.com/qmhc/unplugin-dts/issues/461).

## Expected Behavior

With the upstream issue resolved, all 14 e2e test suites are re-enabled
(`describe`) and should pass normally.

## Related Issue(s)

Reverts #34516
2026-02-22 20:39:45 +01:00
Jason Jean c9b84c2afa chore(repo): update nx to 22.6.0-beta.1 (#34527)
Updating Nx from 22.5.0-beta.5 to 22.6.0-beta.1
2026-02-22 20:39:43 +01:00
Jack Hsu 7d31713d3e fix(nextjs): reset daemon client after project graph creation in withNx (#34518)
## Current Behavior

Running `nx test` for Next.js projects causes Jest to hang with:
```
Jest did not exit one second after the test run has completed.
```

This happens because `next/jest` loads `next.config.js`, which calls
`withNx` → `createProjectGraphAsync()`. The daemon client socket
connection is left open, keeping the Node.js event loop alive and
preventing Jest from exiting. Non-Next.js projects are unaffected since
they don't trigger this code path.

## Expected Behavior

Jest exits cleanly after tests complete for Next.js projects, without
needing `forceExit: true`.

## Fix

Pass `resetDaemonClient: true` to `createProjectGraphAsync()` in
`packages/next/plugins/with-nx.ts`. This tells the project graph
function to call `daemonClient.reset()` after fetching the graph, which
closes the socket and allows Jest to exit.

### Verification

| Scenario | Before | After |
|----------|--------|-------|
| `nx test next-app` | Hangs | Exits cleanly |
| `NX_DAEMON=false nx test next-app` | Exits cleanly | Exits cleanly |
| Direct `npx jest` | Exits cleanly | Exits cleanly |
| Non-Next.js `nx test react-lib` | Exits cleanly | Exits cleanly |

## Related Issue(s)

Fixes #32880
2026-02-22 20:39:39 +01:00
Jason Jean 22f3a4885e chore(maven): bump maven plugin version to 0.0.14 (#34505)
## Current Behavior

The Maven plugin is on version `0.0.13`.

## Expected Behavior

The Maven plugin is bumped to version `0.0.14`, with a migration
generated for Nx `22.6.0-beta.1`.
2026-02-22 20:39:05 +01:00
Altan Stalker 8e1d873edc chore(core): enable nx cloud verbose logging (#34524)
## Current Behavior
Agents are silent and hard to diagnose

## Expected Behavior
Agents should print debug logs without making all of Nx print debug logs
2026-02-19 22:41:35 +00:00
Jason Jean 4ca3ee97c3 chore(repo): disable e2e tests broken by @microsoft/api-extractor@7.57.0 (#34516)
## Current Behavior

14 e2e tests are failing across master with "Failed to process project
graph" errors. The root cause is `@microsoft/api-extractor@7.57.0` which
has a broken ESM export (`ConsoleMessageId`). When `@nx/vite/plugin` or
`@nx/vitest` plugins load `vite.config.mts` files, they transitively
import api-extractor which crashes.

## Expected Behavior

Broken e2e tests are disabled via `xdescribe` so they no longer block
CI. Tests should be re-enabled once the upstream api-extractor ESM issue
is fixed.

## Disabled Tests

| Project | Test File |
|---------|-----------|
| e2e-vite | `vite.test.ts`, `vite-legacy.test.ts`,
`vite-ts-solution.test.ts` |
| e2e-vue | `vue.test.ts`, `vue-legacy.test.ts`,
`vue-ts-solution.test.ts` |
| e2e-js | `js-ts-solution.test.ts` |
| e2e-web | `web-vite.test.ts` |
| e2e-react | `react-vite.test.ts`, `react-ts-solution.test.ts` |
| e2e-next | `next-ts-solutions.test.ts` |
| e2e-release | `release-publishable-libraries.test.ts`,
`release-publishable-libraries-ts-solution.test.ts` |
| e2e-storybook | `storybook-nested.test.ts` |

## Related Issue(s)

Upstream: https://github.com/qmhc/unplugin-dts/issues/461
2026-02-19 19:16:57 +00:00
Jason Jean e6ad74afed chore(maven): upgrade maven-shade-plugin to 3.6.0 (#34514)
## Current Behavior

The `maven-shade-plugin` at version 3.5.0 intermittently fails on CI
with:

```
Could not replace original artifact with shaded artifact!
```

This is a file-locking race condition where the plugin fails to
atomically replace the original JAR with the shaded JAR.

## Expected Behavior

Upgrading to 3.6.0 resolves the intermittent CI failures by using
improved file-handling logic with better retry behavior during the
artifact replacement step.

## Related Issue(s)

N/A - fixes intermittent CI flakiness in `maven-batch-runner` builds.
2026-02-19 10:28:14 -08:00
Ondrej Kelle 79f41e54af feat(core): use static_vcruntime to avoid msvcrt dependency (#19781)
Closes #19779

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
When targeting Windows the resulting binary (nx.dll) dynamically links
against Microsoft Visual C++ runtime (msvcrt140.dll). This means nx
won't be able to run on Windows systems without this runtime installed.

## Expected Behavior
I'd like to avoid this dependency by linking the runtime statically into
the nx binary. (This is also how e.g. cargo.exe for Windows is built.)

## Related Issue(s)

Fixes #19779

---------

Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
2026-02-19 09:07:17 -05:00
Leosvel Pérez Espinosa 4f9be499b4 fix(core): reduce terminal output duplication and allocations in task runner (#34427)
## Current Behavior

Terminal output in the task runner is accumulated via repeated string
concatenation (`terminalOutput += chunk`). Each `+=` on a growing string
causes V8 to allocate a new, larger string and copy the old contents,
resulting in O(n²) allocation behavior for tasks with large output.
Additionally, `PseudoTtyProcess.onExit` didn't pass `terminalOutput` to
its callbacks, forcing callers like `TaskOrchestrator` to duplicate
output accumulation logic with a separate `onOutput` listener.

## Expected Behavior

- Terminal output is collected in `string[]` arrays and joined once at
the end, reducing intermediate allocations from O(n²) to O(n)
- `PseudoTtyProcess.onExit` now passes `terminalOutput` as a second
argument, matching the signature of other `RunningTask` implementations
- `TaskOrchestrator` no longer needs a special code path for
`PseudoTtyProcess` — unified `onExit` handling for all task types
- `tui-summary-life-cycle` accumulates output in chunks during execution
and stores the finalized string on task completion, allowing chunk
arrays to be GC'd
- `SeriallyRunningTasks` and `RunningNodeProcess` similarly switched to
chunk-based accumulation
- `BatchProcess` and `NodeChildProcessWithNonDirectOutput` lazily join
and cache their terminal output
2026-02-18 19:05:41 -05:00
Caleb Ukle 42b534366d docs(nx-dev): tech intro page structure improvements (#34450)
Work on making a tech intro pages more consistent with each other and
focus on "answering the 80%" for the given technology.

Focusing on 
- Angular
- Maven/Gradle
- react
- TS
- Vite
- Vitest/Jest

The changes are based around answering the following, where each
"category" of page might have a different set of depth for the answer.

1. Why do I want to use this plugin?
- Plugins are considered fully optional and are aimed at providing
better DX for a technology, such as inferred setup, generators,
migrations.
- some plugins (like TSC) might have special call outs in some of this,
but generally the same for all plugins.
2. How do I use this plugin in my workspace?
  - also pretty commonly the "same" for all plugins in terms of "setup"
- where they differ is mostly for frameworks, e.g. Angular, React.
You're looking at setting up a project to use these tools
- For Build/Test tools you're looking at adding to an existing project,
or converting from one to another.
- Build/Test tools are "means to an end", so should callout if the goal
is tool + framework in a "new" context point to the framework based
plugin page. Otherwise, show adding to an existing project like React
project.
3. What do I need to know about using this plugin?
- understanding finer details of a plugin options, e.g. buildable &
publishable
  - extra generators for the plugin. e.g. "convert-to-swc"
- generally I like the idea of having a "CI considerations" where we
talk about CI setups that can help, e.g. options or batch mode etc.


closes DOC-407

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2026-02-18 22:25:23 +00:00
Caleb Ukle 7528cc51fa fix(nx-dev): update breadcrumb links to match sidebar (#34500)
navigation of the breadcrumbs could lead to confusing state since they
were based around the folder structure.

Breadcrumbs are now based around the sidebar structure so they match the
hierarchy of content.

Note: I left the existing index file based route pages in place in case
there are any links people have booked marked/linked to in other
locations. these will get cleaned up when we finally rewrite all the
URLs to their new content locations
2026-02-18 22:23:00 +00:00
Caleb Ukle bbb1baa631 fix(nx-dev): widen search dialog (#34504) 2026-02-18 22:02:18 +00:00
Leosvel Pérez Espinosa 91b350efa8 fix(core): skip stale recomputations and prevent lost file changes in daemon (#34424)
## Current Behavior

When file changes arrive rapidly, the daemon triggers multiple
concurrent project graph recomputations that all run to completion —
wasting CPU/memory on redundant work and returning stale results.

Additionally, after processing file changes, the daemon clears all
tracked files indiscriminately. Files that changed mid-recomputation are
silently lost and never reflected in the project graph until another
unrelated file change arrives.

## Expected Behavior

Stale recomputations detect when a newer one has started and exit early,
chaining to the newer promise so callers always get the freshest result.

File change tracking now uses versioned maps. Each batch of file watcher
events gets a unique version, and only files matching the snapshotted
version are cleared after processing. Files that changed
mid-recomputation are preserved and picked up by the next cycle.
2026-02-18 16:18:43 -05:00
Jason Jean 50ca951540 fix(repo): fix e2e CI failures from Node 22.12 incompatibility (#34501)
## Current Behavior

Two categories of e2e CI failures were observed in run
https://github.com/nrwl/nx/actions/runs/22127884259:

1. **`e2e-nx-init` and `e2e-js` fail on Node 22.12.0** with:
   ```
error eslint-visitor-keys@5.0.0: The engine "node" is incompatible with
this module.
   Expected version "^20.19.0 || ^22.13.0 || >=24". Got "22.12.0"
   ```
Node 22.12.0 is one minor version short of the `^22.13.0` range required
by `eslint-visitor-keys@5.0.0`.

2. **`e2e-nx` tests fail because `[isolated-plugin]` / `[plugin-worker]`
verbose messages leak into captured stdout**, causing:
- `JSON.parse(runCLI('show project --json'))` to throw `SyntaxError:
Unexpected token 'i', "[isolated-p"...`
- `expect(runCLI('show projects')).toEqual('')` to fail with worker
spawn noise
- The `@nx/workspace:infer-targets` test to unexpectedly find
`@nx/remix` in output (from a worker spawn message)

Root cause: in `isolated-plugin.ts`, the plugin worker's stdout was
piped directly to `process.stdout`, so `[plugin-worker]` verbose
messages written by the worker ended up in the stdout captured by
`runCLI` in e2e tests.

## Expected Behavior

1. The CI matrix uses a Node 22.x version that satisfies `^22.13.0`.

2. Plugin worker verbose/diagnostic messages go to `process.stderr` (not
`process.stdout`), so they don't contaminate output captured by `runCLI`
in e2e tests. Both worker stdout and stderr now pipe to
`process.stderr`, and the max listener bump is consolidated to `+2` on
stderr.

## Related Issue(s)

N/A — identified from CI run
https://github.com/nrwl/nx/actions/runs/22127884259
2026-02-18 15:48:03 -05:00
MaxKless 18bfb0bc4a fix(maven): write output after each task in batch mode to ensure correct files are cached (#34400)
## Current Behavior
When running in maven 4 batch mode, the build state is recorded only
after the full batch is done.
This means that nx caching records the state of a task before build
state is recorded to disk.
When running another maven task that depends on this partially recorded
cache, the build state file is missing and we get errors.

## Expected Behavior
build state should be recorded after every task is done and before nx
caching can kick in. This way we can ensure that nx cache is correct.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:22:18 -05:00
Eric Baer 3b0fb81570 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336)
## Current Behavior

When running generators or migrations, Nx automatically skips Prettier
formatting if no root Prettier config is detected (added in #30426).
However, there's no way to explicitly skip Prettier formatting when a
config IS present but the user wants to bypass it for specific
operations.

This can be needed when:
- When running something like Oxfmt that may treat prettier slightly
differently, even with the same config (this is the main thing I ran
into)
- Running migrations where Prettier reformatting causes unintended side
effects (e.g., breaking `eslint-disable` comments)
- Temporarily disabling formatting for debugging purposes
- Using a formatter that coexists with Prettier in the workspace but
should take precedence for certain files

## Expected Behavior

Users can set `NX_SKIP_FORMAT=true` to explicitly skip Prettier
formatting in generators and migrations, regardless of whether Prettier
is configured. TSConfig path sorting (controlled by
`sortRootTsconfigPaths` or `NX_FORMAT_SORT_TSCONFIG_PATHS`) continues to
work independently.

```bash
NX_SKIP_FORMAT=true nx migrate --run-migrations
NX_SKIP_FORMAT=true nx g @nx/react:app my-app
```

## Related Issue(s)

Related to #30403 and #30426. This enhancement adds explicit user
control for cases where auto-detection of Prettier configuration isn't
sufficient.
2026-02-18 09:56:43 -05:00
Craigory Coppola bdbc14902e feat(core): add --otp to top-level nx release command and detect EOTP errors (#34473)
## Current Behavior
When publish fails due to missing OTP code, its not clear as a user who
is using the top level command what to do next.

## Expected Behavior
Add the --otp flag to the top-level `nx release` command so users can
provide a one-time password for 2FA-enabled registries when running the
full release orchestration (version + changelog + publish).

When publish fails due to an expired or missing OTP (EOTP error),
display a helpful warning listing affected projects and the exact
command to re-run the publish step in isolation with a new OTP.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-18 08:05:40 -05:00
MaxKless dc6716828b feat(core): improve codex support for configure-ai-agents (#34488)
Codex has only basic MCP/AGENTS.md support right now. Also, because it
used to have only global-level config files, we had some extra logic
around configuring that.

We want Codex to get the latest skills too (they don't support custom
subagents yet, though) and use project-level config files that they now
support.
2026-02-18 20:14:27 +09:00
MaxKless 8de74d0984 feat(core): implement configure-ai-agents outdated message after tasks (#34463)
After running nx build (or any task), the daemon now shows a hint if
your AI agent configuration is outdated: "Your AI agent configuration is
outdated. Run nx configure-ai-agents to update."

The daemon computes and caches the full agent configuration status
(fully configured, outdated, partially configured, non-configured) using
latest Nx from npm, so the check is always against the newest available
configuration. Running nx configure-ai-agents resets the daemon's cache
so the message disappears on the next build.

  Key changes

- Daemon agent status endpoint: New GET_CONFIGURE_AI_AGENTS_STATUS /
RESET_CONFIGURE_AI_AGENTS_STATUS message types. The handler fires off
computation in the background and returns immediately (never blocks the
request). Results are cached for the daemon's lifetime.
- Shared latest-nx module: Extracted the "install nx@latest to tmp"
logic from nx-console-operations into daemon/server/latest-nx.ts so both
Nx Console and AI agents handlers share a single cached installation.
Includes a race-condition guard (in-flight promise deduplication).
- Post-task outdated hint: run-command.ts queries the daemon after task
execution and prints a single dim line if agents are outdated.
- Daemon reset from configure-ai-agents: The CLI sets NX_DAEMON=false
for configure-ai-agents, so we bypass daemonClient.enabled() and use
isServerAvailable() directly to reach an already-running daemon. The
socket is closed in a finally block so the process exits cleanly.
- Async editor detection (Rust): Made isEditorInstalled,
canInstallNxConsoleForEditor, installNxConsole, and related napi
functions async so they run on the libuv thread pool instead of blocking
Node's event loop. This prevents the daemon from stalling for ~3.5s when
checking editor extensions.
- output.logRawLine: New helper that prints a single line without the NX
prefix.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-18 18:53:41 +09:00
MaxKless b89c3084e7 feat(core): automatically set up ai agents in cnw/init when run from within an ai agent (#34469)
We want to minimize prompts for people and agents. But we also want to
help them by setting up nx config for them so their agents can work
optimally.
If they're executing `nx init` or `create-nx-workspace` from within an
agent, it's a reasonable assumption that they'll want the best AI config
for that specific agent - so we set it up for them.
2026-02-18 18:10:13 +09:00
Simon Heather bdf6d257b7 docs(core): add cacheKeyPrefix option to s3 remote cache options (#34157)
This pull request updates the documentation for the S3 cache plugin to
add the missing `cacheKeyPrefix` setting.

Text taken from https://github.com/nrwl/nx/pull/31395

Fixes #34147

---------

Co-authored-by: Caleb Ukle <caleb@nrwl.io>
Co-authored-by: Caleb Ukle <caleb.ukle+github@pm.me>
Co-authored-by: Simon Heather <simon.heather@yulife.com>
2026-02-17 22:24:35 -05:00
Leosvel Pérez Espinosa 678cd321f5 fix(core): replace buggy ignore-files trie with correct path-component gitignore matching (#34447)
## Current Behavior

The `nx watch` file watcher uses the `ignore-files` and
`watchexec-filterer-ignore` crates to handle `.gitignore` matching.
These crates use a trie-based approach that has a bug with
path-component matching — certain gitignore patterns (e.g., prefix
patterns) don't match correctly, causing files that should be ignored to
trigger unnecessary watch events.

## Expected Behavior

Gitignore patterns are matched correctly using per-directory `Gitignore`
instances from the `ignore` crate — the same crate already used by the
file walker. Each `.gitignore` file is scoped to its directory, and
matching is done deepest-first so that nested gitignores take priority —
matching standard git behavior.

### What changed

- Replaced `ignore-files` + `watchexec-filterer-ignore` with direct use
of `ignore::gitignore::{Gitignore, GitignoreBuilder}`, aligning the
watcher with the approach already used by the file walker
- Each `.gitignore` is now compiled as a standalone instance tied to its
parent directory
- Gitignore evaluation walks deepest-first; first match wins
- `.nxignore` matching now uses `matched_path_or_any_parents` for
correct ancestor checking
- `create_filter` is now synchronous (no longer `async`) since the new
approach doesn't need async I/O
- Removed 2 crate dependencies (`ignore-files`,
`watchexec-filterer-ignore`)
2026-02-17 18:30:22 -05:00
Jay Bell a0e34557f9 fix(core): use workspace root for path resolution when baseUrl is not set (#34453)
## Current Behavior
                                                            
When a project-level `tsconfig.json` (e.g., `apps/aurora/tsconfig.json`)
inherits `paths` via `extends` from `tsconfig.base.json` at the
workspace root and no explicit `baseUrl` is set, Nx incorrectly resolves
`./`-prefixed path mappings relative to the project tsconfig directory
instead of the workspace root where the paths were defined.
This causes errors when loading TypeScript config files (e.g.,
`rspack.config.ts`) that import workspace libraries using path aliases:
  NX   Cannot find module './libs/plugins/rspack/src'

`@swc-node/register`'s `readDefaultTsConfig` auto-sets `baseUrl` to
`dirname(tsConfigPath)` (the project directory) when not explicitly
configured, causing SWC to rewrite imports to incorrect relative paths
during transpilation.

  ## Expected Behavior

Path aliases defined in `tsconfig.base.json` (e.g.,
`"@trellis/plugins/rspack": ["./libs/plugins/rspack/src/index.ts"]`)
should resolve relative to the workspace root when no `baseUrl` is
configured.

This is needed so that when using `tsgo` and needing to prefix all paths
with `./` (no more `baseUrl` allowed) the paths are still resolved from
the right spot.

I tested this fix against our codebase on the branch I was trying to
switch to tsgo on and it seemed to work.

  ## Related Issue(s)

Fixes
https://discord.com/channels/1143497901675401286/1471627045694865581
2026-02-17 18:22:07 -05:00
Altan Stalker 5c7c9dd5fa chore(core): enable continuous assignment (#34471)
## Current Behavior
Continuous assignment is not enabled

## Expected Behavior
Continuous assignment is enabled
2026-02-17 18:17:15 -05:00
Juri Strumpflohner 4f31277f4f docs(repo): update CONTRIBUTING.md with Discord link (#34461)
## Current Behavior

CONTRIBUTING.md contains an outdated "How to Get Started Video" section
and references Stack Overflow for general questions.

## Expected Behavior

Remove outdated video section and point users to the Discord community
instead of Stack Overflow for general questions.

## Related Issue(s)

N/A
2026-02-17 18:15:38 -05:00
Colum Ferry c16377af25 feat(misc): use caret range for swc dependencies in pnpm catalog (#34487)
Use a range for the swc dependencies

Fixes #34472
2026-02-17 18:14:17 -05:00
Craigory Coppola 130cec466f fix(core): avoid blocking event loop during TUI PTY resize (#34385)
When switching from inline mode to full-screen TUI (or during window
resize), the PTY resize operation reparsed ALL raw terminal output
through a new vt100 parser synchronously on the event loop. For tasks
with large output, this caused a noticeable hang.

Add `resize_async()` which moves the expensive reparse to a background
thread using a snapshot-and-replay pattern:
1. Quick snapshot of raw output (brief read lock)
2. Expensive reparse on background thread (no locks held)
3. Quick swap with replay of any new output (brief write lock)

A generation counter prevents stale resizes from overwriting newer ones.

Also combine two separate O(n) scrollback processing calls in inline
mode into a single pass.
2026-02-17 18:07:43 -05:00
Copilot 65b94a1293 chore(repo): update copyright year to 2026 and refresh README description (#34437)
## Current Behavior

Copyright year shows 2017-2025 and README uses older tagline.

## Expected Behavior

Copyright reflects current year 2026 and README uses updated repository
description.

## Changes

- **LICENSE**: Updated copyright year from `2017-2025` to `2017-2026`
- **README.md**: Replaced heading and description
- New heading: "The Monorepo Platform that amplifies both developers and
AI agents. Nx optimizes your builds, scales your CI, and fixes failed
PRs automatically. Ship in half the time."
  - Removed redundant description line below heading

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> ## Update License and README
> 
> Please make the following changes:
> 
> 1. **Update LICENSE file**: Change the copyright year from `2017-2025`
to `2017-2026`
>    - File: `LICENSE`
> - Line 3: Update `Copyright (c) 2017-2025 Narwhal Technologies Inc.`
to `Copyright (c) 2017-2026 Narwhal Technologies Inc.`
> 
> 2. **Update README.md description**: Replace the current description
with the repository's official description
>    - File: `README.md`
> - Line 22: Change the heading from `# Smart Monorepos · Fast Builds`
to `# The Monorepo Platform that amplifies both developers and AI
agents. Nx optimizes your builds, scales your CI, and fixes failed PRs
automatically. Ship in half the time.`
> - Line 24: Remove the current description line: `Get to green PRs in
half the time. Nx optimizes your builds, scales your CI, and fixes
failed PRs. Built for developers and AI agents.`
> 
> The new README should have the repository description as the main
heading, followed immediately by the "Create a new Nx workspace with"
section.


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: FrozenPandaz <8104246+FrozenPandaz@users.noreply.github.com>
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2026-02-17 16:45:38 -05:00
Leosvel Pérez Espinosa 896a3f31ad fix(core): gate tui-logger init behind NX_TUI env var (#34426)
## Current Behavior

`tui_logger::init_logger()` and `TuiTracingSubscriberLayer` are
initialized unconditionally in `initialize_logger()`. This spawns a
background thread, causing unnecessary allocation churn and increased
processing.

## Expected Behavior

`tui_logger` is only initialized when `NX_TUI=true`, avoiding the
background thread and allocation overhead for all non-TUI contexts.
2026-02-17 16:40:48 -05:00
Caleb Ukle ea81b52442 chore(nx-dev): condense redirect rules (#34452)
## Current Behavior

We have ~1,657 redirect rules across `redirect-rules.js` and
`redirect-rules-docs-to-astro.js`, getting close to Netlify's limit and
we need room for more as the Astro migration continues.

## Expected Behavior

Reduced to **1,139 rules** (~31% reduction) by:

- Resolving duplicate/conflicting source paths across sections
- Flattening multi-hop redirect chains to point directly to final
destinations
- Consolidating groups of individual rules into wildcard patterns
(tutorials, CLI, helm, concepts, recipes, etc.)
- Removing old 2022-era sections (`schemaUrls`, `overviewUrls`,
`packagesIndexes`, `packagesDocuments`) whose destinations chain 3-5
hops deep and are long superseded by newer redirects
- made sure old links in nx code base still have redirects (will update
in future PR)

Build, tests, and internal link check all pass with no issues.

## Related Issue(s)

Fixes DOC-403

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2026-02-17 11:21:33 -06:00
Caleb Ukle edc9cc5af8 fix(nx-dev): use shared preview url for netlify deploy (#34467)
nextjs and astro should route to same preview deployments now


![wm_2026-02-16T19-40-04](https://github.com/user-attachments/assets/593c011a-ff78-4412-9bf0-ad186157f5d4)
2026-02-17 11:21:24 -06:00
Jack Hsu 2fa93afe2b feat(core): add agentic mode to nx init (#34418)
## Current Behavior

When AI agents (Claude Code, Cursor, Windsurf, etc.) run `nx init`, the
command works but:
- Uses interactive prompts that AI agents can't handle
- Outputs human-readable text that AI agents must parse
- Doesn't provide structured progress or error information

## Expected Behavior

When `nx init` detects an AI agent (via environment variables like
`CLAUDE_CODE=1`), it should:
- Skip interactive prompts and use sensible defaults
- Output structured NDJSON for progress updates, success, and errors
- Include detailed context for AI agents to understand and fix issues

## Changes

This PR adds agentic mode to `nx init`:

### `nx init` Changes
- Detect AI agents via `isAiAgent()` native function
- Auto-defaults: `interactive=false`, `nxCloud=false`, auto-detect `.nx`
installation
- NDJSON output with `type: progress|success|error`
- Error logs written to `.nx/ai-errors/` with full context
- Cursor restoration escape sequence skipped for AI agents (prevents
NDJSON corruption)

### Output Format
```jsonl
{"type":"progress","step":"starting","message":"Initializing Nx..."}
{"type":"success","nxVersion":"22.5.0","projectsDetected":1,"pluginsInstalled":["@nx/vite"]}
```

Or on error:
```jsonl
{"type":"error","message":"Failed to install","code":"INSTALL_ERROR","errorLogPath":".nx/ai-errors/nx-init-error-2025-01-15T10-30-00.log"}
```
2026-02-18 01:54:04 +09:00
MaxKless ee22084d1a fix(core): only pull configure-ai-agents from latest if local version is not latest (#34484)
## Current Behavior
we pull from latest all the time even if the current version is already
latest

## Expected Behavior
we can skip this extra work sometimes
2026-02-17 16:30:34 +00:00
Jack Hsu ca2fc0fa85 fix(misc): rewrite Framer URLs to nx.dev in HTML responses (#34445)
## Current Behavior

Pages proxied from Framer contain canonical URLs pointing to the Framer
domain (`ready-knowledge-238309.framer.app`), causing duplicate indexing
issues in search engines.

## Expected Behavior

Canonical URLs and other references in Framer-proxied pages now point to
`nx.dev`, ensuring proper SEO indexing.

### Implementation

Consolidated all Framer logic into a single Netlify edge function
(`rewrite-framer-urls.ts`) that:

1. Checks if the request path matches a Framer-proxied path (using
`FRAMER_REWRITES` env var)
2. Fetches directly from Framer (using `FRAMER_URL` env var)
3. Rewrites all Framer URLs to `nx.dev` in the HTML response (handles
`<link rel="canonical">`, `og:url`, etc.)
4. For non-Framer paths, passes through to Next.js

The edge function uses the `accept: ['text/html']` config to only run on
HTML requests, matching the pattern from `track-page-requests.ts` in
astro-docs.

The Next.js middleware has been removed since all Framer routing is now
handled by the edge function.

### Environment Variables

The edge function expects these env vars in Netlify (already added
previously):
- `NEXT_PUBLIC_FRAMER_URL`: e.g.,
`https://ready-knowledge-238309.framer.app`
- `NEXT_PUBLIC_FRAMER_REWRITES`: comma-separated list of paths, e.g.,
`/pricing,/enterprise`

## Demo

1. Go to https://deploy-preview-34445--nx-dev.netlify.app/
2. View source and look for canonical
3. See it is nx.dev not framer domain

<img width="1347" height="161" alt="image"
src="https://github.com/user-attachments/assets/d4a515da-e39f-41cb-a7b4-668fe0bedbbd"
/>


## Related Issue(s)

Closes CLOUD-4148
2026-02-17 10:53:46 -05:00
Steven Nance 0c14bcbe55 fix(release): remove unnecessary number from release return type (#34481)
## Current Behavior

The `release` function returned by `createAPI` has a return type of
`Promise<NxReleaseVersionResult | number>`. The `| number` union member
is inaccurate since the function always returns
`NxReleaseVersionResult`, which can mislead consumers of the
programmatic API.

## Expected Behavior

The return type is narrowed to `Promise<NxReleaseVersionResult>`,
accurately reflecting what the function actually returns and giving API
consumers correct type information.

Co-authored-by: Andreas Hörnicke <andreas.hoernicke@contentful.com>
2026-02-17 15:10:11 +00:00
MaxKless 08d899a2d2 docs(misc): update nx-mcp reference and tweak ai docs for skills (#34468)
we changed the default options of the nx mcp so we need to update docs
to reflect it
2026-02-17 22:23:39 +09:00
MaxKless 0d4160e968 docs(nx-dev): add MCP to skills blog post (#34428)
Blog post draft about the evolution from MCP tools to agent skills.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: MaxKless <MaxKless@users.noreply.github.com>
Co-authored-by: Juri Strumpflohner <juri.strumpflohner@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2026-02-17 09:28:34 +00:00
Craigory Coppola 8c15428f43 feat(core): support dependency filesets with ^{projectRoot} syntax (#34310)
## Current Behavior
`^` and `dependencies: true` only work for fileset inputs

## Expected Behavior
Adds support for inputs of the form `^{projectRoot}/**/*.ts` as
syntactic sugar for specifying a fileset input that should be collected
from dependency projects.

Previously, only named inputs could use the `^` prefix to include
dependencies (e.g., `^production`). Now filesets can also use this
syntax directly without needing to define a named input first.

Examples:
- `^{projectRoot}/**/*.ts` - include .ts files from all dependencies
- `^{workspaceRoot}/tools/**/*` - include workspace tools from
dependencies
- `{ fileset: '{projectRoot}/**/*.ts', dependencies: true }` - object
form

Detection is deterministic: if the string after `^` starts with
`{projectRoot}` or `{workspaceRoot}`, it's treated as a dependency
fileset; otherwise, it's treated as a named input reference.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-16 21:25:55 -05:00
Leosvel Pérez Espinosa 59b12edcb6 fix(core): prevent staggered and duplicate lines in dynamic output (#34462)
## Current Behavior

- In some `nx run-many` executions, terminal output can appear staggered
or visually misaligned instead of updating cleanly in place.
- For `run-many` cases that end up running a single task (especially
when TUI is not active), the spinner/status line can be rendered twice.

## Expected Behavior

- Dynamic terminal output updates should remain stable and aligned, with
clean in-place refreshes.
- Single-task `run-many` should display a single spinner/status line
with no duplicate rendering.
2026-02-16 17:31:07 +00:00
Juri dd3b79ebf4 fix(core): handle Ctrl+C gracefully in configure-ai-agents
Add uncaughtException handler for ERR_USE_AFTER_CLOSE to prevent
ugly stack trace when pressing Ctrl+C during enquirer prompts
(Node 24 stricter readline behavior). Matches existing pattern
used in nx init and create-nx-workspace.
2026-02-16 12:57:17 +01:00
Jason Jean d64e41dd99 fix(repo): revert sudo for global npm install in publish workflow (#34451)
## Current Behavior

The publish workflow uses `sudo npm install -g npm@11.5.2` which was
added in #34409. This causes issues with OIDC token permissions in the
release pipeline since `sudo` runs as a different user context.

## Expected Behavior

The publish workflow should use `npm install -g npm@11.5.2` without
`sudo`, matching the standard approach used elsewhere and avoiding
permission context issues during release.

## Related Issue(s)

Reverts #34409
2026-02-13 15:53:32 -05:00
Jack Hsu f5769f0bfb docs(misc): minor fixes for docs (#34449)
1. Consistent punctuation on intro page (periods at end of bullet
points).
2. Adjust AI detection for edge function.
2026-02-13 15:44:31 -05:00
Craigory Coppola 292a21319d feat(core): add --stdin to affected options (#34435)
- **feat(core): add `--stdin` to affected options**
- **fix(core): use newline-delimited stdin and add TTY guard for --stdin
option**

Supercedes #28770

Co-authored-by: @aaronccasanova

---------

Co-authored-by: Aaron Casanova <aaron.casanova@shopify.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2026-02-13 15:17:38 -05:00
Jason Jean c5e1bedca2 fix(repo): replace addnab/docker-run-action with direct docker run (#34448)
## Current Behavior

The publish workflow uses `addnab/docker-run-action@v3` which is based
on `docker:20.10` (Docker API 1.41). GitHub's `ubuntu-24.04` runners now
ship Docker Engine 28.x which requires minimum API version 1.44, causing
all 4 Linux Docker builds to fail:

```
docker: Error response from daemon: client version 1.41 is too old. Minimum supported API version is 1.44, please upgrade your client to a newer version.
```

Failed run: https://github.com/nrwl/nx/actions/runs/21961139962

## Expected Behavior

Linux Docker builds (x86_64-gnu, x86_64-musl, aarch64-gnu, aarch64-musl)
complete successfully using the host's modern Docker CLI.

https://github.com/nrwl/nx/actions/runs/21996143819

## Related Issue(s)

The `addnab/docker-run-action` repo is abandoned (last release March
2021, last commit May 2021) with open issues about this exact problem.
2026-02-13 12:42:30 -05:00
Jack Hsu c0540c8846 docs(misc): improve AX for getting started pages (#34410)
## Current Behavior

Getting started pages had overlapping content and unclear focus:
- `installation.mdoc` mentioned CNW and tutorials (belongs elsewhere)
- `start-new-project.mdoc` had manual setup option (belongs on
add-to-existing)
- `start-with-existing-project.mdoc` duplicated CI examples, editor
buttons, Nx Cloud walkthrough
- `intro.mdoc` mixed messaging - some "challenges" were polyrepo
problems

## Expected Behavior

Each page is now focused with no duplication:

### intro.mdoc
- Clear problem/solution structure following Turborepo's approach
- Problem: concise (builds get slow as codebase scales)
- Solution: caching, task orchestration, affected commands
- **Removed**: Polyrepo problems from challenge list (code sharing, lost
context)
- **Removed**: Lengthy deepdive callouts
- Net reduction: 67 deletions, 14 insertions

### installation.mdoc
- Global install (npm/brew/choco/apt) + verification step
- Local install (`nx init`) for existing repos
- Update instructions
- **Removed**: CNW mention, tutorials section, "More Documentation"

### start-new-project.mdoc
- Option 1: Create locally with templates (`create-nx-workspace`)
- Option 2: Create via Nx Cloud (browser-based)
- **Removed**: Manual setup option (that's for existing projects)
- Updated terminology: "presets" → "templates"

### start-with-existing-project.mdoc
- Focused: `nx init` → run tasks → see caching → explore graph
- Links to other pages instead of duplicating content
- **Removed**: CI config examples, Nx Cloud walkthrough, editor buttons

### editor-setup.mdoc
- Added problem hook explaining why editor integration matters
- Clarified Neovim is community-maintained

### ai-setup.mdoc
- Added problem hook about AI hallucination without workspace context
- Explained MCP acronym (Model Context Protocol)
- Clarified "Ralph Wiggum loop" terminology

### sidebar.mts
- Reordered to match natural flow: Installation → Start New/Add Existing
→ Editor/AI

## Related Issue(s)

Closes DOC-405

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2026-02-13 11:09:21 -05:00
Craigory Coppola ece9b5bf4a fix(core): remove shellapi from winapi featureset to minimize AV false positives (#34208)
## Current Behavior
There's a chance that windows can falsely flag our native binaries as a
threat. We do not use the shellapi feature from winapi.

## Expected Behavior
We hope that removing this API doesn't break things, and the threat
messaging goes away

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #https://github.com/nrwl/nx/issues/34186

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-12 19:32:58 -05:00
Craigory Coppola 51420790c3 chore(repo): improve copy-built-package script (#34432)
Makes copy-built-package script a bit more ergonomic and discoverable.
Adds some interactive UI for picking package / repo if they are not
specified.
2026-02-12 16:49:51 -05:00
Craigory Coppola c407de6e2b fix(core): hitting [1] or [2] should remove pinned panes if they match the current task (#34433)
## Current Behavior

Pressing `[1]` or `[2]` on a task that's already pinned to that slot
**focuses** the pane instead of unpinning it. This means there's no way
to unpin a single pane via keyboard — you can only nuke everything with
`[0]`.

This regression was introduced in #34175, which fixed a real problem:
pressing Enter on an already-pinned task would unpin it, leaving focus
on an invisible pane (a ghost pane — you're staring at nothing but the
TUI thinks you're looking at output). The fix was to make the "already
pinned to this pane" branch focus instead of unpin. The problem is that
`[1]`, `[2]`, and Enter all flowed through the same function
(`assign_current_task_to_pane`), so changing behavior for Enter changed
it for everyone. One lock got swapped out, and every door started
behaving the same way.

## Expected Behavior

`[1]` and `[2]` are **toggles**: press once to pin, press again to
unpin. Enter is a **display** action: show me this task's output and put
my cursor there — if it's already visible somewhere, just take me to it.

After this change:

- **`[1]` / `[2]`** on an already-pinned task → unpins it (pane
disappears, layout adjusts, focus returns to task list if no panes
remain)
- **Enter** on an already-pinned task → focuses whichever pane it's in
(even if it's in pane 2 and you'd normally expect pane 1)
- **Init** (startup restore of pinned tasks) → pure assignment, no
toggling, no focusing

## Approach

The old code had one function trying to serve three masters. Rather than
adding a flag parameter (`should_toggle: bool`) — which would just be a
boolean that lies about its intentions at every call site — the function
was split along the actual semantic boundaries:

| Function | Used by | "Already pinned here" behavior |
|---|---|---|
| `toggle_current_task_in_pane` | `[1]` / `[2]` keys | **Unpin** (toggle
off) |
| `assign_current_task_to_pane` | `init()` | No-op (task is where it
should be) |
| `display_and_focus_current_task_in_terminal_pane` | Enter key |
**Focus** the existing pane |

The shared logic — exiting spacebar mode, moving a task between panes,
fresh-pinning — lives in two small helpers (`exit_spacebar_and_pin`,
`move_or_pin_selection`) that both `toggle` and `assign` delegate to.
The only code that differs is the "what do we do when it's already
here?" branch, which is exactly the part that *should* differ.

**Why not keep one function with a mode parameter?** Because the three
behaviors aren't variations of the same action — they're genuinely
different user intents. A toggle is "I changed my mind." A focus is
"Take me there." An assignment is "Put this here." Encoding that as an
enum parameter just moves the branching somewhere less obvious and makes
the call sites harder to read. The function names now document the
intent at the point of use, and there's no shared state to accidentally
couple.

**Why does Enter check all panes, not just pane 0?** Because if you
pinned a task to pane 2 via `[2]` and then press Enter on it, the least
surprising thing is to jump to where it already lives — not to silently
duplicate it into pane 1 or ignore you. The task is already on screen;
Enter means "show me."

## Related Issue(s)

Fixes the regression introduced by #34175.
2026-02-12 16:21:29 -05:00
Jack Hsu 950265fc8c feat(misc): lock in CNW variant 2 with deferred connection (#34416)
## Current Behavior

CNW (Create Nx Workspace) has A/B testing logic that randomly selects
between variants 0, 1, and 2 for the Nx Cloud connection flow. Each
variant shows different prompts and banners.

## Expected Behavior

Lock in variant 2 as the permanent behavior:
- **No cloud prompt** - users are not asked about Nx Cloud during
workspace creation
- **Deferred connection** - no `nxCloudId` is written to `nx.json` (uses
`skipCloudConnect: true`)
- **Variant 2 banner** - shows "Enable remote caching and automatic
fixes when CI fails" with a link to complete setup later

### Changes
- Simplified `ab-testing.ts` - removed caching, random selection;
`getFlowVariant()` always returns `'2'`
- `shouldShowCloudPrompt()` always returns `false`
- `determineNxCloudV2()` returns `'github'` with `skipCloudConnect:
true` for deferred connection
- Removed variant 1 banner logic from `messages.ts`
- Updated tests to reflect the locked-in behavior

## Demo

https://www.loom.com/share/7f688eed6052428cbe91dd9db837cbbd

## Related Issue(s)

Closes CLOUD-4255

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 16:05:28 -05:00
Benjamin Cabanes 28fea0db0c docs(nx-dev): replace global ID with deterministic target ID for HBST (#34431)
Simplified form targeting by replacing the global `reactHubspotForm` ID
with a deterministic `targetId` that incorporates portal, form, and
calendly IDs. This improves scalability and avoids potential ID
collisions.
2026-02-12 14:03:02 -05:00
Benjamin Cabanes b5c3663126 docs(nx-dev): add back inline script (#34429) 2026-02-12 12:56:17 -05:00
MaxKless a757f40d83 fix(maven): correctly map between maven locators and nx project names (#34366) 2026-02-13 01:42:31 +09:00
Jack Hsu 7a4e052533 chore(misc): add banner content monitor workflow (#34417)
## Current Behavior

When banner content changes in Framer, the nx-docs and nx-dev sites need
to be manually redeployed to pick up the new content.

## Expected Behavior

A scheduled workflow monitors the banner URL every 15 minutes and
automatically triggers Netlify production deploys when content changes.

## How it works

1. Fetches `BANNER_URL` content (from repository variable)
2. Computes SHA256 hash
3. Compares to cached hash from previous run
4. If different → triggers both Netlify deploys, updates cache
5. If unchanged → no-op

## Required Setup

1. **Repository variable** (`Settings → Secrets and variables → Actions
→ Variables`):
   - `BANNER_URL` = Framer banner API URL

2. **Repository secret** (`Settings → Secrets and variables → Actions →
Secrets`):
   - `NETLIFY_AUTH_TOKEN` = Netlify personal access token

## Related Issue(s)

Fixes DOC-405
2026-02-12 10:37:47 -05:00
Juri 9a57042cbe docs(nx-dev): add Nx AI agent skills blog post 2026-02-12 16:28:57 +01:00
Steven Nance 754b01a066 feat(core): add negation pattern support for plugin include/exclude (#34160)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Negation patterns are ignored in plugin configuration for the `include`
and `exclude` properties.

## Expected Behavior

- Negation patterns should work in the same way that they do for other
`include`/`exclude` configurations

**Example: Excluding all e2e projects except one**

```jsonc
// nx.json
{
  "plugins": [
    {
      "plugin": "@nx/jest/plugin",
      "exclude": ["**/*-e2e/**/*", "!**/toolkit-workspace-e2e/**/*"],
    },
  ],
}
```

This will exclude all e2e projects except `toolkit-workspace-e2e`.

**Example: Including packages except legacy ones**

```jsonc
// nx.json
{
  "plugins": [
    {
      "plugin": "@nx/vite/plugin",
      "include": ["packages/**/*", "!packages/legacy/**/*"],
    },
  ],
}
```

**How negation patterns work:**

- Patterns are processed in order from first to last
- A pattern starting with `!` removes files from the match set
- A pattern without `!` adds files to the match set
- The last matching pattern determines if a file is included
- If the first pattern is a negation, all files are matched initially

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 16:03:20 +01:00
Colum Ferry 5a1735b041 feat(misc): update PLUGIN.md files to help agents verification (#34379)
## Current Behavior
There is currently no plugin.md file for Gradle.
Other plugin.md files can be improved

## Expected Behavior
Add plugin.md file for Gradle to aid with verification with Agents.
Add plugin.md file for Vite for workspaces that have not migrated to
@nx/vitest.

## Related Issue(s)

CLOSES NXC-3843

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2026-02-12 12:25:10 +01:00
Josh VanAllen a0ff232ad7 feat(testing): add cacheDir option to playwright executor (#34413)
## Current Behavior

The Playwright executor does not support configuring a custom cache
directory for Playwright's internal cache (browser binaries, etc.).
Users who need to control where Playwright stores its cache, for example
in CI environments with specific disk constraints like not being able to
DTE tasks or shared caching setups, have no way to set this through the
executor configuration.

## Expected Behavior

A new `cacheDir` option is available on the Playwright executor. When
provided, it sets the `PWTEST_CACHE_DIR` environment variable on the
forked Playwright process, allowing users to control where Playwright
stores its internal cache.
  ```json
  {
    "targets": {
      "e2e": {
        "executor": "@nx/playwright:playwright",
        "options": {
          "cacheDir": "/tmp/playwright-cache"
        }
      }
    }
  }
  ```

## Related Issue(s)

Replaces #34397

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:36:17 -05:00
Jack Hsu 17f2f1bdc6 docs(misc): clarify security email usage in SECURITY.md (#34411)
## Current Behavior

The SECURITY.md file does not clarify what types of reports should be
sent to the security email, leading to reports about outdated
dependencies and vulnerability scanner output.

## Expected Behavior

The file now clarifies that the security email is for demonstrable,
verified vulnerabilities in the Nx codebase itself, not for:
- Outdated dependency reports
- Dependencies with CVEs that don't directly affect Nx
- General vulnerability scanner output

## Related Issue(s)

Fixes NXC-3898

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 15:08:20 -05:00
Jason Jean e48f2f3a8c fix(repo): use sudo for global npm install in publish workflow (#34409)
## Current Behavior

The `npm install -g npm@11.5.2` step in the publish workflow fails with
`EACCES: permission denied, mkdir '/usr/local/share/man/man5'` on newer
GitHub Actions runner images.

## Expected Behavior

The global npm install step completes successfully regardless of runner
image permissions on `/usr/local/share/man/`.

## Related Issue(s)

This is a known issue with GitHub Actions runners:
https://github.com/actions/runner-images/issues/9644
2026-02-11 14:49:43 -05:00
Colum Ferry 7785eae516 feat(core): extract sandbox detection into reusable utility (#34408)
Add isSandbox() utility that checks for sandbox environment variables
(SANDBOX_RUNTIME, GEMINI_SANDBOX, CODEX_SANDBOX, CURSOR_SANDBOX) and
use it to disable the daemon and plugin isolation in sandbox
environments.
2026-02-11 18:33:17 +00:00
Miroslav Jonaš 28c5d95964 fix(nx-dev): clarify project linking for workspaces (#34405)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: meeroslav <meeroslav@users.noreply.github.com>
2026-02-11 16:34:13 +00:00
Caleb Ukle 0e53c3f3d5 fix(nx-dev): add missing nx-cloud intro in sidebar (#34403) 2026-02-11 15:36:12 +00:00
Colum Ferry 6bf8c4693f feat(core): handle agentic sandboxing (#34402)
## Current Behavior
Running ai agents in sandbox mode causes issues with Nx's daemon and
plugin isolation

## Expected Behavior
Running ai agents in sandbox mode should work

## Related Issue(s)

CLOSES NXA-828
2026-02-11 15:12:49 +00:00
Philip Fulcher 8e3cff657b docs(nx-dev): add broadcom success story (#34393) 2026-02-11 09:36:42 -05:00
Colum Ferry 15d508e814 feat(core): add nxVersion to meta in shortUrl for cnw (#34401)
## Current Behavior
We do not include NxVersion when creating short urls.

## Expected Behavior
Include NxVersion when creating short urls. 

## Related Issue(s)

CLOSES NXC-3879
2026-02-11 09:27:03 -05:00
Craigory Coppola 6570674abf fix(core): handle dangling symlinks during cache restore (#34396)
When cache outputs include both glob patterns and directory patterns
containing symlinks, the cache restore fails with EEXIST (os error 17).
This happens because `fs_extra::remove_items` silently skips dangling
symlinks (since `is_dir()`/`is_file()` follow links and return false),
leaving stale symlinks that cause `symlink()` to fail.

The fix makes symlink creation idempotent by checking for and removing
any existing symlink at the destination before creating a new one, using
`symlink_metadata()` which correctly detects dangling symlinks.

Fixes #34013
2026-02-10 17:41:18 -05:00
Jason Jean 2d71d9ac65 fix(maven): use module-level variable for cache transfer between createNodes and createDependencies (#34386)
## Current Behavior

The Maven plugin's `createNodes` and `createDependencies` functions both
independently compute a hash of all pom.xml directories, then use that
hash to look up cached Maven analysis data from disk. When Maven
projects have `<includes>` or `<excludes>` in their plugin config, the
hash can differ between the two calls, causing `createDependencies` to
fail to find the data that `createNodes` stored.

## Expected Behavior

`createDependencies` reliably receives the Maven analysis data from
`createNodes` regardless of hash differences, by reading it from a
module-level variable instead of re-hashing and looking it up from disk.

This matches the pattern already used by the Gradle plugin
(`getCurrentGradleReport`).

## Related Issue(s)
2026-02-10 16:27:51 -05:00
Leosvel Pérez Espinosa f43d2028ff fix(core): make runtime cache key deterministic (#34390)
## Current Behavior

Runtime cache keys could be nondeterministic because the order of
environment variables varied, leading to inconsistent cache hits across
runs.

## Expected Behavior

Runtime cache keys are deterministic regardless of the insertion order
of env variables, improving cache stability.
2026-02-10 15:45:30 -05:00
Leosvel Pérez Espinosa 6c9f0cb46d fix(core): avoid dropping unrelated continuous deps in makeAcyclic (#34389)
## Current Behavior

Cycles in the task graph could remove unrelated `continuousDependencies`
when the cycle exists only in `dependencies`, leading to missing
continuous task edges.

## Expected Behavior

Cycle removal only removes the specific cyclic edge from the list where
it appears, preserving unrelated continuous dependencies.
2026-02-10 15:44:26 -05:00
Caleb Ukle bd13929de8 fix(nx-dev): improve plugin registry visibility (#34395)
- **fix(nx-dev): make sure "plugin registry" shows up in search**
- search ranking will be re-evaled after we work through more content
updates
<img width="768" height="1406" alt="image"
src="https://github.com/user-attachments/assets/e7ca2aff-7daf-417b-ad96-ba6722480432"
/>

- **docs(nx-dev): add plugin registry to footer**
<img width="1076" height="405" alt="image"
src="https://github.com/user-attachments/assets/4c93c5ec-1f64-4cd6-8f88-9347d5009ac9"
/>
2026-02-10 13:13:54 -06:00
Brett Burley f5a7ea1606 fix(core): clean up stale socket files before listening (#34236)
## Current Behavior

When running Nx tasks in CI environments (e.g., Buildkite) where the
host's /tmp is mounted to containers, intermittent EADDRINUSE errors
occur in PseudoIPCServer.init(). This happens because:

1. PseudoIPCServer doesn't clean up its Unix socket file before calling
listen()
2. ForkedProcessTaskRunner.createPseudoTerminal() instantiates
PseudoTerminal directly instead of using the createPseudoTerminal()
helper, bypassing shutdown callback registration

When a new container starts with the same PID as a previous run (PID
recycling), it generates the same socket path and hits EADDRINUSE
because the stale socket file still exists.

## Expected Behavior

No EADDRINUSE errors should occur. The PseudoIPCServer should
defensively remove any stale socket file before attempting to listen,
similar to how the daemon server handles this.

## Related Issue(s)

Fixes #34233
2026-02-10 13:36:34 -05:00
Benjamin Cabanes 9c42292ed8 docs(nx-dev): remove Cookiebot & GA integration, migrate all events to GTM (#34384)
Streamlined analytics tracking by removing Cookiebot and direct GA
(gtag.js) integrations. Consolidated event logging through GTM's
dataLayer for consistency and maintenance simplicity.
2026-02-10 12:17:47 -05:00
Altan Stalker ec0f51ed75 chore(core): enable cloud experimental polling (#34394)
Updated CI behavior
2026-02-10 12:05:20 -05:00
Leosvel Pérez Espinosa 5ae53ecae8 fix(core): use a consistent batch id between scheduler and task runner (#34392)
## Current Behavior

Batch IDs are generated in two places: the task scheduler uses an
incremental counter (`executorName N`) while the forked process task
runner generates its own using the process PID (`executorName-pid`).
This means the batch ID registered in metrics doesn't match the one used
everywhere else.

## Expected Behavior

Batch IDs are only created by the task scheduler. The forked process
task runner uses the scheduler-assigned ID to ensure consistency across
the system.
2026-02-10 11:33:14 -05:00
MaxKless 5066511576 fix(core): make sure that mcp args aren't overridden when running configure-ai-agents (#34381)
## Current Behavior
right now if users modify their mcp params like `--minimal`, we will
override them on `configure-ai-agents`

## Expected Behavior
We want to bring users up to latest without overriding their valid
configurations
2026-02-10 14:24:09 +01:00
Benjamin Staneck 0b6961b0d7 feat(core): update formatting of agent rules documentation (#33356) 2026-02-10 22:22:41 +09:00
Caleb Ukle 089e111fcc docs(nx-cloud): update info about GH permissions (#34380)
https://deploy-preview-34380--nx-docs.netlify.app/docs/enterprise/single-tenant/custom-github-app#configure-permissions-for-the-github-app

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2026-02-09 12:09:17 -06:00
Jason Jean 93fddd14de chore(repo): update nx to 22.5.0-beta.5 (#34371)
Updating Nx from 22.5.0-beta.4 to 22.5.0-beta.5
2026-02-09 13:00:52 -05:00
Kai Gritun f1873b27a8 fix(core): use --lockfile-only for Bun updateLockFile (#34375)
## Current Behavior

The Bun package manager config uses `--frozen-lockfile` for
`updateLockFile`:

```typescript
updateLockFile: 'bun install --frozen-lockfile',
```

However, `--frozen-lockfile` **prevents** changes to the lockfile,
causing `nx release` to fail when trying to update the lockfile after
version bumps.

## Expected Behavior

Use `--lockfile-only` which generates/updates the lockfile without
installing dependencies:

```typescript
updateLockFile: 'bun install --lockfile-only',
```

This is consistent with other package managers:
- npm: `npm install --package-lock-only`
- pnpm: `pnpm install --lockfile-only`
- yarn berry: `yarn install --mode update-lockfile`

## Background

When Bun support was added in PR #22602 (April 2024), `--lockfile-only`
didn't exist in Bun. Bun has since added this flag.

Closes #34344

Co-authored-by: Kai Gritun <kai@kaigritun.com>
2026-02-09 10:08:19 -05:00
Jason Jean 81c157d063 fix(repo): align pnpm version in CI workflows with package.json (#34370)
## Current Behavior

Several GitHub Actions workflows hardcode pnpm version `10.11.1`, while
`package.json` specifies `pnpm@10.28.2` in the `packageManager` field.
This causes CI failures with:

```
Error: Multiple versions of pnpm specified:
  - version 10.11.1 in the GitHub Action config with the key "version"
  - version pnpm@10.28.2 in the package.json with the key "packageManager"
```

## Expected Behavior

All pnpm version references across CI workflows should match the
`packageManager` field in `package.json` (`10.28.2`).

## Related Issue(s)

N/A — Fixing CI breakage from version mismatch.

## Changes

Updated pnpm version from `10.11.1` → `10.28.2` in:
- `.github/workflows/npm-audit.yml` — `pnpm/action-setup` version
- `.github/workflows/publish.yml` — `PNPM_VERSION` env var and FreeBSD
install
- `.github/workflows/issue-notifier.yml` — `pnpm/action-setup` version
- `.github/workflows/generate-embeddings.yml` — `pnpm/action-setup`
version
2026-02-06 19:45:33 -05:00
Jason Jean 1f5520ebb1 fix(core): add missing FileType import for Windows watcher build (#34369)
## Current Behavior

The Windows build (`aarch64-pc-windows-msvc`) fails to compile with:

```
error[E0433]: failed to resolve: use of undeclared type `FileType`
  --> packages\nx\src\native\watch\types.rs:128:55
```

The `FileType` type is used inside a `#[cfg(target_os = "windows")]`
block but was not imported.

## Expected Behavior

The Windows build compiles successfully. The `FileType` import is scoped
inside the `#[cfg(target_os = "windows")]` block (matching the existing
pattern in the macOS block) so there are no unused imports on any
platform.

## Related Issue(s)

N/A — build breakage discovered during CI publish workflow.
2026-02-06 18:47:18 -05:00
Jason Jean 0aef1ef26f fix(core): reduce daemon inotify watch count by upgrading watchexec (#34329)
## Current Behavior

The daemon's file watcher uses watchexec 3.0.1 which hardcodes
`RecursiveMode::Recursive` when registering inotify watches. This means
**every** directory gets an inotify watch — including all of
`node_modules`, `.git`, and other ignored trees.

On a typical workspace with a large `node_modules`, this can consume
thousands of inotify watches, eating kernel memory and CPU. The
`WatchFilterer` only filters **events** after watches are already
registered — the watches themselves are never prevented.

## Expected Behavior

Only non-ignored directories (workspace source code) get inotify
watches. Ignored directories like `node_modules`, `.git`, `.nx/cache`,
`.nx/workspace-data`, and `.yarn/cache` are skipped entirely at the
watch registration level.

This dramatically reduces:
- **inotify watch count** (from thousands to hundreds)
- **Memory usage** (each watch consumes kernel memory)
- **CPU overhead** (fewer watches = less kernel bookkeeping)

### How it works

- Upgraded watchexec 3.0.1 → 8.0.1 which supports
`WatchedPath::non_recursive()`
- Added `create_watch_walker()` using `ignore::WalkBuilder` (same
pattern as `walker.rs`) to enumerate only non-ignored directories
- Each directory is watched with `NonRecursive` mode — like putting
security cameras only in the rooms you care about instead of every room
in the building
- New directories created at runtime are dynamically added to the watch
set via the `on_action` handler
- Event-level filtering via `WatchFilterer` is unchanged — same behavior
for gitignore/nxignore patterns

### macOS Support for Dynamic Directory Registration

The initial implementation worked on Linux and Windows but failed tests
on macOS because macOS FSEvents doesn't always provide the same
`FileEventKind` tags as Linux inotify or Windows ReadDirectoryChangesW.

**Three changes to support macOS:**

1. **watcher.rs**: On macOS, check all events for directory creation
(not just events with specific FileEventKind tags) and verify via
filesystem
2. **types.rs**: Filter directory events from JavaScript callbacks on
macOS (similar to Windows behavior)
3. **watch_filterer.rs**: Allow macOS directory events (`Create(Folder)`
and `Modify(Metadata)`) through the filter so the action handler can
register them

All changes use `#[cfg(target_os = "macos")]` for compile-time
conditional compilation, so Linux/Windows behavior is completely
unchanged and there's zero runtime overhead.

### Additional notes

- Pinned `serde` to `<1.0.220` because serde 1.0.220+ moved `__private`
to `serde_core`, breaking `swc_common 0.31.22`
- No TypeScript changes — the napi interface is identical
- `watch_filterer.rs`, `types.rs`, `utils.rs` required no changes (APIs
are compatible)

## Related Issue(s)
Fixes https://github.com/nrwl/nx/issues/33781
Fixes https://github.com/nrwl/nx-console/issues/2468
<!-- No specific issue linked yet -->

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 17:21:19 -05:00
Louie Weng 693f75149a chore(repo): re-enable gradle e2e tests (#34357)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Re-enabling tests and putting back kotlin e2e tests for gradle.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-06 13:24:48 -08:00
Craigory Coppola 5e4dd04b66 fix(core): only detect flaky tasks for cacheable tasks (#33994)
## Current Behavior

Flaky task detection warns about all tasks that have different exit
codes for the same hash, including non-cacheable tasks. This is
misleading because the flaky task warning message points users to Nx
Cloud's flaky task retry feature, which is only relevant for cached
tasks.

## Expected Behavior

Flaky task detection should only consider tasks where `task.cache ===
true`, making the warning more meaningful and avoiding noise for
non-cacheable tasks.

## Related Issue(s)

N/A - Internal improvement

## Changes Made

###
`packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle.ts`
1. Added `cacheable: boolean` to the `TaskRun` interface
2. In `endTasks`, now tracks `cacheable: taskResult.task.cache === true`
for each task
3. In `endCommand`, filters to only check flaky tasks among cacheable
tasks

###
`packages/nx/src/tasks-runner/life-cycles/task-history-life-cycle-old.ts`
1. Added `cacheableHashes: Set<string>` to track which task hashes are
cacheable
2. In `endTasks`, tracks cacheable tasks by adding their hash to the set
3. In `endCommand`, only checks for flaky tasks among cacheable task
hashes

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:39:43 -05:00
Louie Weng 8280910e48 docs(gradle): add compat table and target name prefix (#34359)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

A new version compatibility table is added to help users understand
which versions of the Gradle plugin work with which versions of the Nx
plugin. The targetNamePrefix configuration option is now documented with
an explanation of its use case in polyglot workspaces where target name
collisions may occur.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-06 12:35:33 -08:00
Craigory Coppola 37a69f0c9d feat(core): eagerly shutdown plugins that don't provide later hooks (#34253)
# Plugin Isolation Architecture

## 1. Plugin Loading Flow

### 1a. Entry Point - Isolation Decision

```mermaid
flowchart TD
    Start([getPlugins called]) --> CheckIsolation{Isolation<br/>enabled?}
    CheckIsolation -->|Yes| LoadIsolated[loadIsolatedNxPlugin]
    CheckIsolation -->|No| LoadInProcess[loadNxPluginInProcess]
    LoadIsolated --> IsolatedPath([See: Isolated Loading])
    LoadInProcess --> InProcessPath([See: In-Process Loading])
```

### 1b. Isolated Plugin Loading

```mermaid
flowchart TD
    subgraph Main["Main Process"]
        Start([loadIsolatedNxPlugin]) --> CheckCache{In cache?}
        CheckCache -->|Yes| ReturnCached([Return cached promise])
        CheckCache -->|No| StaticLoad[IsolatedPlugin.load]
        StaticLoad --> Resolve[resolveNxPlugin<br/>find plugin path]
        Resolve --> SpawnWorker[spawn child process]
    end

    SpawnWorker -.->|"start process"| WorkerStart

    subgraph Worker["Worker Process (plugin-worker.ts)"]
        WorkerStart([process starts]) --> CreateServer[create Unix socket server]
        CreateServer --> Listen[listen for connections]
        Listen --> WaitForConnect[wait for main process]
        WaitForConnect --> HandleLoad[receive 'load' message]

        subgraph InProcess["In-Process Loading (same as 1c)"]
            HandleLoad --> RequirePlugin[require plugin module]
            RequirePlugin --> NormalizePlugin[normalizeNxPlugin]
        end

        NormalizePlugin --> SendLoadResult[send 'loadResult'<br/>with hook capabilities]
        SendLoadResult --> WaitForMessages[wait for hook messages<br/>or socket close]
        WaitForMessages --> HandleHook{message<br/>received?}
        HandleHook -->|hook message| ExecuteHook[call plugin.hook]
        ExecuteHook --> SendResult[send result]
        SendResult --> WaitForMessages
        HandleHook -->|socket closed| Cleanup[cleanup & exit]
    end

    subgraph Main2["Main Process (continued)"]
        ConnectSocket[connect via<br/>Unix socket] --> SendLoad[send 'load' message]
        SendLoad --> WaitLoad[wait for 'loadResult']
        WaitLoad --> SetupHooks[setupHooks<br/>create lifecycle manager]
        SetupHooks --> CheckGraphHooks{Has graph<br/>phase hooks?}
        CheckGraphHooks -->|No| EarlyShutdown[socket.end<br/>shutdown worker]
        CheckGraphHooks -->|Yes| KeepAlive[keep worker alive]
        EarlyShutdown --> Done([Plugin ready])
        KeepAlive --> Done
    end

    SpawnWorker --> ConnectSocket
    SendLoadResult -.->|"loadResult"| WaitLoad
    EarlyShutdown -.->|"socket close"| Cleanup
```

### 1c. In-Process Plugin Loading

```mermaid
flowchart TD
    Start([loadNxPluginInProcess]) --> Resolve[resolveNxPlugin]
    Resolve --> Require[require plugin module]
    Require --> Normalize[normalizeNxPlugin<br/>wrap hooks]
    Normalize --> Done([Plugin ready])
```

## 2. Hook Execution Flow

### 2a. Isolated Hook Execution

```mermaid
flowchart TD
    Start([hook called<br/>e.g. createNodes]) --> EnsureAlive{_alive?}
    EnsureAlive -->|No| Restart[spawnAndConnect<br/>restart worker]
    Restart --> SetAlive[_alive = true]
    SetAlive --> EnsureAlive

    EnsureAlive -->|Yes| EnterHook[lifecycle.enterHook<br/>increment session count]
    EnterHook --> SendRequest[sendRequest<br/>over socket]
    SendRequest --> WaitResponse[wait for response<br/>with timeout]

    WaitResponse --> CheckSuccess{success?}
    CheckSuccess -->|No| ExitHookError[lifecycle.exitHook]
    ExitHookError --> ThrowError[throw error]

    CheckSuccess -->|Yes| ExitHook[lifecycle.exitHook]
    ExitHook --> CheckShutdown{should<br/>shutdown?}
    CheckShutdown -->|Yes| Shutdown[shutdown worker]
    CheckShutdown -->|No| Return([return result])
    Shutdown --> Return
```

### 2b. Shutdown Decision Logic

```mermaid
flowchart TD
    Start([exitHook called]) --> IsLastHook{Last hook<br/>in phase?}
    IsLastHook -->|No| NoShutdown1([return false])

    IsLastHook -->|Yes| CheckSessions{sessionCount<br/>== 0?}
    CheckSessions -->|No| NoShutdown2([return false<br/>other callers active])

    CheckSessions -->|Yes| CheckLaterPhases{Has later<br/>active phases?}
    CheckLaterPhases -->|Yes| NoShutdown3([return false<br/>needed later])
    CheckLaterPhases -->|No| YesShutdown([return true<br/>safe to shutdown])
```

## 3. Developer Workflow: Adding/Modifying Plugin Hooks

### Step 1: Design Public API

```mermaid
flowchart TD
    A1[public-api.ts] --> A2[Define context type<br/>e.g. MyHookContext]
    A2 --> A3[Export new types]
    A3 --> A4[loaded-nx-plugin.ts]
    A4 --> A5[Add hook to<br/>LoadedNxPlugin interface]
```

### Step 2: Define Message Types

```mermaid
flowchart TD
    B1[messaging.ts] --> B2[Add entry to PluginMessageDefs]
    B2 --> B3[Define payload and result types]
    B3 --> B4[Add to MESSAGE_TYPES array]
    B4 --> B5[Add to RESULT_TYPES array]
```

The messaging system uses a unified `DefineMessages` pattern. To add a
new message:

```typescript
// In PluginMessageDefs, add a new entry:
type PluginMessageDefs = DefineMessages<{
  // ... existing messages ...

  myHook: {
    payload: {
      context: MyHookContext;
    };
    result:
      | { success: true; data: MyResultData }
      | { success: false; error: Error };
  };
}>;
```

The individual message/result types (`PluginWorkerMyHookMessage`,
`PluginWorkerMyHookResult`)
are automatically derived. Export them if needed for external use:

```typescript
export type PluginWorkerMyHookMessage = MessageOf<PluginMessageDefs, 'myHook'>;
export type PluginWorkerMyHookResult = ResultOf<PluginMessageDefs, 'myHook'>;
```

### Step 3: Handle in Worker Process

```mermaid
flowchart TD
    C1[plugin-worker.ts] --> C2[Add handler in<br/>consumeMessage]
    C2 --> C3["Call plugin.myHook()"]
    C3 --> C4[Return result payload]
```

Handlers return just the result payload - the infrastructure wraps it
automatically:

```typescript
// In consumeMessage handlers:
myHook: async ({ context }) => {
  try {
    const data = await plugin.myHook(context);
    return { success: true as const, data };
  } catch (e) {
    return { success: false as const, error: createSerializableError(e) };
  }
},
```

### Step 4: Update Load Result

```mermaid
flowchart TD
    D1[messaging.ts] --> D2[Add hasMyHook to<br/>load.result in PluginMessageDefs]
    D2 --> D3[plugin-worker.ts]
    D3 --> D4[Populate hasMyHook<br/>in load handler]
```

### Step 5: Wire Up IsolatedPlugin

```mermaid
flowchart TD
    E1[isolated-plugin.ts] --> E2[Add hook property<br/>to class]
    E2 --> E3[Update LoadResultPayload<br/>type export]
    E3 --> E4[Add to registeredHooks<br/>array in setupHooks]
    E4 --> E5[Add wrapped hook<br/>implementation]
    E5 --> E6["wrap('myHook', async (ctx) => {<br/>  sendRequest('myHook', { context: ctx })<br/>})"]
```

### Step 6: Update Lifecycle Phases (if needed)

```mermaid
flowchart TD
    F1{New phase<br/>needed?} -->|Yes| F2[plugin-lifecycle-manager.ts]
    F2 --> F3[Add phase to<br/>HOOKS_BY_PHASE]
    F1 -->|No| F4[Add hook to existing<br/>phase array in HOOKS_BY_PHASE]
```

### Step 7: Add Tests

```mermaid
flowchart TD
    G1[isolated-plugin.spec.ts] --> G2[Test hook registration]
    G2 --> G3[Test hook execution]
    G3 --> G4[Test restart behavior]
    G4 --> G5[plugin-lifecycle-manager.spec.ts]
    G5 --> G6[Test phase transitions<br/>with new hook]
    G6 --> G7[Test shutdown decisions]
```

## File Reference

| File | Purpose |
| ----------------------------- |
------------------------------------------------------------- |
| `../public-api.ts` | Public types exported to plugin authors |
| `../loaded-nx-plugin.ts` | Interface definition for loaded plugins |
| `messaging.ts` | Message type definitions for worker communication |
| `plugin-worker.ts` | Worker process - receives messages, calls plugin
functions |
| `isolated-plugin.ts` | Main class - spawns worker, sends messages,
manages lifecycle |
| `plugin-lifecycle-manager.ts` | Tracks phases, decides when to
shutdown |
| `load-isolated-plugin.ts` | Caching layer for isolated plugins |
| `../get-plugins.ts` | Entry point - decides isolation mode |

## Lifecycle Phases

```
LOADED → [graph] → [pre-task] → {tasks run} → [post-task]
           │           │                           │
           │           └── preTasksExecution ──────┤
           │                                       │
           ├── createNodes                         │
           ├── createDependencies                  │
           └── createMetadata                      │
                                                   │
                                    postTasksExecution
```

**Shutdown rules:**

- Plugin shuts down after its last active phase completes
- If only `postTasksExecution`: shutdown immediately after load, restart
when needed
- Concurrent callers tracked via session count (ref counting)

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2026-02-06 14:54:10 -05:00
Caleb Ukle 359c7fbf4e fix(nx-dev): include nx cli examples on refs page (#34367)
![wm_2026-02-06T11-26-54@2x](https://github.com/user-attachments/assets/c2814268-e921-420b-a9e2-2b90c8a89526)

https://deploy-preview-34367--nx-docs.netlify.app/docs/reference/nx-commands#nx-add

cli examples are included in the generated page now

fixes: DOC-402
2026-02-06 12:39:00 -05:00
James Henry 0d2882e1c0 fix(core): use picocolors instead of chalk in the nx package (#34305) 2026-02-06 19:17:52 +04:00
Colum Ferry 541498f58a feat(core): update cnw messaging (#34364)
CLOSES CLOUD-4235
2026-02-06 10:04:42 -05:00
Colum Ferry b85ac155cf feat(js): update swc/cli to 0.8.0 (#34365)
Update `@swc/cli` to 0.8.0 which uses chokidar v5
2026-02-06 08:47:56 -05:00
MaxKless 5f42ccc3e9 docs(maven): minor tweaks and include targetNamePrefix (#34362)
this makes the maven documentation more complete for the latest changes
2026-02-06 13:30:44 +00:00
Louie Weng 8fdfc523a8 chore(gradle): bump gradle version to 0.1.12 (#34250)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Gradle plugin to 0.1.12

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-05 15:32:01 -08:00
Louie Weng a44a27b29a feat(gradle): add debug env var to gradle batch executor (#34259)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

- No way to run the batch executor in debug mode
- Any flags passed into the nx gradle batch command get forwarded into
the `gradlew` command.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

- Allow for an env variable to be set for debug flags so that the batch
runner jar can be run with a debugger hooked in.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #NXC-3797

---------

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2026-02-05 22:26:02 +00:00
Leosvel Pérez Espinosa 0cac182b73 fix(core): avoid crash when pane area is out of bounds during resize (#34343)
## Current Behavior

In some resize/background scenarios, the TUI could crash while rendering
output panes, displaying a "Scrollbar area is empty" message.

## Expected Behavior

The TUI remains stable during resizes and backgrounding. Output panes no
longer crash when a scrollbar would render in an invalid area.
2026-02-05 17:11:47 -05:00
Louie Weng b69ff4ceb9 chore(repo): fix broken disablement command (#34355)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-05 17:11:01 -05:00
Louie Weng 4337d2e928 fix(gradle): use gradle project name when resolving dependent tasks (#34331)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

When Nx processes Gradle subprojects, task dependencies reference the
wrong project names. For a subproject structure like :app or :lib:core,
the generated task dependencies use only the simple project name (app or
core) instead of the full build tree path (:app or :lib:core). This
causes dependent tasks to be generated with incorrect project
references, breaking the task graph for multi-project Gradle builds.

## Expected Behavior
Task dependencies should use the full Gradle build tree path for
subprojects. When a task in :app depends on a task in :lib, the
dependency should be correctly referenced as :lib:taskName.

The fix introduces a getNxProjectName() utility function that correctly
resolves the Nx project name based on the Gradle project's
buildTreePath, and applies it consistently across all dependency
resolution logic in ProjectUtils.kt and
TaskUtils.kt. New tests verify the fix works for both single and nested
subproject structures.

Also removed --rerun-tasks from the batch and non batch runners, we
found that during parallel task executions with the non batch runner,
the flag would cause cache conflicts that would fail tasks.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-05 13:44:05 -08:00
Leosvel Pérez Espinosa a0be6adcf8 fix(core): track all task outputs regardless of path depth (#34321)
## Current Behavior

When a task has outputs at different path depths, some outputs may not
be tracked. This causes:

- Deleted output files not being detected
- Cache restoration being skipped with message "existing outputs match
the cache, left as is"
- Files not being restored even though they exist in cache

## Expected Behavior

All task outputs are tracked regardless of their path depth, ensuring:

- Deleted outputs are correctly detected
- Cache restoration happens when outputs are missing
2026-02-05 16:41:39 -05:00
Leosvel Pérez Espinosa dffdfa694c fix(core): disable ignore filters for outputs expansion (#34316)
## Current Behavior

When a task output directory contains a nested `.gitignore` that hides
its contents, Nx can treat the outputs as already present and skip
restoring them from cache. This can result in generated files being
missing from disk, even though the cache entry is valid.

## Expected Behavior

Nx should restore cached outputs regardless of ignore rules inside the
output directory.

## Related Issue(s)

Fixes #32620
2026-02-05 16:37:14 -05:00
Louie Weng a40ff52db0 chore(gradle): temporarily disable e2e tests (#34351)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Disabling Gradle e2e tests until foojay toolchain service back online.

Ensures that gradle within the Nx repo uses mise to download java
toolchain, but gradle workspaces within the e2e environments download
their own toolchain.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #Q-175
2026-02-05 16:32:59 -05:00
Philip Fulcher bd41ce5692 docs(nx-dev): add feb 2026 webinar (#34352) 2026-02-05 16:24:18 -05:00
Philip Fulcher 1f09a5d1a5 docs(nx-dev): remove errant author from article (#34349) 2026-02-05 14:58:04 -05:00
Jack Hsu 0b99f560d4 feat(core): add AI agent detection and NDJSON output for CNW (#34320)
AI agents are detected via environment variables (CLAUDECODE, OPENCODE)
and receive NDJSON streaming output, non-interactive mode, structured
JSON results with explicit GitHub setup instructions.

Related NXC-3628

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:57:39 -05:00
Caleb Ukle 866d5b1e9b fix(nx-dev): use right URL for the given netlify context (#34348) 2026-02-05 13:19:17 -05:00
Caleb Ukle d4ad62f522 fix(nx-dev): fix og images wrong URL for embeds (#34346)
fixes: DOC-399

next used the VERCEL_URL by default for metadataBase. this is not
present in netlify. so resolve to netlify URLs if VERCEL_URL is not
present so metadata links are correct.

working on PR:
<img width="704" height="875" alt="image"
src="https://github.com/user-attachments/assets/4edd194e-27d6-46ce-bdd2-7da4ab70d482"
/>
<img width="976" height="204" alt="image"
src="https://github.com/user-attachments/assets/63ea32f5-20cf-4df2-96a1-a1bc2ff59411"
/>



https://6984ce9d1bad30000873247d--nx-dev.netlify.app/blog/nx-2026-roadmap
2026-02-05 17:45:12 +00:00
Louie Weng 3aff575002 docs(gradle): add reference to batch mode (#34271)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Add documentation for batch mode. Remove references to removed custom
overrides for intTest.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-05 08:07:05 -08:00
Jonathan Cammisuli 7df9d96dac feat(core): add command to download cloud client (#34333)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
The only way to download the cloud client is to run a specific cloud
command or a task with cloud configured.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
A new command is added where we only download the cloud client with:
```
nx download-cloud-client
```

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-05 10:42:55 -05:00
Caleb Ukle 05fb208fda docs(node): add bundling guide (#34244)
add guide to clarify various ways to bundle a node app for different
bundlers

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2026-02-05 15:25:42 +00:00
Philip Fulcher 33f031be04 docs(nx-dev): add 2026 roadmap article (#34327) 2026-02-05 08:47:23 -06:00
James Henry 0e11f95163 chore(repo): add dependabot config to try and remove false positives (#34341) 2026-02-05 18:26:46 +04:00
Juri Strumpflohner 2b07ac22c2 feat(core): improve AI agent rules for CLAUDE.md generation (#34304)
## Summary

Updates the generated CLAUDE.md content with improved guidance for AI
agents working with Nx workspaces.

**Changes:**
- Add "nx-workspace skill first" for workspace navigation
- Add "prefix nx commands with package manager" rule
- Add "NEVER guess CLI flags" rule
- Add "Scaffolding & Generators" section (invoke nx-generate skill
first)
- Add "When to use nx_docs" guidance (USE for advanced config, DON'T USE
for basic syntax)

## Why These Changes

Based on testing with repeated scaffolding tasks, agents were:

| Issue | Fix |
|-------|-----|
| Calling `nx_docs` for basic generator syntax | Added clear guidance on
when to use/not use nx_docs |
| Guessing CLI flags incorrectly (e.g., `nx sync --apply`) | Added
"never guess flags" rule |
| Using global nx CLI causing version mismatches | Added package manager
prefix rule |
| Not invoking nx-generate skill on scaffolding tasks | Added explicit
"Scaffolding & Generators" section |

## Related

Companion PR with skill improvements:
https://github.com/nrwl/nx-ai-agents-config/pull/26

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-05 21:17:59 +09:00
Jason Jean efa364f73d fix(core): preserve task selection when unrelated tasks finish (#34328)
## Current Behavior

In the TUI, when any standalone task finishes,
`handle_standalone_task_finished` unconditionally switches the user's
selection to another in-progress task — even if the finished task wasn't
the one the user had selected. This causes the selection to jump
unexpectedly while the user is watching a different task.

## Expected Behavior

Selection should only change when the task the user is actively viewing
finishes. If an unrelated background task finishes, the user's selection
should remain on whatever they chose.

## Related Issue(s)

N/A — discovered during development testing.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2026-02-04 21:23:22 -05:00
Craigory Coppola 82265ff157 fix(core): allow overriding daemon logging settings (#34324)
## Current Behavior
NX_NATIVE_LOGGING is hardcoded and can't be customized on the daemon
server

## Expected Behavior
Log settings can be customized by changing them in the env of the first
command to spawn the daemon

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-04 21:12:23 -05:00
Jason Jean 015ff1a45b chore(repo): update nx to 22.5.0-beta.4 (#34334)
Updating Nx from 22.5.0-beta.3 to 22.5.0-beta.4
2026-02-05 00:27:21 +00:00
Caleb Ukle cdb4bb2acc fix(nx-dev): exclude large native deps from build bundle (#34335)
we were including native binaries in the final netlify function build
for nextjs which was fine until we reach the limit of 250mb causing a
failure to upload the function (AWS imposed lambda limit)

Now we strip out any deps we know we don't need for the app which are
dev deps and not runtime required.
2026-02-04 19:09:25 -05:00
Jason Jean 3c7f94e3d5 chore(repo): align canary and PR release versions with next (#34330)
## Current Behavior

- Canary releases calculate their base version by incrementing the minor
of `nx@latest`, or using `nx@next` major when majors differ
- PR releases always use `0.0.0` as their base version (e.g.
`0.0.0-pr-1234-abc1234`)
- This means canary and PR versions don't clearly relate to the current
beta release line

## Expected Behavior

- Both canary and PR releases derive their base version directly from
`nx@next`
- If next is `22.5.0-beta.5`, then:
  - Canary: `22.5.0-canary.20260204-abc1234`
  - PR: `22.5.0-pr.1234.abc1234`
- All prerelease channels now share the same base version, making it
clear which release line they belong to

## Related Issue(s)

N/A - internal improvement to release infrastructure
2026-02-04 16:36:44 -05:00
Jason Jean ef55f97df3 feat(maven): bump maven plugin version to 0.0.13 (#34318)
## Current Behavior

The Maven plugin version is `0.0.12` across all pom.xml files and the
versions.ts constant. The `bump-maven-version` generator does not update
the `batch-runner-adapters` pom files, causing version mismatches.

## Expected Behavior

The Maven plugin version is bumped to `0.0.13` in **all** pom.xml files
(including batch-runner-adapters), with a migration created for users
upgrading to Nx `22.5.0-beta.4`. The bump generator now includes the
batch-runner-adapters pom files so future bumps won't miss them.

### Changes
- Updated version from `0.0.12` to `0.0.13` in all pom.xml files (root,
maven, maven-plugin, shared, batch-runner, batch-runner-adapters,
maven3-adapter, maven4-adapter)
- Updated `mavenPluginVersion` constant in
`packages/maven/src/utils/versions.ts`
- Added `update-0-0-13` migration entry in
`packages/maven/migrations.json` targeting Nx `22.5.0-beta.4`
- Created migration file
`packages/maven/src/migrations/0-0-13/update-pom-xml-version.ts`
- Fixed `bump-maven-version` generator to include
`batch-runner-adapters` pom files
2026-02-04 14:06:18 -05:00
Jack Hsu 5880551c6a chore(repo): update docs readme with guiding principles (#34319)
This PR adds info for how we structure the docs so when we write them we
know where to put things, what to write, etc.
2026-02-04 13:40:08 -05:00
Jason Jean fb6c2982e6 fix(misc): improve freebsd build reliability with better error handling and disk cleanup (#34326)
## Current Behavior

The FreeBSD build in CI can fail silently or with unclear error messages
when:
- Disk space runs low during the build process
- The build command fails without proper error propagation
- Unnecessary files consume valuable disk space

## Expected Behavior

With these changes:
- Additional disk space is freed by removing docs/astro-docs/nx-dev
directories before building
- Build exit codes are properly captured and propagated
- Disk usage is logged after the build completes for debugging purposes
- Build failures are clearly reported with explicit error messages

This improves reliability and makes it easier to diagnose issues when
they occur.

## Related Issue(s)

<!-- No specific issue, general CI improvement -->
2026-02-04 13:34:52 -05:00
Caleb Ukle 81944b02c5 feat(nx-dev): reformat sidebar into topics (#34265)
Sidebar contains everything about the docs which is overhelming and hard
to find information a person could be looking for.

instead we move into "topics" to section the sidebar based on intention
of content, making it easier to have a journey through the docs or jump
straight to the content someone could be looking for.

This doesn't change any routes of pages, just hard links into the
sidebar (instead of autogenerate based on dir) in the future once we
solidify where everything will live, we can come back and rearrange
files to reuse the autogenerate dirs.


![wm_2026-02-04T10-48-54](https://github.com/user-attachments/assets/6add05b3-b929-492f-a54e-fde6c2929973)

![wm_2026-02-04T10-50-10](https://github.com/user-attachments/assets/e9c89621-c287-4c9a-8d14-692bd1a73739)
<img width="1385" height="1003" alt="image"
src="https://github.com/user-attachments/assets/4bbee4fe-2f7e-4d7a-ad6b-45f6064c897a"
/>

![wm_2026-02-04T11-03-15@2x](https://github.com/user-attachments/assets/10561621-5c80-4843-a7c4-a1272adf7b8e)

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2026-02-04 11:57:47 -06:00
Jack Hsu c1cc626e52 docs(misc): filter out non-existing image requests and also only track HTML page views when requested with "Accept: text/html" (#34317)
We're getting requests to `favicon.svg.md` that are being tracked,
ignore these. Also for the server page views, we should only count them
if `text/html` is in the accept header. Browsers will send these, and AI
agents, curl, etc. do not. This allows us to compare browser traffic vs
AI/curl traffic more accurately.
2026-02-04 10:38:25 -05:00
Jason Jean 6f3d38ad3c fix(core): handle EPIPE errors gracefully in daemon socket writes (#34311)
## Current Behavior

When a client disconnects while the daemon is writing a response, a
`socket.write` call triggers an EPIPE error. The old error handler used
`console.error`, which caused the error to propagate through
`respondWithErrorAndExit` and crash the daemon process via
`process.exit(1)`. The client would then see an `internalDaemonError`
and permanently disable the daemon via `markDaemonAsDisabled`, requiring
`nx reset` to recover.

Additionally, disconnected sockets were not cleaned up from the file
watcher and project graph listener registries on socket error events,
only on `close` events. This left a window where the daemon could
attempt to write to dead sockets during notifications.

## Expected Behavior

When a client disconnects mid-response:
- The `socket.write` callback logs the error gracefully via
`serverLogger` instead of `console.error`
- The daemon process stays alive and continues serving other clients
- The `socket.on('error')` handler cleans up registered file watcher and
project graph listener sockets immediately, matching the existing
`close` handler behavior
- The daemon is never permanently disabled due to EPIPE errors

## Related Issue(s)

<!-- No linked issue -->
2026-02-04 09:43:59 -05:00
MaxKless d0e4a92738 fix(core): tweak configure-ai-agents messaging (#34307)
### Current Behavior
The nx configure-ai-agents command output is minimal - just "AI agents
set up successfully" with a
bullet list of agent names. Users don't understand what was actually
configured (plugin vs MCP,
skills, which files were created/modified).
### Expected Behavior
Clearer feedback about what gets configured for each agent:
Selection prompt improvements:
- Agents needing updates show (update available) tag
- Footer always shows result state: what will be configured
- Agent-specific descriptions (e.g., "Installs Nx plugin (MCP + skills +
agents). Updates
CLAUDE.md.")
Post-configuration output:
- Compact summary per agent showing what was set up
- Example: Claude Code: Nx plugin (MCP + skills + agents) + CLAUDE.md
Claude .mcp.json cleanup:
- When configuring Claude, removes nx-mcp from .mcp.json since it's now
handled by the plugin
- Deletes the file entirely if nx-mcp was the only entry

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-04 09:43:38 -05:00
Jack Hsu 2ea6961e0d fix(core): fix CNW git amend and README marker handling (#34306)
This PR fixes two issues:
1. When the README changes are amended, there's an edge case where we
don't have a commit to amend (e.g. `--skipGit`), and this fails the
entire CNW flow.
2. When user opts out of Cloud, we strip the entire `<!-- BEGIN:
nx-cloud -->` block in README rather than just the comments and leaving
the content.

Closes NXC-3812

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 08:50:42 -05:00
Benjamin Cabanes 1195565b96 docs(nx-dev): update Nx Cloud & Home features, add new components (#34149) 2026-02-03 18:04:01 -05:00
Craigory Coppola 7478cbb59d feat(core): add initial impl of task io service (#34205)
## Current Behavior
There's not an easy to use service to track PIDs being registered to nx
tasks

## Expected Behavior
There's a service to track this stuff

## Related Issue(s)
2026-02-03 17:42:17 -05:00
Jason Jean 79d878f240 fix(core): prevent command injection in getNpmPackageVersion (#34309)
## Current Behavior

The `getNpmPackageVersion` function in
`packages/workspace/src/generators/utils/get-npm-package-version.ts`
uses `execSync` with direct string interpolation of the `packageName`
parameter. When a user runs `create-nx-workspace` with a custom
`--preset` value that doesn't match a known preset, the value flows
unsanitized into a shell command:

```js
execSync(`npm view ${packageName}... version --json`)
```

This allows arbitrary command execution via shell metacharacters (e.g.,
`--preset='pkg$(malicious command)'`).

## Expected Behavior

User-supplied package names are validated against a strict npm package
name regex before being passed to any shell command. The function now
uses `execFileSync` with an args array instead of `execSync` with string
interpolation, providing defense in depth:

1. **Input validation** — rejects anything that isn't a valid npm
package name
2. **Safe execution** — arguments are passed as an array so Node.js
handles escaping, rather than concatenating into a raw shell string
2026-02-03 16:18:43 -05:00
Caleb Ukle b198606bef docs(nx-cloud): add screenshots for cache troubleshoot guide (#34296) 2026-02-03 15:35:34 -05:00
Craigory Coppola 1cb6c0b14c fix(core): nx should show help for run-one when using project short names (#34303)
## Current Behavior
Given a project name like `:foo`, you can run tasks like `nx test foo`
(note `foo` vs `:foo`), but passing --help throws an error

## Expected Behavior
`--help` works the same with the shortname vs full name

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-02-03 14:56:23 -05:00
Jason Jean 3f6bdc7ff7 fix(maven): include pom.xml and ancestor pom files as inputs for all targets (#34291)
## Current Behavior

- `pom.xml` is only included as an input when a mojo uses default inputs
- Mojos with specific input configurations (like
`maven-compiler-plugin:compile`) don't get `pom.xml` in their inputs
- Parent `pom.xml` files aren't tracked as inputs

This can lead to stale cache hits when:
1. `pom.xml` changes but a mojo has specific input config
2. A parent `pom.xml` changes (affecting inherited properties,
dependency versions, plugin config)

## Expected Behavior

- Every target should include its own `pom.xml` as an input
- Every target should include ancestor `pom.xml` files (within the
workspace) as inputs
- Cache should invalidate when any relevant `pom.xml` changes

## Related Issue(s)

N/A - discovered during code review

## Changes

- **CacheConfig.kt**: Removed `pom.xml` from `defaultInputs` (now always
added explicitly)
- **MojoAnalyzer.kt**: Added `workspaceRoot` parameter and logic to walk
up the parent chain, adding all in-workspace ancestor `pom.xml` files as
inputs
- **NxProjectAnalyzerMojo.kt**: Pass `workspaceRoot` to `MojoAnalyzer`
2026-02-03 14:26:11 -05:00
Jason Jean cc4ec68bce chore(repo): update nx to 22.5.0-beta.3 (#34295)
Updating Nx from 22.5.0-beta.2 to 22.5.0-beta.3
2026-02-03 14:20:30 -05:00
Juri 01d2f64b90 docs(nx-dev): add autonomous AI workflows blog post
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:26:28 +01:00
James Henry 39d8a9a6ac chore(repo): update to pnpm@10.28.2 and clean up pnpm config (#34298) 2026-02-03 17:48:01 +04:00
Jack Hsu 4f02c6b56e docs(misc): ignore /docs/og/*.png.md paths (#34289)
This PR excludes `/docs/og/*` paths from assets tracking. This is likely
added by some crawler and is additional compute/noise that we don't care
about.

<img width="1354" height="86" alt="image"
src="https://github.com/user-attachments/assets/6bfda816-0d26-46b3-b432-ae96e5976c37"
/>
2026-02-02 13:32:06 -05:00
Jack Hsu 3f77cd5927 fix(nx-dev): fix double-counting and exclude assets from page tracking (#34286)
## Current Behavior

1. **track-asset-requests** runs twice per request due to redundant path
patterns:
   ```typescript
   path: ["/*.txt", "/**/*.txt", "/*.md", "/**/*.md"]
   ```
The `/**/*` pattern already matches root level files, so `/*` is
redundant.

2. **track-page-requests** runs on many asset requests even though it
only tracks HTML page views:
   - Font files: `/docs/fonts/*.woff2`, `/docs/*.woff`
   - Images: `/docs/*.svg`, `/docs/*.png`, `/docs/og/*`
   - Pagefind search index: `/docs/pagefind/*`

## Expected Behavior

1. Asset tracking should fire only once per request
2. Page tracking should exclude all non-HTML assets at Netlify level
(zero compute)

## Changes

### track-asset-requests.ts
Simplified path patterns:
```typescript
path: ["/**/*.txt", "/**/*.md"]
```

### track-page-requests.ts
Added comprehensive exclusions:

| Category | Exclusions |
|----------|------------|
| Images | `.svg`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.ico`,
`/images/*`, `/og/*` |
| Fonts | `/fonts/*`, `.woff`, `.woff2` |
| Search | `/pagefind/*` |

## Related Issue(s)

Fixes DOC-395
2026-02-02 12:17:32 -05:00
Jason Jean 89aa25e5d0 fix(core): resolve daemon client reconnect queue deadlock (#34284)
## Current Behavior

When the daemon dies while processing a request, the reconnect logic
adds the retry back to the promise-based queue. However, the original
request is still blocked in the queue waiting for a response that will
never come (the socket is dead). This creates a deadlock:

1. Original request (`fn1`) is blocked awaiting a promise that will
never resolve
2. Retry request (`fn2`) is queued but can't execute until `fn1`
completes
3. `fn1` can't complete because it's waiting on the dead socket

## Expected Behavior

When reconnecting after daemon death, the retry should resolve the
pending promise that the original queue entry is waiting on, allowing
the queue to proceed normally.

## Related Issue(s)

<!-- No specific issue, discovered during development -->

## Solution

Instead of re-queuing the retry through `sendToDaemonViaQueue` (which
adds to the end of the queue), we now call `sendMessageToDaemon`
directly. This resolves the pending promise that `fn1` is waiting on,
allowing it to complete naturally and the queue to proceed.

Also removed the now-unused `decrementQueueCounter` method from
`PromisedBasedQueue`.
2026-02-02 12:05:33 -05:00
Jack Hsu cdd735dc63 feat(nx-dev): add server-side page view tracking for docs (#34283)
## Current Behavior

Only markdown and text file requests are tracked server-side via the
`track-asset-requests` edge function. HTML page views are not tracked on
the server, missing requests from AI tools and curl.

## Expected Behavior

Track all doc page views server-side with a new edge function that:
- Sends `server_page_view` events to GA4 with `content_type` param to
differentiate HTML/markdown/text
- Uses Netlify's `excludedPath` config for efficient path filtering
(zero compute for excluded paths)
- Skips non-HTML requests via Accept header check

### Changes

| File | Change |
|------|--------|
| `track-page-requests.ts` | **NEW** - Edge function for HTML page view
tracking on `/docs/*` |
| `track-asset-requests.ts` | Changed event name to `server_page_view`,
added `content_type` param |
| `add-link-headers.ts` | Refactored to use `excludedPath` config
instead of runtime path checks |
| `netlify.toml` | Added edge function declaration for
`track-page-requests` |

### GA Event Schema

```javascript
{
  name: 'server_page_view',
  params: {
    content_type: 'text/html' | 'text/markdown' | 'text/plain',
    file_extension: '.html' | '.md' | '.txt',
    is_ai_tool: 'true' | 'false',
    // ... other params
  }
}
```

## Other Notes

This PR also removes the edge function entries from `netlify.toml` since
it's auto detected from `astro-docs/netlify/edge-functions`. This makes
all the configuration in the actual `.ts` file, not duplicated in the
`netlify.toml` file.

## Related Issue(s)

Closes DOC-395

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:15:01 -05:00
Juri Strumpflohner f59c15a410 docs(core): update AI pages and include new info about configure-ai-agents command (#34257)
changes to:
-
https://deploy-preview-34257--nx-docs.netlify.app/docs/getting-started/ai-setup
-
https://deploy-preview-34257--nx-docs.netlify.app/docs/features/enhance-ai
-
https://deploy-preview-34257--nx-docs.netlify.app/docs/reference/nx-mcp

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2026-02-02 15:58:32 +00:00
Louie Weng 94319c7531 fix(gradle): enforce that only one gradle task can be passed into gradle executor (#34269)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The Gradle executor accepts a taskName option that *should not* contain
multiple space-separated tasks. When multiple tasks are provided, the
batch runner misinterprets the space-separated string as containing
project names rather than treating it as a single task argument, leading
to execution errors and confusion.

This only occurs if the taskName is manually overridden and should not
occur when task names are generated by the project graph plugin.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The Gradle executor now validates that taskName contains only a single
task without spaces. If multiple tasks are passed, it throws a clear
error message: "Task '[taskName]' contains spaces. Only a single Gradle
task is allowed per executor invocation." This prevents the batch runner
from misinterpreting the task name and provides immediate feedback to
users about the correct usage.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-02 10:14:08 -05:00
Louie Weng 35bc17e4fe fix(gradle): ensure that batch output is not overriden for atomized targets (#34268)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior

When running Gradle tasks in batch mode with atomized targets, if the
same task appears multiple times in the output (which happens when tasks
are atomized and executed separately), the batch runner only captures
the output from the last execution. Previous executions' output gets
overwritten because the splitOutputPerTask function replaces the entire
output for each task name it encounters.

## Expected Behavior

All output from a task should be preserved, even when the task appears
multiple times in the batch output. When the same task name is
encountered multiple times, the outputs should be concatenated rather
than replaced, ensuring developers can see the complete execution
history for atomized targets.



## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-02-02 10:12:27 -05:00
Copilot d65dcfa806 docs(dotnet): fix build target dependsOn example (#34206)
## Plan for fixing .NET incremental builds documentation

- [x] Update the "Target dependencies" section to remove `restore` from
the `dependsOn` array
- [x] Add explanation about why `restore` cannot be run through Nx for
solutions using custom frameworks
- [x] Improve explanation clarity based on review feedback
- [x] Verify the "Target configuration" section is consistent with the
changes
- [x] Complete code review and address feedback
- [x] Run security checks (no issues found)
- [x] Address PR feedback: Use JSX `<Aside>` component with import
statement instead of Markdoc tag

## Summary

Successfully fixed the documentation issue in the .NET incremental
builds guide. The changes made:

1. **Removed `restore` from the build target's `dependsOn` array** - The
documentation now correctly shows `"dependsOn": ["^build"]` instead of
`"dependsOn": ["restore", "^build"]`, matching the actual implementation
in the plugin code.

2. **Added a clear explanation** - Included an aside box explaining why
`restore` is not in the `dependsOn` array: because Nx requires NuGet
package restoration to be completed before running any tasks, and
including it would create a circular dependency.

3. **Verified consistency** - Checked that the "Target configuration"
section already showed the correct configuration, ensuring all
documentation is now consistent.

4. **Used correct Starlight component** - Changed from Markdoc `{% aside
%}` tag to JSX `<Aside>` component with proper import statement per
Starlight documentation standards.

The changes align with the actual implementation in
`packages/dotnet/analyzer/Utilities/TargetBuilder.Build.cs` where the
build target's `dependsOn` is set to `[$"^{targetName}"]` (line 56).

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>docs(dotnet): implied conflict in dependsOn of inferred
build task</issue_title>
> <issue_description>### Documentation issue
> 
> <!-- (Update "[ ]" to "[x]" to check a box) -->
> 
> - [ ] Reporting a typo
> - [ ] Reporting a documentation bug
> - [ ] Documentation improvement
> - [x] Documentation feedback
> 
> <!--
> If your issue is not regarding the documentation, please choose an
issue type:
>   https://github.com/nrwl/nx/issues/new/choose
> -->
> 
> ### Is there a specific documentation page you are reporting?
> 
>
https://nx.dev/docs/technologies/dotnet/guides/incremental-builds#target-dependencies
> 
> ### Additional context or description
> 
> The code sample provides in this doc includes `"dependsOn":
["restore", "^build"]`, but the automatically inferred `build` target
from this plugin does not actually include the `restore` target in the
dependsOn array. I assume this is by design? The docs seem to confuse it
a bit.
> </issue_description>
> 
> <agent_instructions>Remove the `restore` target from the dependsOn
block. Add a small explanation that we can't run restore through Nx
because Nx requires restore to have been completed prior to running
tasks if the solution uses a custom framework</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes nrwl/nx#34150

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
2026-02-02 08:55:21 -06:00
iceThief (민찬기) e35dcd2050 fix(core): handle multibyte UTF-8 characters in socket message consumption (#34151)
## Current Behavior

When socket data chunks split a multibyte UTF-8 character (e.g., CJK
characters like Korean, Chinese, Japanese) at an arbitrary byte
boundary, `Buffer.toString()` decodes incomplete byte sequences as
replacement characters (�), causing message corruption.

This can occur when:
- File paths contain non-ASCII characters
- Project names include multibyte characters
- Any JSON message contains international text

## Expected Behavior

Multibyte UTF-8 characters should be properly decoded even when split
across multiple socket data chunks. The fix uses Node.js `StringDecoder`
which buffers incomplete multibyte sequences until the remaining bytes
arrive.

## Related Issue(s)

Fixes socket message corruption for paths/names containing multibyte
characters.
2026-02-01 22:09:53 -05:00
Caleb Ukle 251121530d fix(nx-dev): make headers and table options linkable (#34267)
- fix(nx-dev): always link headers regardless of mdoc or markdown
content source (generated vs static file)
- fix(nx-dev): make option/property columns in table linkable
- the table column header is matched on `options`, `option`,
`properties`, and property` (case insensitive)



https://github.com/user-attachments/assets/7250b9d5-1030-4ebc-9e21-0a05f295bbf5


Note bc mdoc and `renderMarkdown` go through 2 different rendering
pipelines, this logic must bc within the markdoc config and rehype
(markdown) processing logic. tried to shared logic where I could

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:15:46 -05:00
Jack Hsu ec110b7bff feat(core): add decorative banners for Nx Cloud CNW completion message (#34270)
## Current Behavior

After completing the CNW (Create Nx Workspace) flow with Nx Cloud, users
see a plain text completion message with a link to finish setup.

## Expected Behavior

Users now see one of four completion message variants controlled by
`NX_CNW_FLOW_VARIANT`:
- **Variant 0**: Plain link (control) - always used for enterprise URLs
- **Variant 1**: "Try the full Nx platform" decorative ASCII banner
- **Variant 2**: "Unlock 70% faster CI" decorative ASCII banner
- **Variant 3**: "Reclaim your team's focus" decorative ASCII banner

Key changes:
- Added enterprise URL detection (non-standard Nx Cloud URLs always get
variant 0)
- Locked the cloud prompt to always show "Try the full Nx platform?" (no
longer varies by flow variant)
- Flow variant now only affects the completion banner, not the prompt
- Added `snapshot.nx.app` to standard Nx Cloud hosts
- Removed variant 2 auto-connect behavior (all variants now prompt)

## Screenshots
Variant 0:
<img width="1392" height="1065" alt="variant0"
src="https://github.com/user-attachments/assets/0b18686e-1481-4fc0-995e-1577052887ff"
/>

Variant 1:
<img width="1392" height="1065" alt="variant1"
src="https://github.com/user-attachments/assets/e5909e2e-e1d8-4d04-9721-ba6186d06891"
/>

Variant 2:
<img width="1392" height="1065" alt="variant2"
src="https://github.com/user-attachments/assets/7e9f819f-e3c0-44d7-9760-0cab1d5dd9ac"
/>

Variant 3:
<img width="1392" height="1065" alt="variant3"
src="https://github.com/user-attachments/assets/83f0499f-d807-4dc8-9390-c7eec93590a9"
/>


## Related Issue(s)

Closes CLOUD-4147

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:24:18 +00:00
Louie Weng bd627f1096 chore(repo): enable batch mode (#34245)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Enable Gradle executor to run tasks in batch mode in CI.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-30 21:25:51 +00:00
Victor Savkin e3eedf9e94 docs(misc): update the docs to use more direct language (#34264)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-30 14:43:59 -05:00
Jack Hsu eb678bfa59 docs(misc): push toc to the right side to match the alignment of the left sidebar (#34266)
This PR aligns the TOC to the right side of the page so the spacing is
more balanced.

<img width="2672" height="1527" alt="image"
src="https://github.com/user-attachments/assets/ef00906a-3788-47fb-a71d-230b3d69c201"
/>

Similar to other docs like React:

<img width="2672" height="1527" alt="image"
src="https://github.com/user-attachments/assets/e9a1cd81-f716-4e09-b148-be80a93b7aee"
/>


---

## Other screen widths

1400px:

<img width="1424" height="1025" alt="Screenshot 2026-01-30 at 12 11
57 PM"
src="https://github.com/user-attachments/assets/d9fc5029-4942-4e32-b2f2-4c66ebcb21df"
/>

1000px (TOC hidden):


<img width="1145" height="1019" alt="Screenshot 2026-01-30 at 12 12
10 PM"
src="https://github.com/user-attachments/assets/ce1cd890-193a-42d7-bb4f-3259146845a8"
/>
2026-01-30 12:42:13 -05:00
Jack Hsu dc8839365f docs(misc): reduce memory footprint of nx-dev build (#34258)
We're showing over 8 GB of memory usage on Netlify, and 11+ GB on
Agents. Let's test out a few ways to reduce the memory footprint.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 10:53:21 -05:00
Richard Roncancio 3f05214013 chore(release): Improve release performance (#33866) 2026-01-30 18:15:49 +04:00
Colum Ferry 86de174d86 fix(testing): preload vitest/node to prevent race condition on Node 24 (#34261)
Preload vitest/node ESM module early in
buildViteTargets/buildVitestTargets
functions before parallel processing occurs. This prevents the
ERR_INTERNAL_ASSERTION error that occurs when multiple vitest.config
files
are processed in parallel on Node 24+.

Fixes #34028
Fixes #33091
2026-01-30 13:33:11 +00:00
Jason Jean d9f2ed0d44 fix(testing): add timeout to runCommandUntil to prevent hanging tests (#34148)
## Current Behavior

The `runCommandUntil` e2e utility function waits indefinitely for the
expected output to appear. If the output never appears (e.g., server
fails to start, different output format, port conflict), the test hangs
forever, causing CI jobs to run for hours before being killed.

## Expected Behavior

The function should timeout after a configurable duration and fail with
a clear error message showing what output was received.

## Related Issue(s)

Fixes hanging e2e tests observed in CI (e.g.,
`e2e-node:e2e-ci--src/node-server.test.ts` hung for 1h 21m).

## Changes

- Added optional `timeout` parameter to `runCommandUntil` opts (default:
5 seconds)
- On timeout: kills the process, logs the collected output, and rejects
with a clear error
- Existing call sites work unchanged; tests needing more startup time
can pass `{ timeout: 30000 }`

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: FrozenPandaz <8104246+FrozenPandaz@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2026-01-30 00:18:26 -05:00
Jack Hsu c331bf949c fix(nx-dev): fix internal link check caching and remaining /launch-nx link (#34255)
## Current Behavior

1. The `check-links` task cache inputs only included `sitemap.xml` (the
index
file) and `sitemap-index.xml`, but not the actual `sitemap-0.xml` files
that
contain the URL data. This meant that when pages were added or removed,
the
cache wasn't properly invalidated - the check-links task would return a
   cached "passing" result even when broken links existed.

2. The `/launch-nx` page was removed in #34183 but one link in
`astro-docs/src/content/docs/reference/Nx Cloud/release-notes.mdoc`
still
pointed to it. This link was masked by being in the `validate-links.ts`
   ignore list.

## Expected Behavior

1. The `check-links` task cache is invalidated when sitemap URLs change
by
   using glob patterns (`sitemap*.xml`) to include all sitemap files.

2. All links point to valid pages. The `/launch-nx` link now redirects
to
   `/blog/launch-nx-week-recap`.

## Changes

- **astro-docs/release-notes.mdoc**: Updated `/launch-nx` link to
`/blog/launch-nx-week-recap`
- **astro-docs/validate-links.ts**: Removed `/launch-nx` from ignore
list (no longer needed)
- **nx-dev/project.json**: Fixed cache inputs to use `sitemap*.xml` glob
patterns

## Related Issue(s)

Fixes DOC-385

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:10:47 -05:00
Colum Ferry 3d62c8b5c1 fix(vite): handle sophisticated vite plugins (#34242)
## Current Behavior
With Vite now providing additional options (environments etc) for
framework authors, vite.config files can be much more simple for the
user.
However, this often assumes that the `root` property will be set and
provided during `Vite CLI` invocation.

When we run `resolveConfig` to determine inputs and outputs, we do not
set this `root` and expect the user to have it in their vite config
file.
For some plugins/frameworks such as Tanstack Start - this causes the
plugin to error.

The `isBuildable` conditions is also not inclusive enough and can skip
projects that should be marked as buildable.

## Expected Behavior
Ensure that sophisticated vite plugins are supported with Nx

## Related Issue(s)

CLOSES NXC-3637
2026-01-29 14:28:31 +00:00
Jack Hsu 9c3a9d7e13 feat(core): add Nx Cloud connect URL to template README (#34249)
## Current Behavior
Template-generated workspaces use a generic link in the README instead
of a per-workspace short link for Nx Cloud setup.

## Expected Behavior
When users opt into Nx Cloud (or are auto-connected via variant 2), the
template README is updated with a personalized connect URL section that
helps them finish setting up their workspace.

---
BEFORE: 

<img width="762" height="460" alt="image"
src="https://github.com/user-attachments/assets/58900071-1727-49d1-aa19-279c488b5037"
/>


AFTER: 

<img width="1032" height="599" alt="image"
src="https://github.com/user-attachments/assets/a6e3a122-5807-4ba2-90dd-441e41a3280e"
/>

---

## Related Issue(s)
Closes NXC-3783

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:21:20 -05:00
Drew Teachout e189dcc101 fix(core): do not throw error if worker.stdout is not instanceof socket (#34224)
deno worker.stdout is a Readable/Writeable. To provide better deno
support an error should not be thrown

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
If `worker.stdout` or `worker.stderr` are not instanceof Socket then nx
throws an error. This is problematic in Deno where `stdout` and `stderr`
are Readable/Writable and not Socket.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`startupPluginWorker` function should work in Deno runtime

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

- https://github.com/denoland/deno/issues/31961
- https://github.com/oven-sh/bun/issues/26505

---------

Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
2026-01-29 07:21:09 -05:00
Craigory Coppola 4f4b9dc048 fix(core): improve plugin worker error messages and lifecycle timeouts (#34251)
## Current Behavior
Plugin workers occasionally fall over during the start up steps. 

## Expected Behavior
Improves some issues with the error handling when loading plugin workers
and adds some more logs to help understand what's went wrong here.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2026-01-29 01:57:54 -05:00
Jason Jean fdabc14892 chore(repo): update nx to 22.5.0-beta.2 (#34252)
Updating Nx from 22.5.0-beta.1 to 22.5.0-beta.2

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-29 00:57:04 -05:00
Louie Weng da3b00f961 chore(core): edit project graph aggregate error message (#34248)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Remove redundantly placed period and make error message construction
more readable when facing AggregateError

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes NXC-3766

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-28 22:19:44 +00:00
Jason Jean 8d5b316fdd chore(repo): update nx to 22.5.0-beta.1 (#34234)
Updating Nx from 22.5.0-beta.0 to 22.5.0-beta.1

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-28 16:39:46 -05:00
Jack Hsu b53fd7c7f5 docs(misc): add 1% scroll depth tracking to docs and non-docs pages (#34246)
This PR adds scroll depth event at the 10% level so we can filter out
users who actually engages with the page versus those who maybe land on
homepage just to get to docs.

<img width="2672" height="1527" alt="Screenshot 2026-01-28 at 4 00
54 PM"
src="https://github.com/user-attachments/assets/ad9be5ae-442c-48eb-9c1e-70f0b872563b"
/>


Also fix the scroll tracker for astro-docs.

<img width="2672" height="1527" alt="Screenshot 2026-01-28 at 4 00
54 PM"
src="https://github.com/user-attachments/assets/e4a24ef2-b6aa-4f5a-b10b-972b73385fee"
/>

<img width="2672" height="1527" alt="Screenshot 2026-01-28 at 2 39
09 PM"
src="https://github.com/user-attachments/assets/833c71f1-7a96-4637-bb6e-3b21227053f0"
/>


## Related Issue(s)
Closes CLOUD-4211

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:25:12 -05:00
Louie Weng 5a424fa8df fix(gradle): use tooling api compatible flags (#34247)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

--rerun is not tooling api compatible and therefore will break usage of
the batch executor. Replaced the flag with --rerun-tasks.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-28 21:23:21 +00:00
Jason Jean cf043b7e20 feat(maven): load Maven classes at runtime for version-agnostic batch execution (#34180)
## Current Behavior

The Maven batch runner bundles Maven 4 classes at compile time, which:
- Creates a large JAR file (~50+ MB)
- Only works with Maven 4
- Has classloader conflicts with Maven's own SLF4J

## Expected Behavior

The batch runner loads Maven classes at runtime from `MAVEN_HOME`,
which:
- Creates a small JAR (~2 MB) with no bundled Maven dependencies
- Works with both Maven 3.x and Maven 4.x
- Avoids classloader conflicts by isolating Maven in its own ClassRealm
- Outputs clean Maven-style logs (`[INFO]`, `[WARNING]`, etc.)

## Implementation

### Architecture

```
batch-runner.jar (NO Maven dependencies)
├── MavenClassRealm         → Loads Maven JARs from MAVEN_HOME at runtime
├── ResidentMavenExecutor   → Maven 4 executor (reflection-based)
├── CachingMaven3Invoker    → Maven 3 executor (reflection-based)
└── nx-maven-adapters/      → Pre-compiled adapter JARs (embedded as resources)
    ├── batch-runner-adapters-maven3.jar
    └── batch-runner-adapter-maven4.jar
```

### Key Changes

1. **Removed compile-time Maven dependencies** from batch-runner module
2. **Created batch-runner-adapters** modules for Maven 3 and Maven 4
specific code
3. **Implemented MavenClassRealm** to load Maven JARs from MAVEN_HOME at
runtime
4. **Implemented reflection-based executors** that load adapter JARs
into ClassRealm
5. **Fixed SLF4J logging** with System.out redirection for clean
Maven-style output
6. **Added shared module** for BuildStateManager, BuildStateApplier, and
BuildStateRecorder

### Benefits

- **Version agnostic**: Same JAR works with Maven 3.x and 4.x
- **Graph caching**: Project dependency graph built once, reused across
tasks
- **Build state persistence**: compile → package → install works
correctly
- **No classloader conflicts**: Maven's classes isolated in their own
ClassRealm
- **Clean output**: Standard Maven log format without SLF4J noise

## Related Issue(s)

N/A - Internal refactoring for better Maven version support

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2026-01-28 14:13:31 -05:00
Jack Hsu 7276e4cff7 docs(misc): content negotiation for LLM-friendly docs access (#34239)
## Current Behavior
LLMs and CLI tools must explicitly request the `.md` URL suffix to get
raw markdown content from documentation pages.

## Expected Behavior
When a client requests a docs page with `Accept: text/markdown` header,
the edge function rewrites to serve the `.md` version directly (no
redirect). This enables LLM tools to get markdown content by requesting
the standard URL.

Behavior:
- `Accept: text/markdown` → serves .md content (via rewrite, no
redirect)
- Default (browsers) → serves HTML with Link headers (unchanged)

Examples:
```
curl -H 'Accept: text/markdown' https://deploy-preview-34239--nx-docs.netlify.app/docs/getting-started/intro
curl -H 'Accept: text/markdown' https://deploy-preview-34239--nx-docs.netlify.app/docs/getting-started/tutorials/angular-monorepo-tutorial
```

Uses Netlify Edge Function rewrite (returns URL object) instead of
redirect for single-request response that works with all HTTP clients.

## Related Issue(s)
Closes DOC-389

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 09:06:10 -05:00
Caleb Ukle f9258c9d82 fix(nx-dev): update dead links across nx-dev UI libraries (#34238)
## Current Behavior

broken links

## Expected Behavior

links aren't broken any more and are updated to expected pages from docs
page.

## Related Issue(s)

Fixes DOC-391
2026-01-27 15:51:55 -06:00
Jack Hsu 8b245f1b0a feat(nx-dev): add llms-full.txt and HTTP Link headers for LLM discovery (#34232)
This PR adds:
1. `llms-full.txt` that is a full copy of our docs in markdown.
2. HTTP `Link` headers to our docs HTML pages so that they point to the
`.md` (markdown) version, and also to `llms.txt` and `llms-full.txt`.

The `llms-full.txt` is currently at 2.7 MB, which is much less than
other sites that are up to 5MB or more.

<img width="569" height="35" alt="Screenshot 2026-01-27 at 12 11 10 PM"
src="https://github.com/user-attachments/assets/61be02b4-2813-4c39-951c-d831af83e823"
/>

First 100 lines of `llms-full.txt`:

````
# Nx Documentation

> Complete Nx documentation compiled into a single file for LLM consumption.

Nx is a powerful, open source, technology-agnostic build platform designed to efficiently manage codebases of any scale. From small single projects to large enterprise monorepos, Nx provides intelligent task execution, caching, and CI optimization.

This file was generated from 503 documentation pages.
Individual pages are available at: https://nx.dev/docs/{slug}.md


# Quickstart

---
<!-- source: https://nx.dev/docs/quickstart.md -->
## Quickstart with Nx

Get up and running with Nx in just a few minutes by following these simple steps.

{% steps %}

1. Install the Nx CLI

   Installing Nx globally is **optional** - you can use `npx` to run Nx commands without installing it globally, especially if you're working with Node.js projects.

   {% tabs syncKey="install-method" %}
   {% tabitem label="npm" %}

   ```shell
   npm add --global nx
   ```

   **Note:** You can also use Yarn, pnpm, or Bun

   {% /tabitem %}
   {% tabitem label="Homebrew (macOS, Linux)" %}

   ```shell
   brew install nx
   ```

   {% /tabitem %}
   {% tabitem label="Chocolatey (Windows)" %}

   ```shell
   choco install nx
   ```

   {% /tabitem %}
   {% tabitem label="apt (Ubuntu)" %}

   ```shell
   sudo add-apt-repository ppa:nrwl/nx
   sudo apt update
   sudo apt install nx
   ```

   {% /tabitem %}
   {% /tabs %}

2. Start fresh or add to existing project

   For JavaScript-based projects you can **start with a new workspace** using the following command:

   ```shell
   npx create-nx-workspace@latest
   ```

   **Add to an existing project: (recommended also for non-JS projects)**

   ```shell
   npx nx@latest init
   ```

   **Get the complete experience:**
   For a fully integrated development workflow with AI-powered CI features, [start directly from Nx Cloud](https://cloud.nx.app/get-started).

   Learn more: [Start New Project](/docs/getting-started/start-new-project) • [Add to Existing](/docs/getting-started/start-with-existing-project) • [Complete Nx Experience](https://cloud.nx.app/get-started)

3. Run Your First Commands

   Nx provides powerful task execution with built-in caching. Here are some essential commands:

   **Run a task for a single project:**

   ```shell
   nx build my-app
   nx test my-lib
   ```

   **Run tasks for multiple projects:**

   ```shell
   nx run-many -t build test lint
   ```

   Learn more: [Run Tasks](/docs/features/run-tasks) • [Cache Task Results](/docs/features/cache-task-results)

4. What's next?

   Now that you've experienced the Nx basics, choose how you want to continue:

````


## Related Issue(s)
Closes DOC-236

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-27 16:01:48 -05:00
Benjamin Cabanes a092ed06c4 docs(nx-dev): migrate color variants to contrast design (#34077)
This design refresh emphasizes the contrast variant aesthetic across all
hero sections, pricing cards, and primary call-to-actions.

- Change 47 instances of variant="primary" to variant="contrast"
- Update ui-courses to use variant="secondary" for GitHub link
- Prefer high-contrast inverted style for primary CTAs
- Maintain proper visual hierarchy with secondary actions
- Replace all slate-* classes with zinc-* equivalents (1,158 instances)
- Replace all sky-* classes with blue-* equivalents (210 instances)
- Update opacity variants, gradients, rings, and borders
- Maintain full dark mode compatibility
2026-01-27 20:54:33 +00:00
MaxKless de67da4bc6 chore(repo): add update ai agents configuration for a bunch of ai agents (#34231)
this sets the nx repo up with the latest and greatest
2026-01-27 13:50:42 -05:00
MaxKless f89ccb091f fix(core): hide already-installed nx packages from suggestion list during nx import (#34227)
## Current Behavior
If something is in `package.json#dependencies`, we still suggest it to
be `nx add`-ed during `nx import`

## Expected Behavior
If a plugin is already installed, we don't suggest it anymore
2026-01-27 13:23:42 -05:00
Colum Ferry 2bd8ef3f72 feat(js): bump swc to latest versions (#34215)
## Current Behavior
SWC versions are a few minors behind.

## Expected Behavior
SWC versions are up to date and are being managed via PNPM Catalogs
2026-01-27 17:14:55 +00:00
MaxKless 0e8893faea feat(core): improve configure-ai-agents to copy nx skills/subagents/plugins (#34176)
## Current Behavior
The `configure-ai-agents` command sets up rules files (CLAUDE.md,
AGENTS.md, GEMINI.md) and MCP configurations for AI coding agents, but
doesn't provide extensibility artifacts like commands, skills, or
subagents.
## Expected Behavior
The command now:
- **Adds OpenCode** as a new supported agent with project-level MCP
config
- **Configures Claude plugin** via marketplace settings
(`.claude/settings.json` with `extraKnownMarketplaces`)
- **Copies extensibility artifacts** (commands, skills, subagents) from
`nrwl/nx-ai-agents-config` repo for non-Claude agents
- **Caches the config repo** in
`/tmp/nx-ai-agents-config/<commit-hash>/` with automatic cleanup of old
versions
### Agent Distribution Matrix
| Agent | Rules | MCP Config | Commands | Skills | Subagents | Plugin |
|-------|-------|------------|----------|--------|-----------|--------|
| Claude | CLAUDE.md | .mcp.json | - | - | - | ✓ (marketplace) |
| OpenCode | AGENTS.md | opencode.json | ✓ | ✓ | ✓ | - |
| Copilot | AGENTS.md | Nx Console | ✓ | ✓ | ✓ | - |
| Cursor | AGENTS.md | Nx Console | ✓ | ✓ | - | - |
| Gemini | GEMINI.md | .gemini/settings.json | ✓ | ✓ | - | - |

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: MaxKless <MaxKless@users.noreply.github.com>
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2026-01-27 16:10:28 +00:00
Jason Jean f9ab939c74 chore(repo): update nx to 22.5.0-beta.0 (#34209)
Updating Nx from 22.4.0-beta.5 to 22.5.0-beta.0
2026-01-27 09:52:22 -05:00
Colum Ferry 7a446e4979 fix(web): ensure vitest config file is created (#34216)
`@nx/web:app` generator is incorrectly calling `createOrEditViteConfig`
when bundler != vite and unitTestRunner = vitest.

Ensure it is using the correct file
2026-01-27 09:41:21 +00:00
Jack Hsu 0f33fa6c40 feat(core): add variant 2 to CNW cloud prompts with promo message (#34223)
This PR uses three variants for CNW for prompting for Cloud/platform
connection.

- Variant 0: Shows "Try the full Nx platform?" prompt → platform-setup
completion
- Variant 1: Shows "Would you like remote caching..." prompt →
cache-setup completion
- Variant 2: No prompt → platform-promo completion with "Want faster
builds?"

Both template and custom flows use the same messages and prompts.


### Skip (all) -- No changes


<img width="1392" height="994" alt="cnw_all_skip_completion"
src="https://github.com/user-attachments/assets/1579df01-fc36-4324-bc74-19efc18f78af"
/>

### Variant 0 (full platform)

Template prompt:

<img width="1392" height="994" alt="cnw_template_variant_0_prompt"
src="https://github.com/user-attachments/assets/d02e9ddc-fd25-4f6f-ac61-6f6d518fe338"
/>

Template completion:

<img width="1392" height="994" alt="cnw_template_variant_0_completion"
src="https://github.com/user-attachments/assets/12e459a0-962c-4724-82fa-a4f5a3b6fbd8"
/>

Custom prompt:

<img width="1392" height="994" alt="cnw_custom_variant_0_prompt"
src="https://github.com/user-attachments/assets/8143832a-a85e-43b4-81eb-15074c223476"
/>

Custom completion:

<img width="1392" height="994" alt="cnw_custom_variant_0_completion"
src="https://github.com/user-attachments/assets/036ef6f9-4977-459a-bbd2-502670a12d01"
/>

### Variant 1 (remote cache)

Template prompt:

<img width="1392" height="994" alt="cnw_template_variant_1_prompt"
src="https://github.com/user-attachments/assets/f69b540f-7e48-46ae-99e5-f53657176424"
/>

Template completion:

<img width="1392" height="994" alt="cnw_template_variant_1_completion"
src="https://github.com/user-attachments/assets/04c17847-b0f2-4e37-b7d2-5556aa14f510"
/>

Custom prompt:

<img width="1392" height="994" alt="cnw_custom_variant_1_prompt"
src="https://github.com/user-attachments/assets/abdb38b2-611e-458b-85c0-7b89cd1b827e"
/>


Custom completion:

<img width="1348" height="950" alt="cnw_custom_variant_1_completion"
src="https://github.com/user-attachments/assets/e7d35ddb-e8ac-4ad1-889e-9fff89538900"
/>

## Variant 2 (no prompt)

Template completion:

<img width="1392" height="994" alt="cnw_template_variant_2_completion"
src="https://github.com/user-attachments/assets/07050989-a56c-46eb-a0c3-8730916856ff"
/>

Custom completion:

<img width="1392" height="994" alt="cnw_custom_variant_2_completion"
src="https://github.com/user-attachments/assets/94000828-37b2-4059-a13b-0d36972cfd3e"
/>

## Related Issue(s)

Closes CLOUD-4189

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 16:30:05 -05:00
Jack Hsu e108dac1bb Revert "Revert "feat(core): add A/B testing variant 1 to skip cloud p…rompt in CNW (#34106)" (#34191) (#34204)
This reverts commit f016664557.
2026-01-26 14:58:26 -05:00
Colum Ferry 3fcd2008ef fix(react): remove file-loader dependency and update svgr migration (#34218)
## Current Behavior
The migration for svgr requires using file-loader which is unmaintained.

## Expected Behavior
Use asset/resource instead of file-loader

## Related Issue(s)

CLOSES NXC-3667
2026-01-26 16:56:18 +00:00
Jason Jean 75f36edb8f fix(core): fall back to node_modules when tmp has noexec (#34207)
## Summary

- When `/tmp` is mounted with `noexec`, loading native modules from the
cache fails silently and causes Nx to hang indefinitely
- This adds a fallback to load from `node_modules` when permission
errors occur

## Problem

Users with `/tmp` mounted with `noexec` (a common security hardening
practice) experience Nx hanging forever, even for simple commands like
`nx --version`.

The root cause:
1. Nx copies native `.node` files to `/tmp` to avoid Windows file
locking issues
2. On `noexec` mounts, execution fails with `EACCES`/`EPERM`
3. The error wasn't caught, leading to broken native bindings and
infinite loops

## Solution

Catch permission errors when loading from the cache and fall back to the
original `node_modules` location. This:
- Works automatically without user config
- Preserves Windows file locking fix (only falls back when needed)
- No error messages for users

Closes #33991
2026-01-23 17:32:15 -05:00
Miguel 3672e1a3ea fix(devkit): allow null values in JSON schema validation (#34167)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Schema validation (done, for instance, when calling an executor) fails
when an option has value "null" and schema accepts null values. I had it
in a custom executor for `nx-release-publish`, that understands that
`nxReleaseVersionData` is implicitly passed, so I define its schema:
```json
"newVersion": {
  "type": ["string", "null"],
  "description": "The new version of the project, null if no changes detected"
}
```

My code calls `getReleaseClient().releaseVersion(options)`, which gets
me a `projectsVersionData` object with version info. It contains `null`
values (allowed). I then pass it, and ends up in:
```typescript
 // nx/src/tasks-runner/task-orchestrator.ts:531-539                                                                                                                                                                      
  const combinedOptions = combineOptionsForExecutor(                                                                                                                                                                       
      task.overrides,  // ← Contains nxReleaseVersionData with null values                                                                                                                                                 
      task.target.configuration,                                                                                                                                                                                           
      targetConfiguration,                                                                                                                                                                                                 
      schema,           // ← Schema from executor                                                                                                                                                                          
      task.target.project,                                                                                                                                                                                                 
      relativeCwd,                                                                                                                                                                                                         
      isVerbose                                                                                                                                                                                                            
  );
```

which fails inside:
```typescript
 // nx/src/utils/params.js:126-201                                                                                                                                                                                        
  function validateObject(opts, schema, definitions) {                                                                                                                                                                     
      // Line 191-200: Iterate through all properties                                                                                                                                                                      
      Object.keys(opts).forEach((p) => {                                                                                                                                                                                   
          validateProperty(                                                                                                                                                                                                
              p,                              // "nxReleaseVersionData"                                                                                                                                                    
              opts[p],                        // { foo: { newVersion: null, ... }}                                                                                                                                         
              (schema.properties ?? {})[p],   // schema for nxReleaseVersionData                                                                                                                                           
              definitions                                                                                                                                                                                                  
          );                                                                                                                                                                                                               
      });                                                                                                                                                                                                                  
  }
  ```

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR -->

`null` values should be considered, as they are valid in JSON schemas. It was probably not considered, because we never think that `typeof null === "object"`, but it's unfortunately the case.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is merged. -->

I will create one

Fixes https://github.com/nrwl/nx/issues/34169
2026-01-23 15:09:09 -05:00
Jack Hsu bc9b3229c6 feat(js): add NX_PREFER_NODE_STRIP_TYPES to use Node's strip types feature instead of transpilation for TypeScript files (#34202)
Transpiling through SWC or ts-node is slow compared to the native type
stripping that Node.js provides.

This PR adds `NX_PREFER_NODE_STRIP_TYPES` to allow users to use Node.js
built-in TypeScript support. There are some features that need
transpilation that won't work with type stripping:

- Enum declarations
- namespace with runtime code
- legacy module with runtime code
- parameter properties
- path aliases

See: https://nodejs.org/api/typescript.html#full-typescript-support

The speed-up is significant. My test workspace went from 22s to ~2s to
compute from cold cache.

Demo: https://www.loom.com/share/ce1db29e501b46d58109ffeec8a7a649

In the future we should enable this by default, and users have to turn
it off to use SWC/ts-node.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2026-01-23 14:13:00 -05:00
Leosvel Pérez Espinosa a15881db1a feat(core): display batch tasks in the tui (#33695)
Adds support for Batch tasks and displays them in the TUI.

---------

Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2026-01-23 13:48:04 -05:00
Jack Hsu 1dd4262336 docs(misc): collect usage data on .md and .txt files (#34203)
Right now GA only collects page views. This PR allow us to see which
`.md` files are being used. There are mostly useful for AI agents to
fetch without using too many tokens. We want to track usage so we can
see what techniques to guide agents actually work.

## Related Issue(s)
Closes DOC-386

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:38:17 -05:00
Jack Hsu 687357c82e fix(core): cloud commands are noop when not connected rather than errors (#34193)
This PR makes it so Cloud commands like `npx nx record` and `npx nx
fix-ci` still work without `nxCloudId`. We'll log a warning so that
`ci.yml` using these commands will still work. The warning let's users
know that these do not work without being connected.

Closes #NXC-3753
2026-01-23 12:29:41 -05:00
Mark Lindsey 3d1e544812 chore(repo): commit lint mention that commits should be lowercase (#34199)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Commit linting does not mention requirement for commit message to be
lowercase.
<!-- This is the behavior we have today -->

## Expected Behavior
Hook message should instruct user to use all lowercase for commit
message.
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-23 11:19:42 -05:00
Jack Hsu 9bb69383b8 fix(core): consolidate GitHub URL messaging when gh push fails (#34196)
When `gh repo create` fails, users see two redundant messages. This
consolidates them into a single message with the helpful `?name=...`
parameter in the GitHub URL.

BEFORE: (We show `Could not push. Push repo to complete setup.` and then
`Push your repo (https://github.com/new)...` again at the end)

<img width="1209" height="560" alt="image"
src="https://github.com/user-attachments/assets/e22c012c-8e0f-4ff9-a6c2-de8267b69b5d"
/>

AFTER: (Only show `Could not push` as an info log, and then complete
setup is shown only once at the end)

<img width="1250" height="591" alt="image"
src="https://github.com/user-attachments/assets/3dc075c7-4418-4373-a07a-1b95f71b3b87"
/>

Closes NXC-3754

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 11:18:23 -05:00
Jonathan Cammisuli 1831ace87e docs(nx-dev): update docs to include SELF_HEALING.md information (#34200) 2026-01-23 15:12:03 +00:00
Mark Lindsey 478afc7046 docs(nx-dev): add bitbucket to self healing docs (#34198)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Self-healing docs only reference being supported for GitHub, Azure, and
GitLab.
<!-- This is the behavior we have today -->

## Expected Behavior
We should show instructions for all currently supported vcs providers,
including Bitbucket.
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-23 14:48:04 +00:00
JamesHenry 1299d044eb chore(repo): remove --auto-apply-fixes, it is set in Nx Cloud UI 2026-01-23 15:41:24 +04:00
Craigory Coppola 273a474047 fix(core): handle resizing a bit better for inline_tui (#34006)
## Current Behavior
Resizing the TUI while in inline view kinda breaks things. Its
unfortunate, I'm not sure there's a ton to be done, but this PR explores
some solutions

## Expected Behavior
The TUI is less sensitive to resize events with inline mode

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-22 18:54:56 -05:00
Jason Jean f016664557 Revert "feat(core): add A/B testing variant 1 to skip cloud prompt in CNW (#34106)" (#34191)
## Current Behavior

The create-nx-workspace (CNW) command includes A/B testing variant 1
which skips the cloud prompt under certain conditions.

## Expected Behavior

Revert to the previous behavior where the cloud prompt flow is
consistent without the A/B testing variant.

## Related Issue(s)

This reverts commit 2039a5e119 from PR
#34106.
2026-01-22 16:14:21 -05:00
Jason Jean 81bb7d3d17 fix(nx-dev): update broken /launch-nx links (#34192)
## Current Behavior

The internal link checker reports 3 broken links pointing to
`/launch-nx`:
- `/blog/2024-02-05-nx-18-project-crystal.md`
- `/blog/2024-02-15-launch-week-recap.md`
- `/changelog/18_0_0.md`

The `/launch-nx` page was a temporary page for the Nx 18 launch event in
February 2024 and no longer exists.

## Expected Behavior

All internal links should point to valid pages. Links to the old launch
page now redirect to the Launch Nx Week recap blog post.

## Related Issue(s)

Fixes the internal link checker errors.
2026-01-22 21:14:01 +00:00
Craigory Coppola 587659cb03 fix(core): move tui to parking lot rwlock to avoid hang (#34187)
## Current Behavior
There's a hard to reproduce hang that happens occasionally when running
the TUI

## Expected Behavior
We think this should fix it

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-22 15:49:58 -05:00
Benjamin Cabanes 05de3ff450 docs(nx-dev): remove Nx Conf and Advent of Code pages (#34183)
Removed Nx Conf and Advent of Code pages, associated UI components, and
references from the configuration files. Simplified package structure by
removing `@nx/nx-dev-ui-conference` package.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: bcabanes <bcabanes@users.noreply.github.com>
2026-01-22 12:10:12 -05:00
Jack Hsu 8fee466a1f chore(misc): remove banner.json files and add to gitignore (#34185)
The `banner.json` was committed as a fallback if we're not using Framer
to control the banner yet on nx.dev. Now that it is verified we can
remove the committed file.

Closes DOC-381

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 11:26:10 -05:00
MaxKless d6572f3de4 fix(core): clean up daemon workspace data directory on nx reset --onl… (#34174)
Previously, `nx reset --onlyDaemon` would only stop the daemon process
but not clean up the daemon files in `.nx/workspace-data/d`. This change
ensures the daemon workspace data directory is also removed when using
the `--onlyDaemon` flag, consistent with the behavior of a full reset.

Co-authored-by: MaxKless <MaxKless@users.noreply.github.com>
2026-01-22 16:29:08 +09:00
Jack Hsu 367986dea1 docs(core): update version on releases reference page (#34178)
This PR updates the releases page so v22 is included.

Closes #DOC-382

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-21 15:58:00 -05:00
Caleb Ukle 6ae0fd1217 docs(nx-dev): make sure cli nested sub commands are parsed (#34179)
commands like nx release and nx show were missing sub commands. make
sure they are now correctly parsed.

<img width="224" height="162" alt="image"
src="https://github.com/user-attachments/assets/f51c12f2-9926-44a1-a3c0-57de565434bd"
/>


also, fixed the "getting help" for plugin docs being rendered
incorrectly. and add double dash `--` to the plugin option docs to match
rest of docs.


<img width="874" height="634" alt="image"
src="https://github.com/user-attachments/assets/be7a58a3-0ea0-41d5-8ba6-98cfa0210a95"
/>
2026-01-21 20:26:30 +00:00
Jason Jean 1b12e1fc6f fix(core): improve TUI task selection and pane focus behavior (#34175)
## Current Behavior

1. When running a task with dependencies (e.g., `nx serve app` where app
depends on app2:serve), the initiating task might not be selected on
startup. Additionally, the auto-select logic could switch selection to
the initiating task at any time when it started running - even minutes
later - which felt "random" to the user.

2. When pressing Enter on an already-pinned task, it would unpin the
task, causing the pane to disappear while focus remained on it
(invisible-but-focused state).

## Expected Behavior

1. The initiating task (the one the user actually requested) should be
selected during init, and selection should never unexpectedly change
later when tasks start.

2. Pressing Enter on an already-pinned task should focus the pane, not
unpin it.

## Changes

- **Select initiating task during init**: Moved initiating task
selection to `init()` in app.rs. This only applies in `RunOne` mode
since in `RunMany` there's no single initiating task to prioritize.
Removed the "switch to initiating task" logic from `start_tasks()` in
tasks_list.rs.
- **Focus pane on Enter**: Changed behavior so pressing Enter on an
already-pinned task focuses the pane instead of unpinning it.

## Related Issue(s)

N/A - discovered during TUI testing
2026-01-21 14:02:43 -05:00
Jason Jean fc8072930a chore(repo): update nx to 22.4.0-beta.5 (#34162)
Updating Nx from 22.4.0-beta.4 to 22.4.0-beta.5
2026-01-21 13:04:47 -05:00
Juri b6ed6cbca8 docs(nx-dev): blog post about vertical and horizontal continuity with agents 2026-01-21 17:00:54 +01:00
Tomas Ptacek 162fca17c4 fix(module-federation): dev server handler accumulation (#34152)
# Current Behavior
The `beforeCompile` hook is registered inside the `watchRun` hook,
causing a new handler to be added on every recompilation. This leads to
handler accumulation, where setup operations (building static remotes,
starting file server, starting proxies) are triggered multiple times
during watch mode.

# Expected Behavior
Hooks should be registered once, outside of other hooks, to prevent
accumulation. Setup operations should only run once, not on every
recompilation.

# Related Issue(s)
Fixes https://github.com/nrwl/nx/issues/34141
2026-01-21 15:09:39 +00:00
James Henry e57848cea7 chore(repo): update self-healing ci docs (#34126)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: JamesHenry <JamesHenry@users.noreply.github.com>
2026-01-21 08:17:16 -05:00
Tomas Ptacek 5f51a4b268 fix(angular-rspack): stats serialization and configuration (#34155)
# Current Behavior
1. **Performance bottleneck**: `statsValue.toJson()` is called with no
options, causing full serialization of all stats data on every build.
This is expensive and unnecessary when only budget checking is needed.
2. **Redundant work**: Budget checking code runs even when no budgets
are configured or when targeting server platform.
3. **User stats config ignored**: Custom stats configuration provided
via `rspackConfigOverrides` is not respected by the stats logger.
4. **Double serialization**: `rspackStatsLogger` calls `stats.toJson()`
without passing the stats options, ignoring user preferences.

# Expected Behavior
1. Only serialize what's needed for budget checking (`assets` and
`chunks`), significantly reducing overhead.
2. Early exit when budgets are not configured or on server platform,
skipping expensive `toJson()` entirely.
3. User's stats configuration is merged with defaults and respected
throughout the build output.
4. `rspackStatsLogger` uses the provided `statOptions` when serializing
stats.

# Related Issue(s)
Fixes https://github.com/nrwl/nx/issues/34145
2026-01-21 09:31:55 +00:00
Jack Hsu 2039a5e119 feat(core): add A/B testing variant 1 to skip cloud prompt in CNW (#34106)
## Current Behavior
CNW always shows the "Try the full Nx platform?" prompt and connects to
Nx Cloud to generate an onboarding URL with a token.

## Expected Behavior
For A/B testing variant 1:
- Skip cloud prompt
- Skip connectToNxCloudForTemplate() - no nxCloudId in nx.json
- Skip readNxCloudToken() - no misleading spinner
- Use GitHub flow for URL generation (accessToken: null)
- Show github.com/new hint when user hasn't pushed

Also fixes:
- Expired cache file bug: now deletes with unlinkSync() instead of
ignoring, which caused 50-50 randomization after 1-week expiry
- Adds variant-X to short URL meta property for cloud analytics

## Related Issue(s)
Closes NXC-3628

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 16:44:00 -05:00
Jason Jean 411e2e2453 chore(repo): update nx to 22.4.0-beta.4 (#34138)
Updating Nx from 22.4.0-beta.3 to 22.4.0-beta.4
2026-01-20 16:41:29 -05:00
Craigory Coppola f4bb7d734f chore(repo): remove .deb file from accidental commit and update gitignore (#34161)
removes accidentally committed file
2026-01-20 16:37:48 -05:00
Jason Jean e586896470 fix(core): prioritize nx installation path in getNxRequirePaths (#34158)
## Current Behavior

`getNxRequirePaths` returns paths in the order `[root,
getNxInstallationPath(root)]`, which means the workspace root is checked
first when resolving modules.

## Expected Behavior

The nx installation path (`.nx/installation`) should be prioritized and
checked first before falling back to the workspace root. This ensures
that modules from the nx installation directory take precedence.

## Related Issue(s)

N/A
2026-01-20 18:54:08 +00:00
Tomas Ptacek d2335186ac feat(angular-rspack): add tailwind and postcss config to component stylesheet bundler (#34153)
# Current Behavior
The Angular Rspack compiler's `ComponentStylesheetBundler` does not
receive Tailwind or PostCSS configuration. This means Tailwind
directives (like `@apply`, `@tailwind`) in component stylesheets are not
processed, resulting in broken styles.

# Expected Behavior
Component stylesheets should support Tailwind CSS and PostCSS
configurations, matching the behavior of the standard Angular CLI build
process.

# Related Issue(s)
https://github.com/nrwl/nx/issues/34098
2026-01-20 15:15:39 +00:00
Tomas Ptacek 2d7e24ce68 fix(angular-rspack): handler accumulation and watchOptions for double rebuilds (#34154)
# Current Behavior
1. **Handler accumulation**: The `compilation`, `beforeCompile`, and
`done` hooks are registered inside `watchRun`, causing new handlers to
be added on every rebuild cycle. This leads to performance degradation
and duplicate operations during watch mode.
2. **Double rebuilds**: Rapid filesystem events (e.g., editor
backup/swap files) trigger multiple rebuilds because there's no
aggregation timeout configured.
3. **No watchOptions configuration**: Users cannot customize watcher
behavior (aggregateTimeout, ignored patterns, etc.).

# Expected Behavior
1. Hooks should be registered once outside of `watchRun` to prevent
accumulation. Shared state is used to pass data between watch cycles and
compilation hooks.
2. A default `aggregateTimeout: 50` batches rapid filesystem events to
prevent double rebuilds.
3. Users can provide custom `watchOptions` to configure watcher
behavior, with user options taking precedence over defaults.

# Related Issue(s)
https://github.com/nrwl/nx/issues/34142#issuecomment-3767571208
2026-01-20 14:22:07 +00:00
Leosvel Pérez Espinosa 6bb82c0c2e fix(core): establish cpu baseline when possible to improve measurement accuracy (#34120)
## Current Behavior

New task processes show 0% CPU on their first measurement because no
baseline exists. Accurate readings only appear on the second collection
cycle (~1s later).

## Expected Behavior

New task processes get accurate CPU readings on their first measurement.
The collector establishes CPU baselines for newly registered processes
~250ms before collection, giving `sysinfo` enough time to calculate
accurate CPU deltas.

## Technical Details: Baselining & Collection Flow

The collection loop runs in 4 phases:

```
 T=0ms      T=750ms      T=1000ms    T=1750ms     T=2000ms  
   |           |             |           |            |
   v           v             v           v            v
Collect → Sleep(750ms) → Baseline → Sleep(250ms) → Collect → ...
```

1. **Collect**: Refresh all processes and gather metrics
2. **Post-collection sleep**: Wait until baseline time (interval -
250ms)
3. **Baseline**: Bulk CPU refresh for newly registered PIDs (if any)
4. **Pre-collection sleep**: Wait 250ms for accurate CPU delta
calculation
2026-01-19 11:53:07 -05:00
Craigory Coppola 0137ea2dc9 fix(core): avoid panic when inline tui can't init (#34135)
## Current Behavior
if inline tui init fails, we panic

## Expected Behavior
If inline tui init fails, inline mode is disabled. We show the reason
its disabled when someone tries to use it.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-17 23:38:00 -05:00
Jason Jean 6754cde03a fix(core): drain stdin on exit to prevent escape sequence leakage (#34134)
## Current Behavior

When exiting the TUI (especially via Ctrl+C), escape sequences leak to
the terminal:
```
^[]11;rgb:2121/2121/2121^[\^[[55;1R^[[?62;22;52c
```

This happens because the TUI queries terminal background color via OSC
11 to detect dark/light mode. The terminal responds with an escape
sequence, but if the program exits before fully consuming the response,
it appears in the terminal output.

## Expected Behavior

Clean terminal state after TUI exits, with no escape sequence artifacts.

## Related Issue(s)

N/A - discovered during development

## Solution

Added `drain_stdin()` function that polls and consumes any pending
terminal events before disabling raw mode. This clears any lingering OSC
responses (like the background color query response) before the terminal
is restored.

```rust
fn drain_stdin() {
    use std::time::Duration;
    while crossterm::event::poll(Duration::from_millis(5)).unwrap_or(false) {
        let _ = crossterm::event::read();
    }
}
```

The 5ms timeout is long enough to catch pending responses but short
enough not to noticeably delay exit.
2026-01-17 16:30:38 +00:00
Jason Jean 4202f2c760 fix(core): prevent task hashing when project graph has errors (#34116)
## Current Behavior

When the daemon encounters a project graph error during task hashing, it
extracts the partial project graph from the error and continues hashing
tasks. This can produce incorrect hashes since the graph is incomplete.

## Expected Behavior

The error should be thrown immediately, preventing any hashing attempts
with an invalid project graph. This ensures we don't produce incorrect
task hashes that could lead to cache issues.

## Related Issue(s)

N/A - Bug fix discovered during development
2026-01-16 18:30:35 -05:00
Philip Fulcher 323554b335 docs(nx-dev): fix metric number in header image for article (#34131) 2026-01-16 19:54:46 +00:00
Philip Fulcher 643a6be8be docs(nx-dev): add caseware success story article (#34127) 2026-01-16 14:31:26 -05:00
Colum Ferry 6092966ce4 feat(core): add PLUGIN.md files to testing-tools (#34125)
Add PLUGIN.md files to test related plugins

Closes NXA-789
2026-01-16 18:40:10 +00:00
Jason Jean 25442271ab chore(repo): update nx to 22.4.0-beta.3 (#34108)
Updating Nx from 22.4.0-beta.1 to 22.4.0-beta.3

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-16 09:28:53 -05:00
Colum Ferry e343bd27d8 feat(bundling): replace rollup-plugin-postcss with inlined version (#34110)
## Current Behavior
The `rollup-plugin-postcss` has not released a new version in 4 years.
The deps it depends on are outdated and starting to cause problems with
peer-dep conflicts.

## Expected Behavior
Recreate the plugin within the `@nx/rollup` package to maintain the
functionality/behaviour and manage dependencies ourselves.

## Related Issue(s)

Closes NXC-3644

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2026-01-16 13:14:42 +00:00
Leosvel Pérez Espinosa 07a68baab9 fix(vitest): prevent config double-merge causing array duplication (#34113)
## Current Behavior

Running `nx test` with Vitest browser mode fails with error:

> "The browser configuration must have a 'name' property"

Array configs like `browser.instances` and `reporters` get duplicated,
breaking tests.

## Expected Behavior

Vitest browser mode and array configurations work correctly without
duplication.

## Related Issue(s)

Fixes #33591
2026-01-16 09:51:03 +00:00
Leosvel Pérez Espinosa 7e12359221 feat(angular): add support for angular v21.1 (#34057)
## Current Behavior

Angular v21.1 is not supported.

## Expected Behavior

Angular v21.1 should be supported.
2026-01-15 15:05:50 -05:00
Nicolas Beaussart 21d1555d78 feat(core): add OpenCode AI agent detection (#34072)
## Current Behavior

Nx's AI agent detection currently identifies Claude Code, Repl.it, and
Cursor AI agents via environment variables, but does not detect
OpenCode.

## Expected Behavior

Nx should also detect when running under OpenCode AI agent by checking
for the `OPENCODE` environment variable, which OpenCode sets to `1` when
active.

## Related Issue(s)

N/A - Feature addition to improve AI agent detection coverage.

## Changes

- Added `is_opencode_ai()` function in
`packages/nx/src/native/utils/ai.rs`
- Updated `is_ai_agent()` to include OpenCode detection
- Added corresponding unit tests
2026-01-15 11:28:23 -05:00
MaxKless 1b12b392b7 fix(core): only run nx console background check if daemon is active (#33917) 2026-01-16 00:15:26 +09:00
MaxKless fe0757c981 chore(repo): update agents.md and claude.md (#34112) 2026-01-16 00:14:41 +09:00
Steven Nance 88098cc5f7 fix(core): ensure consistent yarn optional dependency hashing (#34104)
## Current Behavior

For optional packages that are not installed when using yarn, we
currently add the package version to the key for the hash. NPM and PNPM
do not do this.

The results in inconsistent hashes for package dependencies when running
in different environments. For example, trying to use the cache created
in CI on linux on a mac where native dependencies are used.

**yarn on arm mac**

_note how the key has the version in it for the linux and x64 versions
that are not installed_
```
$ nx test foo | grep @nx/nx-
...
        "npm:@nx/nx-darwin-x64@22.3.3": "14042642002999097748",
        "npm:@nx/nx-linux-x64-gnu@22.3.3": "12169496858981304476",
        "npm:@nx/nx-darwin-arm64": "1683411334940043113", 
```

**npm on arm mac**

```
$ nx test foo | grep @nx/nx-
...
        "npm:@nx/nx-darwin-x64": "14042642002999097748",
        "npm:@nx/nx-darwin-arm64": "1683411334940043113",
"9980946580833020728",
        "npm:@nx/nx-linux-x64-gnu": "12169496858981304476",
```


**pnpm on arm mac**
```
$ nx test foo | grep @nx/nx-
...
        "npm:@nx/nx-darwin-arm64": "1683411334940043113",
        "npm:@nx/nx-darwin-x64": "14042642002999097748",
        "npm:@nx/nx-linux-x64-gnu": "12169496858981304476",
```


## Expected Behavior

Optional dependencies should be handled the same way from a hashing
perspective as installed dependencies.

**yarn on arm mac**

```
$ nx test foo | grep @nx/nx-
...
        "npm:@nx/nx-darwin-x64": "14042642002999097748",
        "npm:@nx/nx-linux-x64-gnu": "12169496858981304476",
        "npm:@nx/nx-darwin-arm64": "1683411334940043113", 
```
2026-01-15 10:06:12 +01:00
Philip Fulcher acb4d3cb3d docs(nx-dev): changed pinned posts (#34109) 2026-01-14 19:35:38 -06:00
Miroslav Jonaš 95300a20cc fix(core): improve buildExplicitTypeScriptDependnecies performance (#33963)
On test repo reduces the
`nx/js/dependencies-and-lockfile:createDependencies`:
- from `10506ms`
- to `3665ms`

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-14 22:10:33 +01:00
Leosvel Pérez Espinosa 45f2ae303a fix(core): upgrade sysinfo to 0.37.2 and fix cpu measurement accuracy (#34101)
## Current Behavior

CPU metrics collection can report inaccurate values where:

- Individual processes show inflated CPU usage
- Total CPU aggregation across all processes exceeds the system's
maximum available CPU
- This leads to confusing and misleading metrics data  

## Expected Behavior

CPU metrics accurately reflect actual resource usage:

- Process CPU values are accurate
- Total CPU aggregation stays within system limits
- Metrics data is reliable and trustworthy

### Additional Notes

- **Root cause**: When registering a new process, we established a CPU
baseline by refreshing only that single process via `sysinfo`.
Internally, `sysinfo` calculates CPU% as `(process_cpu_time_delta /
wall_time_delta) * 100`. Refreshing a single process updates the wall
time reference but leaves the CPU time baselines of other processes
unchanged. In the next metrics collection, these other processes appear
to have consumed their CPU time over a shorter wall time period (based
on the last baseline), resulting in inflated percentages (e.g., 200%+
for single-threaded processes).
- This PR also improves initialization performance by only loading
necessary system data (processes, CPU, memory) instead of all system
information
- Upgrades `sysinfo` dependency to v0.37.2, which includes upstream CPU
measurement improvements.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-14 19:40:22 +01:00
Jack Hsu 4816c5514a feat(nx-dev): add scroll depth tracking for marketing pages (#34105)
## Current Behavior

Marketing pages (homepage, /react, /java, etc.) do not track scroll
depth. Only docs pages have scroll tracking via the ScrollableContent
component.

## Expected Behavior

Marketing pages now track scroll depth and fire scroll_0, scroll_25,
scroll_50, scroll_75, scroll_90 events to Google Analytics, matching the
existing docs page behavior.

## Related Issue(s)
Closes DOC-376

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:36:12 -05:00
Colum Ferry 42b1f144da fix(misc): deprecate setup-tailwind generators (#34097)
The setup-tailwind generators are deprecated as generating Tailwind
configuration is no longer maintained. This adds deprecation metadata
to generators.json and runtime warnings when the generators are invoked.

Affected packages: @nx/angular, @nx/react, @nx/next, @nx/remix, @nx/vue

These generators will be removed in Nx 23.

For adding Tailwind support, people can follow the official Tailwind
guides. We also
- updated our
[angular](https://nx.dev/docs/technologies/angular/guides/using-tailwind-css-with-angular-projects)
and
[react](https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react)
docs and have a [blog
post](https://nx.dev/blog/setup-tailwind-4-angular-nx-workspace) about
it with more info.

Closes NXC-3714
2026-01-14 16:52:27 +00:00
Craigory Coppola d6b01597e4 fix(core): only init inline view if able to run (#34094)
## Current Behavior
The inline tui runs some terminal escape codes to check cursor position,
these break when stdin isn't a tty (like in a git hook)

## Expected Behavior
The inline tui is disabled if stdin isn't a tty

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-14 11:26:13 -05:00
Jason Jean 60e0fcde01 fix(maven): include migrations.json in published package (#34086)
## Current Behavior

The `migrations.json` file in the `@nx/maven` package is not included in
the `files` array in `package.json`. This means when the package is
published to npm, the migrations file is not included, preventing users
from running migrations.

## Expected Behavior

The `migrations.json` file should be included in the published package
so that Nx can discover and run migrations when users upgrade.

## Related Issue(s)

N/A - discovered during development
2026-01-14 10:20:02 -05:00
Leosvel Pérez Espinosa e1bb85254c chore(core): exclude handwritten files from native build outputs (#34099)
Exclude some handwritten files from the native build outputs. When those
files are updated in isolation, the build can replace them with stale
cached outputs. This is because they are not inputs of the native
builds, but are incorrectly stored as outputs of the native builds.
2026-01-14 10:08:36 -05:00
Colum Ferry 85deb8bc66 chore(core): update minimatch to latest version (#34063)
Update Minimatch to v10

Closes NXC-3661
2026-01-14 10:02:52 -05:00
Colum Ferry 574d841837 chore(core): update to latest version of tsquery (#34067)
Update to latest version of TSQuery (v6).

Closes NXC-3660

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-14 09:08:40 -05:00
Juri 6bf261d9d0 docs(react): update the Tailwind v4 guide 2026-01-14 10:00:48 +01:00
Juri 0777cb87cf docs(angular): update the Tailwind v4 guide 2026-01-14 10:00:48 +01:00
Juri 6cde9c075e docs(nx-dev): using Angular with Tailwind v4 in a Nx monorepo 2026-01-14 10:00:48 +01:00
Jack Hsu f23d48512e docs(misc): update footer with proper year (#34093)
This PR updates the `2025` in footer component to always be the current
year during build.

<img width="474" height="186" alt="image"
src="https://github.com/user-attachments/assets/a177d57d-e58a-411d-9002-9073b16ec007"
/>
2026-01-13 22:44:40 +00:00
Jack Hsu 246d4fd636 docs(misc): remove banner.enabled check since we only use banner.activeUntil (#34091)
This PR removes the `enabled` check for webinar banner since we don't
have the prop in Framer CMS.

## Local verification using
https://ready-knowledge-238309.framer.app/api/banners

Pages router:
<img width="2670" height="1527" alt="image"
src="https://github.com/user-attachments/assets/b7dfb6c1-6c2a-4f73-8efa-64a66d61ef0c"
/>

App router (blog):

<img width="2670" height="1527" alt="image"
src="https://github.com/user-attachments/assets/6df2bd12-06d4-4d22-bc45-3c772067b6fa"
/>
2026-01-13 13:05:10 -05:00
Leosvel Pérez Espinosa 0bb9d67f0b fix(core): prevent alias from overwriting root deps in pnpm parser (#34064)
## Current Behavior

When using pnpm aliases, the project graph may miss the actual
dependency node (the aliased package overwrites it), resulting in
incomplete or confusing dependency graphs.

## Expected Behavior

The project graph should include both the alias and the actual
dependency node, matching the behavior of other package managers.
2026-01-13 17:25:12 +01:00
Craigory Coppola df99ad50c7 fix(core): show daemon status in nx report output (#34009)
## Current Behavior
No daemon info is provided in `nx report`, but some issues are
exasperated by the daemon or may only show if the daemon is disabled.
This is useful context that we currently lack.

## Expected Behavior
`nx report` includes if the daemon is available, enabled but not
started, or disabled.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-13 10:10:58 -05:00
Copilot 6be0a7eb56 feat(core): allow nx show project to infer project from cwd (#33661)
## Current Behavior

Running `nx show project` without specifying a project name fails, even
when inside a project directory:

```bash
cd packages/my-lib
nx show project
# Error: requires projectName argument
```

## Expected Behavior

When run from within a project directory, `nx show project` infers the
project from the current working directory:

```bash
cd packages/my-lib
nx show project        # Shows my-lib configuration and targets
nx show project --json # Outputs JSON for my-lib
```

Explicit project name still works:
```bash
nx show project other-project
```

If cwd is not within any project, shows a helpful error with usage
instructions.

### Changes
- `command-object.ts`: Make `projectName` positional arg optional
(`[projectName]`)
- `project.ts`: Infer project from cwd using `findProjectForPath` when
no project specified
- `project.spec.ts`: Add unit tests for cwd inference, nested
directories, root projects, and error cases

## Related Issue(s)

Fixes #31055

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `repo.gradle.org`
> - Triggering command: `/usr/lib/jvm/temurin-17-jdk-amd64/bin/java
/usr/lib/jvm/temurin-17-jdk-amd64/bin/java
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED
--add-opens=java.base/java.nio.charset=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED
-XX:MaxMetaspaceSize=384m -XX:&#43;HeapDumpOnOutOfMemoryError -Xms256m
-Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en` (dns
block)
> - `staging.nx.app`
> - Triggering command: `/usr/local/bin/node node ./bin/post-install`
(dns block)
> - Triggering command: `/usr/local/bin/node /usr/local/bin/node
/home/REDACTED/work/nx/nx/node_modules/.pnpm/nx@22.2.0-beta.1_@swc-node&#43;register@1.9.1_@swc&#43;core@1.5.7_@swc&#43;helpers@0.5.11__@swc&#43;typ_e0638a3d25d549ce0cdd3a7d8bad3b61/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker
/tmp/plugin3517-16-424.353971.sock @nx/enterprise-cloud` (dns block)
> - Triggering command: `/usr/local/bin/node /usr/local/bin/node
/home/REDACTED/work/nx/nx/node_modules/.pnpm/nx@22.2.0-beta.1_@swc-node&#43;register@1.9.1_@swc&#43;core@1.5.7_@swc&#43;helpers@0.5.11__@swc&#43;typ_e0638a3d25d549ce0cdd3a7d8bad3b61/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker
/tmp/plugin4274-16-431.526748.sock @nx/enterprise-cloud` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/nrwl/nx/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Feature: allow `nx show targets` to infer project from
the cwd</issue_title>
> <issue_description>### Description
> When I'm already working inside a project's folder (for example
`github/abapify/packages/adk` that has its own `project.json`), I would
love to ask Nx to list the targets that belong to that project without
having to remember or type the project name. Ideally `npx nx show
targets` could detect the `project.json` in the current working
directory and operate on that project automatically.
> 
> ### Current behavior
> Running the command from inside a project directory fails because the
CLI insists on a `--project` argument:
> 
> ```
> $ cd github/abapify/packages/adk
> $ npx nx show targets
> Please provide a project name via --project=<name>
> ```
> 
> ### Expected behavior
> If the current directory (or one of its ancestors) contains a
`project.json`, Nx should infer the project from that file and list the
targets without extra flags. This would make it much easier to explore
available targets while staying focused on a single project, especially
in large workspaces with many similarly named packages.
> 
> ### Environment
> - Nx: 21.6.3
> - Node: 24.10.0
> - Package manager: bun 1.3.1
> - OS: WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>

- Fixes nrwl/nx#33503

<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/nrwl/nx/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:10:34 -05:00
Colum Ferry 2d87134710 fix(react): target 22.3.4 patch version to address Remix CVE (#34068) 2026-01-13 13:51:20 +00:00
Leosvel Pérez Espinosa c69dd7f146 cleanup(core): reuse resolved prettier module in format command (#34088)
## Current Behavior

The `prettier` module is being resolved twice during the `format`
command execution and using a mix of `import`/`require`.

## Expected Behavior

The `prettier` module should be resolved once and reused.
2026-01-13 12:30:47 +00:00
Jason Jean 2045c829a3 fix(maven): fix Maven Central publishing for Maven 4 (#34084)
## Current Behavior

The `central-publishing-maven-plugin` with `extensions=true` does not
work with Maven 4. Running `./mvnw deploy -Prelease` completes the build
but never triggers the deploy/publish phase - it stops at install.

This is a known issue tracked as
[MNG-8584](https://issues.apache.org/jira/browse/MNG-8584).

## Expected Behavior

Running `./mvnw deploy -Prelease -pl packages/maven/maven-plugin -am`
should publish the nx-maven-plugin to Maven Central.

## Related Issue(s)

Related to Maven 4 compatibility:
https://issues.apache.org/jira/browse/MNG-8584

## Changes

- Add explicit execution binding for `central-publishing-maven-plugin`
to the deploy phase (workaround for broken extensions mechanism in Maven
4)
- Remove `extensions=true` that doesn't work with Maven 4
- Update `central-publishing-maven-plugin` from 0.9.0 to 0.10.0
- Skip standard `maven-deploy-plugin` for nx-maven-plugin module (we use
central-publishing instead)
2026-01-12 17:34:30 -05:00
MaxKless 64f2be4605 feat(gradle): add env vars to skip gradle and maven plugin computation (#34055)
## Current Behavior
the plugins are disabled on vercel and netlify but there's no easy way
to disable them otherwise.

## Expected Behavior
there's an env var to disable each of the plugins: `NX_GRADLE_DISABLE` /
`NX_MAVEN_DISABLE` just like there is one for dotnet.
2026-01-12 17:27:02 -05:00
Jason Jean 8b7dc6c8bf fix(maven): update Spring Boot to 4.0 and enable parent POM local install (#34081)
## Current Behavior

Maven e2e tests fail with two issues:
1. Spring Initializr rejects Spring Boot 3.4.0 (now requires >=3.5.0)
2. Parent POMs (`nx-parent` and `nx-maven-parent`) aren't installed
locally, causing Maven to fail when resolving `nx-maven-plugin:0.0.12`
since it's not yet published to Maven Central

## Expected Behavior

Maven e2e tests pass successfully by:
1. Using Spring Boot 4.0.0 which is supported by Spring Initializr
2. Installing parent POMs to local Maven repository so the plugin can
resolve its dependencies

## Related Issue(s)

Fixes the CI failures in maven e2e tests after the 0.0.12 version bump.
2026-01-12 16:29:02 -05:00
Caleb Ukle 6cca28c798 docs(nx-cloud): add missing 2025.07.4-.7 release notes (#34079) 2026-01-12 17:16:17 +00:00
Jack Hsu 4e7e9468fe fix(misc): update banner validation to match Framer API format (#34076)
## Current Behavior
The prebuild-banner script requires an `enabled` boolean field that the
Framer API does not return, causing validation failures.

## Expected Behavior
Validation matches the actual API response format which uses
`activeUntil` for determining banner visibility instead of `enabled`.

Closes #CLOUD-4071

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:28:33 -05:00
Craigory Coppola 7f68286bad fix(core): pipe plugin stdout to avoid inconsistent terminal state (#33369)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
After running commands which spawn plugin workers on the main process
(`nx show project`, or any command with the daemon disabled) some users
(and notably @FrozenPandaz) experienced terminal issues that resulted in
↑ / ↓ printing escape codes instead of scrolling command history.

## Expected Behavior
This pull request updates how plugin worker processes handle their
input/output streams to improve terminal behavior and debugging
capabilities. The main change is switching the worker's stdio from
`inherit` to `pipe`, and then manually piping the worker's stdout and
stderr to the main process. This avoids terminal state issues and
enables better debugging.

**Plugin worker process I/O handling:**

* Changed the worker process `stdio` option from `'inherit'` to `'pipe'`
in `startPluginWorker`, preventing terminal state issues (such as broken
arrow key functionality) after Nx execution.
* Added logic to pipe the worker's `stdout` and `stderr` to the main
process, making it easier to debug and allowing plugins to communicate
metrics. Increased the max listener count on `process.stdout` and
`process.stderr` to avoid warnings from multiple listeners.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-10 14:13:36 +00:00
Craigory Coppola 42a8a44b26 fix(core): validate native file cache size before applying it (#33683)
## Current Behavior
We dont validate the size of the native file cache after copying it,
which sometimes fails and corrupts the data. This failure results in a
different size, so we can detect it. In certain situations, the
corruption causes node to hang instead of throw.

## Expected Behavior
We detect the corruption

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #30653
Fixes #31300
2026-01-09 18:29:14 -05:00
Jack Hsu 0fe39b2931 fix(linter): delete override block when update returns undefined in replaceOverride (#34070)
I found regression in `replaceOverride` behavior that isn't guarded
against. There is migration from v17
(https://github.com/nrwl/nx/blob/20.8.x/packages/next/src/migrations/update-17-2-7/remove-eslint-rules-patch.ts#L17)
that shows that when `update` function returns `undefined`, then that
override entry should be removed.

We had no other unit tests to cover this case previously, so it was
missed until I tried cherry-picking the fix to `20.8.x` branch.

There was also a bug with flat config in v20 and v21 where not passing
`update` function for flat config leads to an error due to
`update(data)` being called without checking if `update` exists (since
it's optional). We never actually skip on passing `update` (which makes
`replaceOverride` useless since it's noop), so I marked it as required
arg now.

## Current Behavior

When `replaceOverride` is called with an update function that returns
`undefined`, the override block is not removed. This is inconsistent
with the JSON code path which uses `splice` to remove the override.

## Expected Behavior

When the update function returns `undefined`, the entire override block
should be deleted from the flat config, matching the JSON path behavior.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 15:16:10 -05:00
Philip Fulcher fb93570d09 docs(nx-dev): add missing multiplier article (#34069) 2026-01-09 13:02:34 -06:00
Leosvel Pérez Espinosa 4462a72f46 fix(core): allow dte to handle continuous tasks termination (#34018)
## Current Behavior

When running a task graph with continuous tasks and one of them is
terminated, the reverse continuous task deps that have no other tasks
that depend on them are also automatically terminated. This is fine in a
non-DTE context, but when running in a DTE context, the DTE task runner
must own the lifecycle of the continuous tasks, and Nx shouldn't
automatically terminate them.

## Expected Behavior

Nx shouldn't automatically terminate continuous tasks when running in a
DTE context.
2026-01-09 18:16:49 +00:00
Leosvel Pérez Espinosa cc5d173ed0 fix(core): disallow Vitest & Angular unit test runner when bundler is not esbuild in cnw (#34023)
## Current Behavior

The `create-nx-workspace` incorrectly offers `Vitest & Angular` as a
valid unit test runner choice when the bundler is something other than
`esbuild`.

## Expected Behavior

The `create-nx-workspace` should only offer `Vitest & Angular` as a
valid unit test runner choice when the bundler is `esbuild`.

## Related Issue(s)

Fixes #34014
2026-01-09 16:11:45 +00:00
Leosvel Pérez Espinosa 9230a8c515 fix(core): make process metrics registration in critical paths non-blocking (#34019)
## Current Behavior

On systems under heavy load, plugin loading can fail with:

```bash
Plugin Worker exited because no plugin was loaded within 10 seconds of starting up.
```

The initialization of the process metrics collection could potentially
cause this by blocking the loading of the plugin.

## Expected Behavior

Process metrics initialization no longer blocks critical startup paths,
allowing plugin loading to succeed regardless of system load.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2026-01-09 10:50:37 -05:00
Leosvel Pérez Espinosa 88c6baaf19 fix(core): display shared running tasks in the in progress section of the tui (#34059)
## Current Behavior

Shared running tasks (tasks running in another process) do not appear in
the In Progress section of the TUI. They show the throbber as being in
progress, but are located in the Pending/Completed section.

## Expected Behavior

Shared running tasks (tasks running in another process) should appear in
the In Progress section of the TUI.
2026-01-09 10:45:55 -05:00
Colum Ferry beb5ef585b feat(react): update react-router and remix versions to address CVEs (#34058)
Update to patched versions of React Router (7.12.0, 6.30.3) and Remix
(2.17.3) to address CVEs:

https://github.com/remix-run/react-router/security/advisories/GHSA-3cgp-3xvw-98x8

https://github.com/remix-run/react-router/security/advisories/GHSA-9583-h5hc-x8cw

https://github.com/remix-run/react-router/security/advisories/GHSA-9jcx-v3wj-wh4m

https://github.com/remix-run/react-router/security/advisories/GHSA-h5cw-625j-3rxh

https://github.com/remix-run/react-router/security/advisories/GHSA-2w69-qvjg-hvjx

https://github.com/remix-run/react-router/security/advisories/GHSA-8v8x-cx79-35w7
2026-01-09 13:23:11 +00:00
MaxKless dbedd19d68 fix(core): set windowsHide:true in package installation (#34053)
## Current Behavior
package installation does not set `windowsHide` so it flashes a terminal
window

## Expected Behavior
there should be no flashing terminal window

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2026-01-09 12:48:02 +09:00
Craigory Coppola 7f32f2c75f chore(repo): add copy-built-package script (#34035)
Adds a sm utility script to ease quickly checking changes against local
repos. Not a replacement for local registry + install, but good for
quick checks
2026-01-08 18:30:02 -05:00
Louie Weng a5c1388804 chore(gradle): bump version to 0.1.11 (#34054)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Bump gradle project graph plugin version to 0.1.11

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-08 22:31:26 +00:00
Jason Jean a13f5eb0d8 chore(repo): update nx to 22.4.0-beta.1 (#33968)
Updating Nx from 22.3.0-beta.3 to 22.4.0-beta.1
2026-01-08 17:24:34 -05:00
Caleb Ukle e38d2857f2 docs(nx-cloud): add new scopes for BB when using Nx Cloud onboarding (#34052) 2026-01-08 13:23:05 -05:00
Louie Weng 4af608013d feat(gradle): excludeDependsOn based on provider relationships (#33923)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

We have a hard coded list of task targets to not exclude depends on. 

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

We resolve a gradle task such that we can identify if there are provider
dependency relationships involved. If there are, then do not exclude
depends on since Gradle needs the dependsOn tasks to fulfill providers.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2026-01-08 17:59:05 +00:00
Louie Weng d73fd46d6e fix(gradle): resolve dependencies after capturing project tasks (#34045)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

When processing Kotlin Multiplatform (KMP) projects, the Nx Gradle
plugin encounters ConcurrentModificationException errors because KMP
dynamically modifies the Gradle project's task and configuration
containers during dependency resolution. The plugin was resolving
configuration dependencies before processing tasks, which triggered
KMP's hierarchy finalization and dynamic task creation while the plugin
was still iterating over these collections.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The Gradle plugin should handle Kotlin Multiplatform projects without
errors by:
1. Processing tasks before resolving configuration dependencies,
preventing KMP from modifying task containers during iteration
2. Creating immutable snapshots of task and configuration collections
before iteration to avoid concurrent modification issues

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes NXC-3633
2026-01-08 08:32:27 -08:00
Louie Weng 99a9216c43 fix(gradle): force gradle executor to always rerun tasks (#34024)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The Nx Plugin uses Nx as the backing mechanism, but Gradle still does
some caching behind the scenes. When using Nx and Gradle's caching at
the same time, there can be times where Gradle does not recognize input
changes and will not execute tasks that it mistakenly deems unchanged.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Ensure that the batch executor always reruns tasks and is not impacted
by the Gradle build cache.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes NXC-3649
2026-01-08 08:31:12 -08:00
Rares Matei 66488a2dc2 docs(nx-cloud): document how to set working directory in nx agents (#34033)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Caleb Ukle <caleb@nrwl.io>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2026-01-08 12:43:09 +00:00
Colum Ferry 2cdaffc850 feat(release): special-case 0.x versions for semver bumps (#34031)
For 0.x versions, shift semver bump types down to follow the common
convention where breaking changes bump minor, and new features bump
patch:

- major -> minor
- premajor -> preminor
- minor -> patch
- preminor -> prepatch
- patch -> patch (unchanged)

This ensures that `nx release` with a breaking change on a 0.x package
(e.g., 0.1.0) bumps to 0.2.0 instead of 1.0.0.

Fixes NXC-3638

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2026-01-08 10:23:06 +00:00
Jack Hsu 9fb5a6ce59 fix(linter): handle variable references in replaceOverride (#34026)
The migration generator (`@nx/plugin:migration`) fails when due to
ESLint flat config not being parsed correctly, leading to an error.

This happens because `replaceOverride` uses `parseTextToJson` to parse
the config, which fails for non-JSON-serializable JavaScript
expressions.

This PR fixes the issue by using AST parsing, like we did for
`hasOverrides` here https://github.com/nrwl/nx/pull/33548.

Fixes #34010

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:56:31 -05:00
Leosvel Pérez Espinosa 92f821d281 fix(js): avoid duplicate @nx/js/typescript plugin entries for non-buildable libs (#34021)
## Current Behavior

When adding a non-buildable JS library (`bundler: 'none'`) to a
workspace with an existing `@nx/js/typescript` plugin registration that
has build options configured, a duplicate plugin entry is unnecessarily
created in `nx.json`.

## Expected Behavior

Non-buildable libraries reuse the existing plugin registration when
`skipBuildCheck: true` is not specified, thereby avoiding duplicate
entries in `nx.json`. The `@nx/js/typescript` plugin will infer the
project as non-buildable because the library's `package.json` will have
entry points pointing to source files, so there's no need for a separate
plugin registration.

## Related Issue(s)

Fixes #33981
2026-01-07 09:18:39 +01:00
Colum Ferry 0119275ffd fix(module-federation): pin rspack to 1.6.8 (#34022)
## Current Behavior
Rspack 1.7.0 is failing to create factories for internals with Module
Federation.

## Expected Behavior
Pin Rspack to 1.6.8 for now to ensure continued functioning of Module
Federation
2026-01-06 10:00:42 -05:00
Andrey Chalkin 80cde6a950 feat(release): add option to opt-out commit scope filter (#33382)
## Current Behavior

PR #32915 changed how conventional commits determine version, making
them rely on commit scope:
commits with types configured to bump minor / major version bumps only
patch if commit scope exists and it does not include project name

## Expected Behavior

In our project we do not use projectName as commit scope, so we would
like to bring back old behavior, this can be achieved by adding option
to opt-out such behavior

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-30 14:51:07 -05:00
David Antoon caee7c6ee4 feat(rspack): add typeCheckOptions, runtimeDependencies, and cache options (#33931)
## Current Behavior

- The `skipTypeChecking` option is a simple boolean that only allows
enabling/disabling type checking
- Rspack executor is missing the `runtimeDependencies` option that
webpack has
- The `cache` configuration is hardcoded and cannot be overridden by
users

## Expected Behavior

- New `typeCheckOptions` option allows configuring type checking with `{
async: true }` to run type checking in a separate process without
blocking the build
- The deprecated `skipTypeChecking` option is maintained for backward
compatibility
- Rspack now supports `runtimeDependencies` option for adding runtime
dependencies to generated `package.json` (useful for Docker installs)
- New `cache` option allows users to override webpack/rspack caching
behavior while maintaining backward-compatible defaults

## Related Issue(s)

N/A - Standalone feature

## Changes Made

### typeCheckOptions (webpack & rspack)
- Added `TypeCheckOptions` interface with `async` property
- Added `typeCheckOptions` option to plugin options interfaces
- Updated `apply-base-config.ts` to normalize `typeCheckOptions` from
deprecated `skipTypeChecking` for backward compatibility
- Added schema definitions to `schema.json` and `schema.d.ts`

### runtimeDependencies (webpack & rspack)
- Added `runtimeDependencies` option to `NxAppRspackPluginOptions`
- Updated `GeneratePackageJsonPlugin` to resolve and include runtime
dependencies
- Added schema definitions to `schema.json` and `schema.d.ts`

### cache (webpack & rspack)
- Added `cache` option to plugin options interfaces
- Updated `apply-base-config.ts` to check `'cache' in options` before
applying defaults
- Allows explicit `cache: undefined` to force cache to be disabled
- Maintains backward-compatible defaults:
  - Webpack: `{ type: 'memory' }` for Node targets in watch mode
- Rspack: `true` for Node targets in watch mode, `true` in dependent
config

## Files Changed

**Webpack:**
-
`packages/webpack/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.ts`
-
`packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts`
- `packages/webpack/src/executors/webpack/schema.json`
- `packages/webpack/src/executors/webpack/schema.d.ts`
- `packages/webpack/src/plugins/generate-package-json-plugin.ts`

**Rspack:**
- `packages/rspack/src/plugins/utils/models.ts`
- `packages/rspack/src/plugins/utils/apply-base-config.ts`
-
`packages/rspack/src/plugins/utils/plugins/generate-package-json-plugin.ts`
- `packages/rspack/src/executors/rspack/schema.json`
- `packages/rspack/src/executors/rspack/schema.d.ts`

**Documentation:**
- `astro-docs/.../webpack/Guides/webpack-plugins.mdoc`
- `packages/webpack/docs/webpack-build-executor-examples.md`

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-12-30 13:37:13 -05:00
Kasper Christensen 5ef02e4c96 fix(testing): set moduleResolution to node in Cypress tsconfig to prevent TS5095 error (#33726)
When generating Cypress component testing in Angular workspaces, the
base tsconfig sets moduleResolution to 'bundler' which causes TS5095
errors because 'bundler' requires module to be 'preserve' or 'es2015+'.

Cypress runs in Node.js and should use Node.js module resolution
instead. This fix sets moduleResolution to 'node' for Cypress
tsconfig.json templates.

## Current Behavior

When generating Cypress component testing configuration in Angular
workspaces, the generated `cypress/tsconfig.json` inherits
`moduleResolution: "bundler"` from the workspace base config. Since
Cypress uses `module: "commonjs"` for Node.js runtime, this causes
TypeScript compiler error TS5095: "Option 'bundler' can only be used
when 'module' is set to 'preserve' or to 'es2015' or later."

## Expected Behavior

The generated `cypress/tsconfig.json` should explicitly set
`moduleResolution: "node"` to match the `module: "commonjs"` setting,
preventing TS5095 errors. This aligns with how NestJS applications
handle the same issue (see #33607).

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-30 10:45:45 -05:00
kazuki nakai ab01b2113f docs(core): add Docker development guidance (#33848)
## Summary

Adds comprehensive Docker development guidance to the Nx Daemon
documentation.

Related to #33263, #30359, #14126

## What's included

This PR expands the existing Nx Daemon docs with a new "Running Nx in
Docker" section that covers:

- **Why the daemon often fails in Docker** - ephemeral filesystems,
inode/mtime changes from volume mounts, container restarts, IPC issues
- **Recommended approach** - disable daemon with `NX_DAEMON=false`
- **Example docker-compose setup** - minimal reproducible configuration
for local development
- **CI/CD best practices** - when to prefer stateless builds over daemon
caching

## Context

Several issues have been opened around daemon behavior in containers,
but the existing docs only briefly mention socket location
customization. Users are left wondering:
- Why doesn't the daemon work reliably in Docker?
- What's the recommended workflow for containerized development?
- How should CI pipelines handle this?

Issue #33263 specifically describes daemon crashes when running nx
between Docker and non-docker environments - this PR documents the
recommended workaround (`NX_DAEMON=false`) and explains why.

## Preview

The new section appears under the existing "Customizing the socket
location" heading and includes:
- Explanation of Docker-specific challenges
- Code examples for Dockerfile, docker-compose, and CLI
- Rule of thumb callout for quick reference

Open to feedback on structure or placement.

---------

Co-authored-by: kazuki <kazuki@kazukinoMacBook-Air.local>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-29 15:42:08 -05:00
Copilot 84450f66db docs(core): add --tui and --no-tui flags to terminal UI documentation (#33303)
The `--tui` and `--no-tui` command-line flags were added after the
terminal UI documentation was written. Docs need to reference these
flags alongside the existing configuration methods.

## Changes

Updated `astro-docs/src/content/docs/guides/Tasks &
Caching/terminal-ui.mdoc`:
- Added `--tui` and `--no-tui` flags to the "Enable/Disable the Terminal
UI" section
- Restructured as bulleted list showing all four configuration methods

## Usage

Users can now control the Terminal UI via:
- `--tui` / `--no-tui` flags: `nx run-many -t build --no-tui`
- `NX_TUI` environment variable
- `tui.enabled` in `nx.json`

Fixes https://linear.app/nxdev/issue/NXC-3371

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `repo.gradle.org`
> - `staging.nx.app`
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/nrwl/nx/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Issue Title: Update
https://nx.dev/docs/guides/tasks--caching/terminal-ui#enabledisable-the-terminal-ui
to reference the `--tui` and `--no-tui` flags
> Issue Description: These were added after the other methods, docs need
to be updated to have them in the nrwl/nx repo
> Fixes
https://linear.app/nxdev/issue/NXC-3371/update-httpsnxdevdocsguidestasks-cachingterminal-uienabledisable-the
> 
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> 📋 I wasn't able to determine which GitHub repository to work in.
> 
> I think it's one of these, but can you tell me which one is right?
> 
> Comment by User :
> This thread is for an agent session with githubcopilot.
> 
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/nrwl/nx/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-12-29 15:28:35 -05:00
Rafayel Hovhannisyan 97fde57f7f feat(linter): add peerDepsVersionStrategy option to dependency-checks (#33417)
Adds a new peerDepsVersionStrategy option that allows configuring how
peer dependencies versions are set when auto-fixing. When set to
'workspace', peer dependencies will use 'workspace:*' instead of the
installed or root package version. Defaults to 'installed' to maintain
backward compatibility.

## Current Behavior
A concrete peer dependency version is being fixed.

## Expected Behavior
User can choose between `installed` and `workspace` version strategies.

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-29 15:24:43 -05:00
Copilot 0da6921ac3 docs(nx-dev): fix inputs syntax and document missing object formats (#33298)
## Plan to Fix Inputs Documentation

Based on the issue, I need to correct the inputs documentation at
`/astro-docs/src/content/docs/reference/inputs.mdoc`. The problems are:

- [x] Fix the invalid syntax in "Source Files" section - currently shows
inputs as an object instead of an array
- [x] Document the `{ input: someNamedInput, projects: [] }` format for
referencing named inputs from specific projects
- [x] Document the `{ input: someNamedInput, dependencies: true }`
format for referencing named inputs from dependencies
- [x] Document the object form for fileset inputs (e.g., `{ fileset:
string }`)
- [x] Ensure all documented formats match the TypeScript type definition
- [x] Fix typo found in code review (to to -> to)
- [x] Remove targetDefaults wrapper from examples (per review feedback)
- [x] Use string syntactic sugar forms in examples and explain
equivalence to object forms
- [x] Fix comment to show object form equivalence instead of repeating
string form

## Changes Made

1. **Fixed Source Files section syntax**:
   - Changed from invalid object syntax to correct array syntax
   - Removed unnecessary targetDefaults wrapper per review feedback
   - Added documentation for the object format with fileset property

2. **Added new section "Named Inputs from Other Projects"**:
   - Documents `{ input: "production", projects: "mylib" }` format
- Documents `{ input: "production", projects: ["mylib", "myapp"] }`
format for multiple projects
- Uses string syntactic sugar `"production"` and `"^production"` in
examples
- Explains equivalence: `"production"` is shorthand for `{ "input":
"production" }`, `"^production"` is shorthand for `{ "input":
"production", "dependencies": true }`

3. **Fixed typo**: Changed "to to not invalidate" to "to not invalidate"

All changes validated with prettier formatting checks.

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Issue Title: Docs: correct inputs syntax and document missing formats
> Issue Description: The inputs docs appear inaccurate at
[nx.dev/docs/reference/inputs#source-files](https://nx.dev/docs/reference/inputs#source-files).
> 
> * The shown inputs syntax isn’t valid; it should be an array.
> * The page doesn’t mention the `{ input: someNamedInput, projects: [\]
}` format.
> * It also doesn’t cover the object form for `deps`/`self` inputs.
> 
> Valid types reference:
[https://github.com/nrwl/nx/blob/master/packages/nx/src/config/workspace-json-project-json.ts#L206](https://github.com/nrwl/nx/blob/master/packages/nx/src/config/workspace-json-project-json.ts#L206)
> 
> Working with \[GitHub
Copilot\](User:d484ef82-7f7d-4a95-be09-9d82ca3905dc) on this.
> Fixes
https://linear.app/nxdev/issue/NXC-3369/docs-correct-inputs-syntax-and-document-missing-formats
> 
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> 📋 I wasn't able to determine which GitHub repository to work in.
> 
> I think it's one of these, but can you tell me which one is right?
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Side not, copilot assignment didn't work. Would have been neat 🙂
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> Waiting for https://linear.app/nxdev/profiles/craigory to link their
GitHub account. [Click to authorize
→](https://linear.business.githubcopilot.com/linear/auth)
> 
> Comment by User :
> This thread is for an agent session with githubcopilot.
> 
> Comment by User :
> Created issue
[NXC-3369](https://linear.app/nxdev/issue/NXC-3369/docs-correct-inputs-syntax-and-document-missing-formats)
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> This comment thread is synced to a corresponding [thread in
Slack](https://nrwl.slack.com/archives/CT3CQ2F0D/p1761762896195989?thread_ts=1761762896.195989&cid=CT3CQ2F0D).
All replies are displayed in both locations.
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> @Linear create a docs issue, assign it to me and copilot
> 
> Comment by User f5ae6d50-28e9-4ee7-ad51-3da8208d5914:
> Send a PR? 🙏
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> See these valid types:
[https://github.com/nrwl/nx/blob/master/packages/nx/src/config/workspace-json-project-json.ts#L206](https://github.com/nrwl/nx/blob/master/packages/nx/src/config/workspace-json-project-json.ts#L206)
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Also on the same page, I don't see any mention of the `{ input:
someNamedInput, projects: [] }` format, nor the object form for deps /
self inputs
> 
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
2025-12-29 14:00:42 -05:00
Austin Fahsl 75ff26630b docs(misc): remove redundant checkout conditional for GHA DTE example (#33829)
## Current Behavior

The GitHub Actions DTE example includes a redundant conditional checkout
step that has separate configurations for pull request and default
branch events, both performing the same checkout operation.

## Expected Behavior

The GitHub Actions example should use a single, simpler checkout
configuration that works for both pull request and default branch
events, removing redundant code.

## Related Issue(s)

This change simplifies the documentation example by removing redundant
checkout steps while maintaining the same functionality.
2025-12-29 13:56:04 -05:00
Anthony Shew c43ceb3a67 docs(misc): update Turborepo documentation with visualization details (#33970)
Updated Turborepo section to include robust browser-based graph
visualizations and Graphviz image exports.

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-29 13:54:04 -05:00
QING LIN 3735641f62 fix(core): convert filePath to an absolute path before typescript resolves the module (#34001)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
TypeScript’s module resolution stop at project's root when resolving
modules.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
TypeScript’s module resolution will walk up to the workspace root when
resolving modules

## Changes Made
Convert the filePath to an absolute path inside findProjectFromImport
before calling resolveImportWithTypescript, because TypeScript’s module
resolution will not correctly traverse up the directory tree toward the
workspace root when given a relative path.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #33985
2025-12-29 12:06:18 -05:00
Philip Fulcher 768c580f1d docs(nx-dev): add year of webinars article (#33980) 2025-12-28 15:19:49 +00:00
Colum Ferry d959d70185 fix(vitest): skip target inference for root workspace configs with projects (#33977)
When a vitest config file is at the workspace root and contains a
`projects` property in the test configuration, the plugin now skips
inferring test targets for that config. This is because root workspace
configs act as orchestrators - the actual tests live in the individual
project configs referenced by `projects`.

Fixes #32471
2025-12-22 13:55:24 +00:00
Colum Ferry 7cd296ba18 fix(vitest): add guard rails for vitest llm migration (#33976)
Edit guard rails for Vitest 4 LLM migration
2025-12-22 12:31:17 +00:00
Philip Fulcher ee4c687492 docs(nx-dev): add 2025 review article (#33973) 2025-12-20 23:07:22 -05:00
Copilot 9790910fbe fix(angular): only throw "define" error when options.define has keys (#33969)
## Current Behavior

The dev-server builder throws an error about the "define" option not
being supported in Angular < 21, even when users don't configure it. The
validation uses a truthy check that treats empty objects `{}` as true.

## Expected Behavior

The error should only throw when users explicitly configure define with
actual keys.

## Related Issues

Fixes #33964

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: leosvelperez <12051310+leosvelperez@users.noreply.github.com>
2025-12-20 10:40:12 +00:00
Craigory Coppola dd7ec3016b feat(core): support cwd specific hashes (#33879)
## Current Behavior
There is no straight-forward way to use the cwd as part of a tasks hash

## Expected Behavior
You can use `{workingDirectory: 'absolute'}` to factor the working
directory into the hash

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #33684
2025-12-20 01:37:12 -05:00
Miroslav Jonaš ab82bfed92 fix(core): improve package-json createNode performance (#33960)
On test repo, the
`package-json:createNodes:isInPackageManagerWorkspacesTime` takes:
- Before the PR: 2356ms
- With PR: 23ms

This is achieved by avoiding unnecessary use of `minimatch` when a
direct string comparison is sufficient.

It also makes creation and logging of entire graph come down from
`23.6s` down to `18.5s`

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: meeroslav <meeroslav@users.noreply.github.com>
2025-12-19 17:38:23 -05:00
Bendegúz Hajnal 8b83502114 feat(linter): add bulk suppression support for ESLint v9.24.0+ (#32184)
Add support for ESLint's new bulk suppression features introduced in
v9.24.0.

- Add `suppressAll` option to suppress all existing violations
- Add `suppressRule` option to suppress specific rule(s)
- Added `suppressionsLocation` option to specify custom location for the
suppressions file (defaults to eslint-suppressions.json)
- Include proper version checking for ESLint v9.24.0+
- Add related tests and documentation
- Update schema and TypeScript types

This allows teams to incrementally adopt stricter lint rules without
being overwhelmed by legacy violations.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
The `@nx/eslint` package currently doesn't support ESLint's bulk
suppression features. When teams want to enable new lint rules, they
must fix all existing violations first, which can be a significant
barrier to adopting stricter linting standards.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The @nx/eslint package now supports ESLint v9.24.0+'s bulk suppression
features through new flags:
- `suppressAll`: Suppresses all existing violations
- `suppressRule`: Suppresses specific rules
- `suppressionsLocation`: specifies a custom location for the
suppressions file (defaults to eslint-suppressions.json)

```json
{
  "lint": {
    "executor": "@nx/eslint:lint",
    "options": {
      "suppressAll": true 
    }
  }
}
```

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

https://github.com/nrwl/nx/discussions/30620
2025-12-19 17:26:20 -05:00
Jack Hsu 5f5a0b0ab3 fix(misc): remove CNW A/B testing flow branching (#33967)
This PR removes the variant check for deciding whether to use GitHub
templates for CNW. Moving forward, the first-level options are all
`nrwl/*` templates. The `Custom` option allows users to go back to the
previous presets.
2025-12-19 16:43:12 -05:00
Jack Hsu 137ab459fe docs(nx-dev): support .md URLs and llms.txt for AI agents (#33958)
This PR allows `.md` to be append to any docs URL to return raw markdown
content. Also adds `/llms.txt` that links to each markdown URL in the
docs site.

This allows AI agents to read content without having to parse HTML,
saving tokens.

Preview of `llms.txt`:
https://deploy-preview-33958--nx-docs.netlify.app/docs/llms.txt
Preview of page markdown content:
https://deploy-preview-33958--nx-docs.netlify.app/docs/concepts/buildable-and-publishable-libraries.md

Closes DOC-368
2025-12-19 15:00:07 -05:00
Leosvel Pérez Espinosa 61c41c9a75 docs(core): add missing env vars for nx migrate (#33962)
Documents the `NX_MIGRATE_SKIP_INSTALL` and `NX_MIGRATE_USE_LOCAL`
environment variables.
2025-12-19 17:57:09 +01:00
Philip Fulcher 19fa732eb0 docs(nx-dev): add 21.3 release article and changelog (#33939)
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Caleb Ukle <caleb@nrwl.io>
2025-12-19 11:23:08 -05:00
Colum Ferry 5242d61717 docs(module-federation): add guide for using Tailwind CSS with Module Federation (#33959)
Explains how to configure Tailwind CSS so that classes used in remote
applications are properly compiled by the host application. Covers both
Tailwind v3 (content array) and v4 (@source directive) configurations.
2025-12-19 10:51:00 -05:00
Jack Hsu 7bb90bf1c9 docs(misc): use middleware for Framer proxy to keep pages static (#33956)
This PR fixes the `/changelog` page.

With `getStaticProps`, files were read at build time when copy-docs had
already copied them. With `getServerSideProps`, files are read at
request time on serverless functions where those files don't exist.

This PR reverts the changes to use `getServerSideProps` and uses a
middleware instead. This also has the benefit of keeping the pages
static, so we do not need edge functions to run their server function.

Fixed: https://nx-dev-git-doc-372-nrwl.vercel.app/changelog

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2025-12-19 10:37:29 -05:00
Caleb Ukle 3e32862622 fix(misc): remove auto CI Optimization card from AI page (#33955)
Fixes DOC-371
2025-12-19 15:33:45 +01:00
Leosvel Pérez Espinosa 691bb320ce feat(angular): support cypress component testing with zoneless projects (#33941)
## Current Behavior

Cypress Component Testing for zoneless Angular projects is not
supported.

## Expected Behavior

Cypress Component Testing for zoneless Angular projects should be
supported.
2025-12-19 14:17:05 +01:00
MaxKless be5bd5f8e2 docs(core): document NX_USE_LOCAL env var (#33952) 2025-12-19 14:13:55 +01:00
Leosvel Pérez Espinosa 5659d50e11 fix(linter): honor setParserOptionsProject in flat config (#33953)
## Current Behavior

When generating Angular apps/libs with `setParserOptionsProject`, the
ESLint flat config output did not include the project-level
`parserOptions.project`, so type-aware lint rules still fail unless
users edit the config manually.

## Expected Behavior

Enabling `setParserOptionsProject` produces the appropriate
project-level `parserOptions.project` configuration in both flat ESLint
config and legacy `.eslintrc.json`, so type-aware linting works out of
the box.

## Related Issue(s)

Fixes #33944
2025-12-19 14:12:22 +01:00
Leosvel Pérez Espinosa 5a4b345a3a fix(angular): support @angular/cli package update during nx migrate (#33918)
## Current Behavior

When migrating Angular packages the `@angular/cli` package is not
updated as part of the `nx migrate` initial package updates to the
`package.json` file. Instead, it's updated at a later stage with a
migration generator. This happens for a couple of reasons:

- Angular CLI package group will update all the packages using a `^`,
which can result in workspaces getting a minor version of the packages
installed before Nx adds support for that minor version.
- Angular CLI migrations can error due to some assumptions that are not
always correct in Nx workspaces.
- The `nx migrate` command currently doesn't have the ability to ignore
the package group or migrations of a given package.

This is why the `@angular/cli` package is migrated "manually" in a
migration generator.

## Expected Behavior

The `@angular/cli` package should be updated as part of the package
updates performed by the `nx migrate` command while ignoring its package
group and migrations. The `@nx/angular` package already provides the
same set of migrations and more.

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-19 08:07:06 -05:00
Leosvel Pérez Espinosa c23dcfb649 fix(core): fix vitest test runner options for angular in cnw (#33921)
## Current Behavior

Creating a new Angular workspace with Vitest results in no test setup
being generated. This happens because the `vitest` option is no longer
available, and instead, there are two options: `vitest-angular` and
`vitest-analog`.

## Expected Behavior

Creating a new Angular workspace should prompt for Vitest with Angular
or Vitest with Analog to set up the tests.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: leosvelperez <leosvelperez@users.noreply.github.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-12-19 08:06:55 -05:00
Colum Ferry 841f1ef8ec fix(module-federation): skip non-npm external dependencies in getDependencies (#33951)
The getDependentPackagesForProject function was crashing when processing
projects with non-npm external nodes (e.g., cargo: prefixed nodes from
@monodon/rust plugin). The code only handled npm: prefixed externals and
treated everything else as workspace libraries, causing undefined access
errors when cargo externals were encountered.

This fix adds a check to skip external nodes that aren't npm-prefixed by
detecting the presence of a colon in the dependency target. Only npm:
prefixed externals are processed as npm packages, and other external
prefixes (cargo:, maven:, etc.) are now properly skipped.

Fixes #32819
2025-12-19 12:31:57 +00:00
Colum Ferry 32bc89e078 docs(release): clarify ignorePatternsForPlanCheck syntax #30324 (#33926)
## Current Behaviour

The ignorePatternsForPlanCheck configuration option in nx.json for
version plans lacks
documentation about the pattern syntax. Users attempting to use negation
patterns (e.g.,
["*", "!src/"]) may experience unexpected behavior because gitignore
semantics don't work
  as intuitively expected with such patterns.

 ## Expected Behaviour

  The documentation and JSDoc comments now clearly explain:
  - That ignorePatternsForPlanCheck follows gitignore semantics
  - Working patterns like ["**/*.spec.ts"] and ["**/*.ts", "!**/src/**"]
- Non-working patterns like ["*", "!src/"] and why they don't work as
expected
- Recommended approach of using file extension patterns instead of
wildcards when trying to
   ignore all files except those in specific directories

 ## Related Issues

  Fixes #30324

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-12-19 12:31:47 +00:00
Colum Ferry e31aea073f fix(module-federation): use localhost as default host #33909 (#33947) 2025-12-19 10:38:47 +00:00
Colum Ferry 531163ea11 docs(react): remove apps preset from cnw command #31841 (#33943)
Closes #31841
2025-12-19 10:00:38 +00:00
Leosvel Pérez Espinosa 98bbec7fc7 feat(angular): support ngrx v21 (#33940)
## Current Behavior

NgRx v21 is not supported.

## Expected Behavior

NgRx v21 should be supported.
2025-12-19 09:14:42 +00:00
Craigory Coppola 390602b7c7 chore(core): revert wasm changes in get_mod_time (#33929)
WASM changes are breaking the build
2025-12-18 18:31:20 -05:00
Craigory Coppola 32783dfb09 feat(core): add inline-tui view mode (#32718)
## Current Behavior
When running single tasks we have a "minimal" tui, but that minimal tui
still makes it really hard / impossible to use some of the terminals
built in features... like:

- Find (can only find what's currently rendered by tui)
- Text select + copy (can only select what's rendered to screen, copied
text includes the frame around the tui / scrollbar)

## Expected Behavior
When running single tasks we can use an inline viewport to render some
tui widgets at the bottom of the viewport, and terminal output can be
printed above.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-18 18:31:07 -05:00
Louie Weng ab488f7e75 chore(maven): disable e2e tests (#33936)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Disabling Maven e2e tests since something with e2e setup breaks when we
try to update the spring boot version.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-18 18:08:50 -05:00
Caleb Ukle cb2cbb6930 fix(nx-dev): make sure canonical urls are always nx.dev (#33932)
make sure canonical always points to nx.dev and not a subdomain preview
incase they're index.
<img width="1728" height="863" alt="image"
src="https://github.com/user-attachments/assets/8e7d91c1-277b-4a2a-91ec-732f7f4f37ae"
/>
also confirm that robots.txt still has deny for non prod builds. 

this is done via middleware since canonical url is controlled via astro
config 'site' property. which is used to control other aspects that we
do want to be preview URL domains (like navigation). so we have a
middleware to always override the url to match prod.

also nextjs side was already overriding this in `_app.tsx`
2025-12-18 16:25:08 -05:00
Jack Hsu 9016f8d842 docs(nx-dev): add dynamic banner support to nx.dev (#33793)
This PR adds the ability to consumer banner data for nx.dev (both astro
and next.js) from a remote JSON file. This is only enabled if
`BANNER_URL` environment variable is set.

The `banner-config.json` files are committed for both astro and next.js,
so before we consume banner JSON from Framer, we can use this as the
source of truth rather than update the component code.

Once we switch completely to Framer CMS, we can remove the committed
JSON files.

Note: A redeploy is required for banner changes to take effect. In the
future we may be able to do this dynamically in Astro.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-18 16:21:11 -05:00
Louie Weng 0a04c920b1 revert(maven): revert maven plugin back down to 0.0.11 (#33930)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Maven plugin was complaining about Spring-boot version being behind 3.5
when running e2e suite. Also bumped down maven plugin version since
version 0.0.12 could not be found at the time of this PR.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-18 15:42:46 -05:00
Caleb Ukle 22cce83550 fix(nx-dev): make sure only prod is indexed (#33922)
Note: required updating inputs for tasks to make sure env vars are
correctly cache busting.

Prod
<img width="1459" height="724" alt="image"
src="https://github.com/user-attachments/assets/1289b745-b68f-4176-9812-ef783d03ba26"
/>
non prod
<img width="1585" height="589" alt="image"
src="https://github.com/user-attachments/assets/dd0603b2-6487-4690-8bed-4c3d82644304"
/>
2025-12-18 13:03:26 -05:00
Caleb Ukle e31f815a6b docs(nx-cloud): clarify nx cloud run details when disabling nx cache (#33925) 2025-12-18 16:51:56 +00:00
Caleb Ukle 014d229b4a docs(core): add include/exclude plugin options to inferred tasks docs (#33924)
## Current Behavior

The inferred tasks documentation at
https://nx.dev/docs/concepts/inferred-tasks does not mention the
`include` or `exclude` options on plugins, even though this is a common
and useful feature for scoping plugins to specific projects.

## Expected Behavior

The inferred tasks documentation now includes a new section called
"Scope Plugins to Specific Projects" that explains:
- How to use `include` and `exclude` properties in plugin configuration
- What the glob patterns match against
- Use cases for this feature (scoping plugins, applying different
options to different projects)

This aligns with the existing documentation in the nx.json reference
guide.

## Related Issue(s)

Fixes DOC-367
2025-12-18 11:50:00 -05:00
Colum Ferry 1bc16c86dc fix(react): set up module federation with webpack and ts soln correctly #31029 (#33920)
## Current Behavior

When generating a React Module Federation remote with webpack bundler in
a TypeScript
Solution setup, the generator incorrectly sets the production webpack
config path in the
project configuration. Additionally, the sourceRoot property is not
being set in
package.json for TS Solution setups, which causes issues with module
federation's ability
  to locate source files correctly.

 ## Expected Behavior

  When using a TypeScript Solution setup:
- The production webpack config should not be explicitly set in the
build target's
  production configuration (it will be inferred correctly)
- The sourceRoot property should be set in package.json under the nx
configuration to
  properly identify the project's source directory
- The typecheck target should be added as a dependency for both build
and serve targets

 ## Related Issue(s)

  Fixes #31029
2025-12-18 15:42:08 +00:00
Leosvel Pérez Espinosa d9ca27bc3d fix(testing): ensure jest v30 migration is run (#33916)
## Current Behavior

The `replace-removed-matcher-aliases` migration from `@nx/jest` is not
run when migrating to Angular v21 (and updating Jest to v30). That
migration targets the original package update for Jest v30 (Nx 21.3.0),
which was incompatible with Angular < 21, so it wouldn't have run for
Angular workspaces at the time. Now that Angular is being updated to
v21, Jest is updated to v30, but the migration generator is not running.

## Expected Behavior

The `replace-removed-matcher-aliases` migration from `@nx/jest` should
run when migrating to Angular v21 (and updating Jest to v30).
2025-12-18 10:06:47 -05:00
Jason Jean d6a4b7d7ba chore(maven): update Maven version to 4.0.0-rc-5 (#33914)
## Current Behavior

The Maven version used for development dependencies is currently set to
3.9.11 in both pom.xml and mise.toml.

## Expected Behavior

The Maven version should be updated to 4.0.0-rc-5 to align with the
Maven 4 version already used in the batch-runner component.

## Related Issue(s)

N/A - This is a dependency version update to ensure consistency across
the Maven plugin ecosystem.

## Changes

- Updated `maven.version` property in pom.xml from 3.9.11 to 4.0.0-rc-5
- Updated maven tool version in mise.toml from 3.9.11 to 4.0.0-rc-5

This ensures that developers working on the Nx Maven plugin use the same
Maven 4.0.0-rc-5 version across all components.
2025-12-18 10:06:23 -05:00
Jason Jean 0cb91b85cb chore(maven): bump Maven plugin version to 0.0.12 (#33913)
## Current Behavior

The Maven plugin version is currently at 0.0.11.

## Expected Behavior

This PR bumps the Maven plugin version to 0.0.12 and creates a migration
for Nx 22.4.0-beta.0. This allows users to automatically update their
pom.xml files when they upgrade to the next version of Nx.

## Related Issue(s)

N/A - Version bump
2025-12-18 10:06:07 -05:00
Jason Jean f154b70196 fix(core): daemon client reconnection on server restart (#33432)
## Current Behavior

The daemon currently depends on client requests failing with a
`LOCK_FILES_CHANGED` error to trigger a restart. This creates several
issues:
- The daemon may stay running with stale dependencies if no requests
come in
- The client must wait for a request to fail to trigger reconnection
- Special-case error handling is scattered across the client code

## Expected Behavior

The daemon should proactively restart itself when lock files change, and
the client should gracefully reconnect with exponential backoff for any
server shutdown scenario.

## Changes

### Client-Side: Exponential Backoff Reconnection
- Add `handleConnectionError()` method that retries with exponential
backoff (10ms → 5000ms, 30 attempts max)
- Preserve pending messages during reconnection and resend them once the
new daemon is available
- Remove special-case handling for `LOCK_FILES_CHANGED` and
`NX_VERSION_CHANGED` errors
- Remove `retryMessageAfterNewDaemonStarts()` method as it's no longer
needed

### Server-Side: Self-Restart on Lock File Changes  
- Add `startNewDaemonInBackground()` to spawn a replacement daemon
before shutdown
- Add `handleServerProcessTerminationWithRestart()` for restartable
shutdown scenarios
- Detect lock file changes and proactively start a new daemon before
responding with an error
- Keep version change handling simple (just exit, no restart)

## Benefits
- **More Resilient**: Client recovers from any server shutdown, not just
specific errors
- **Cleaner Architecture**: Server manages its own lifecycle, client
doesn't need special cases
- **No Request Dependency**: Daemon doesn't wait for requests to detect
changes
- **Reduced Error Spam**: Exponential backoff prevents connection error
floods
- **Future-Proof**: Foundation for other restart scenarios (plugins,
config changes)

## Related Issue(s)

Fixes https://github.com/nrwl/nx/issues/30514
Fixes https://github.com/nrwl/nx/issues/29118
2025-12-17 23:02:08 -05:00
Jason Jean fed034a32d feat(maven): add batch executor for multi-task Maven execution (#33228)
## Summary

Adds a batch executor for Nx Maven that enables parallel multi-task
execution with significant performance improvements. The batch runner
keeps Maven resident in memory, avoiding cold start overhead for each
task.

## Changes

### 1. Batch Runner JAR (`packages/maven/batch-runner`)
- **ResidentMavenExecutor**: Uses Maven 4.x's `ResidentMavenInvoker` to
keep Maven in memory
- **NxMaven**: Custom Maven wrapper that caches project graphs and
sessions across invocations
- **CachingResidentMavenInvoker**: Preserves session state so artifacts
from `jar:jar` are visible to `install:install`
- **BuildStateManager**: Applies/records build states for
cross-invocation caching
- Maven 4.x dependencies are shaded into the JAR for standalone
execution

### 2. TypeScript Executors (`packages/maven/src/executors/maven`)
- **maven.impl.ts**: Single-task executor using `mvnw`/`mvn`
- **maven-batch.impl.ts**: Batch executor that invokes the batch runner
JAR
- Automatic Maven version detection and executable resolution

### 3. Shared Utilities (`packages/maven/shared`)
- `BuildState`, `BuildStateApplier`, `BuildStateRecorder` for
cross-invocation state
- `MavenCommandResolver` for detecting Maven executable
- Reusable across batch-runner and maven-plugin modules

### 4. Maven Plugin Updates (`packages/maven/maven-plugin`)
- Updated to use `@nx/maven:maven` executor (batch-aware)
- Improved `GitIgnoreClassifier` for nested .gitignore handling
- Cache config tweaks for compiler inputs

## Performance

| Scenario | Before | After |
|----------|--------|-------|
| Cold start per task | 100-500ms | N/A (one-time init) |
| Per-task execution | 100-500ms | ~1.3ms (cached) |
| Improvement | - | **75-385x faster** |

## Version Support

- **Maven 4.x**: Full support with ResidentMavenExecutor (optimized)
- **Maven 3.x**: Falls back to ProcessBasedMavenExecutor (subprocess)

## Testing

- E2E tests for Maven 4.0.0-rc-4, 4.0.0-rc-5
- Unit tests for TypeScript executors
- Tests for GitIgnoreClassifier

## Current Behavior

Uses subprocess execution via `mvnw`/`mvn` for each task.

## Expected Behavior

Batch execution keeps Maven resident, dramatically reducing per-task
overhead.

## Related Issue(s)

Part of Maven integration improvements.

---------

Co-authored-by: Max Kless <maxk@nrwl.io>
2025-12-17 22:49:54 -05:00
Philip Fulcher 62b3c91be9 docs(nx-dev): remove December 2025 webinar notifier (#33911) 2025-12-17 22:17:04 -05:00
Craigory Coppola 9475bb4386 fix(core): ensure no tui on single tasks (#33910)
## Current Behavior
The tui shouldn't show for single tasks

## Expected Behavior
The tui isn't shown for single tasks

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-17 23:43:01 +00:00
Craigory Coppola c7cdd2a9b9 fix(dotnet): fix dependency graph for multi-targeting and transitive deps (#33908)
## Current Behavior

  Two issues with the .NET dependency graph:

1. Issue #33653: When a .NET project uses multi-targeting
(<TargetFrameworks> plural), its project reference dependencies
disappear from the Nx graph.
2. Issue #33397: Transitive dependencies are incorrectly shown as direct
dependencies. For example, if A → B → C, the graph shows A depending on
both B and C, when it should only show A → B.

##  Expected Behavior

1. Multi-targeting projects should correctly show their dependencies in
the graph.
2. Only direct dependencies should be shown, not transitive ones. Nx
handles transitive dependencies through the dependency chain.

 ### Solution

  Multi-targeting fix (#33653)

  MSBuild creates multiple nodes for multi-targeting projects:
  - An "outer build" with TargetFrameworks set but TargetFramework empty
  - "Inner builds" for each target framework with TargetFramework set

The fix groups nodes by project file path and prefers inner builds
(which have properly resolved references) over outer builds.

 ### Transitive dependency fix (#33397)

Changed from using ProjectGraphNode.ProjectReferences (which includes
transitive dependencies in multi-targeting scenarios) to
ProjectInstance.GetItems("ProjectReference") which returns only direct
references defined in the project file.

 ## Related Issue(s)

  Fixes #33653
  Fixes #33397

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 18:22:01 -05:00
Jason Jean 6e426514e2 chore(repo): update nx to 22.3.0-beta.3 (#33907)
Updating Nx from 22.3.0-beta.2 to 22.3.0-beta.3
2025-12-17 14:42:51 -05:00
Jack Hsu 6323dba876 fix(core): convert * to workspace:* for pnpm/yarn/bun in CNW (#33893)
Templates use `"*"` for workspace dependencies in individual
package.json files. This works for npm but breaks pnpm, yarn, and bun
which require the `workspace:` protocol for proper symlinking.

For pnpm, yarn, and bun: automatically convert `"*"` dependencies to
`"workspace:*"` in all workspace package.json files. npm is left
unchanged since it handles `"*"` natively.

Also adds support for 2-level nested projects (e.g.,
`libs/shared/models/package.json`).

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-17 14:11:06 -05:00
Jack Hsu 5c404e669f docs(misc): add "Copy page" button to copy markdown content (#33905)
This PR adds a `Copy page` action under the ToC in the right sidebar.

<img width="608" height="861" alt="image"
src="https://github.com/user-attachments/assets/9d3c7444-1163-4682-87dc-a399178e750d"
/>

The helps get the content into LLMs and AI agents.
2025-12-17 13:53:17 -05:00
Leosvel Pérez Espinosa 6f85b83fd3 cleanup(repo): format all files (#33902)
Format all files after Prettier v3 was merged.
2025-12-17 17:15:06 +00:00
Berend de Boer a5fc0d6b6e docs(misc): add link to new nx-biome plugin (#33854)
This plugin supports --batch for very fast formatting and linting.
2025-12-17 17:13:06 +01:00
Leosvel Pérez Espinosa e3777677b8 fix(core): invalidate sync generator cache on file changes and use up-to-date project graph (#33780)
## Current Behavior

Sync generators are processed in the background by the daemon server.
Their results are cached and reprocessed when the project graph is
recomputed. There are currently two issues:

- The cache is only invalidated after the project graph finishes
recomputing, which means that there's an interval between files changed
(triggering the project graph recomputation) and the recomputation
finishes, where the cache is not invalidated, and it's stale. During
that interval, any request to get the sync generator changes will use
the stale cache.
- Sync generators are scheduled to be processed after the project graph
is recomputed, so a quick succession of recomputations can be coalesced.
The problem is that the scheduled closure uses the project graph from
the initial scheduling, rather than the latest available project graph
at the time it runs. This results in the usage of stale data to process
the sync generators.

## Expected Behavior

Getting sync generators changes should always return up-to-date
information.
2025-12-17 10:36:48 -05:00
Leosvel Pérez Espinosa 99d226fd6b fix(core): improve database initialization error handling (#33820)
## Current Behavior

When database initialization fails due to filesystem issues, permission
problems, or environment incompatibilities (like WAL mode not being
supported), Nx shows generic error messages that don't provide
actionable guidance to users. For example:
- "Unable to create db lock file: PermissionDenied"
- "Unable to set journal_mode: <sqlite error>"

This makes it difficult for users to diagnose and resolve issues,
especially in restricted environments like Docker containers, network
filesystems, or WSL1.

## Expected Behavior

With this PR, database initialization errors now provide:

1. **Context-specific error messages** - Different guidance based on the
error type:
- Permission denied: Instructions about file ownership, Docker volume
permissions, and read-only filesystems
   - Storage full: Suggestions to free disk space
   - Already exists: Guidance about stale files from crashed processes

2. **Automatic WAL mode fallback** - When WAL journal mode is not
supported by the filesystem, Nx now automatically falls back to DELETE
journal mode instead of failing. This improves compatibility with:
   - Network filesystems (NFS, CIFS)
   - Some Docker volume configurations
   - Other environments with limited locking support

3. **WSL1 detection** - Proactively detects WSL1 environments (which
have known WAL incompatibilities) and uses DELETE mode from the start,
avoiding failed attempts and retries.

4. **Better cleanup on retry** - When database initialization fails and
needs to retry, all auxiliary files (WAL and SHM files) are also cleaned
up, not just the main database file.

5. **Actionable reporting instructions** - All error messages now
include:
- How to capture detailed logs
(`NX_NATIVE_FILE_LOGGING=nx::native::db=trace`)
   - Link to create an issue
   - Suggestion to run `nx reset`
2025-12-17 10:25:18 -05:00
Leosvel Pérez Espinosa 6f7830088e feat(core): add hints and status messages to the tui (#33838)
## Current Behavior

When users press unhandled keys in the TUI (e.g., pressing `i` on a
completed task, or typing in a non-interactive terminal pane), nothing
happens and there's no feedback explaining why.

Similarly, when users press certain key bindings like `c` to copy
output, the action succeeds but there's no visual confirmation.

## Expected Behavior

### Hint Popups for Unhandled Keys

Users now see helpful hint popups when pressing keys that don't work in
the current context:

- Pressing `i`, `c`, or `Ctrl+A` in the dependency view (task hasn't
started yet)
- Pressing `i` on a task that doesn't support interactive mode
- Pressing character keys in a terminal pane that's not in interactive
mode

The hints explain what's happening and guide users on how to proceed.

### Status Messages for "Invisible" Actions

When users perform actions without obvious visual feedback, a status
message now appears in the terminal pane's bottom border:

- `Output copied` when pressing `c` to copy
- `Sent to assistant` when pressing `Ctrl+A`

### Configuration Option

Users who prefer not to see hint popups can disable them in `nx.json`:

```json
{
  "tui": {
    "suppressHints": true
  }
}
```
2025-12-17 10:14:11 -05:00
Colum Ferry a64d1b237e fix(storybook): use helper to find correct version when pnpm catalogs are used (#33900)
Current Behavior

When using pnpm catalogs to manage dependency versions, the Storybook
utilities and ESLint version-utils read package.json directly using
readJson() or readJsonFile(). This approach doesn't resolve catalog
references like catalog:default, causing version detection to fail or
return incorrect values.

  For example, if package.json contains:
  {
    "devDependencies": {
      "storybook": "catalog:default"
    }
  }

The current code would return "catalog:default" as the version string
instead of resolving it to the actual version (e.g., "8.5.0").

  Expected Behavior

Use the getDependencyVersionFromPackageJson() helper from @nx/devkit
which properly handles pnpm catalog resolution. This ensures that
version detection works correctly regardless of whether dependencies are
specified directly or via pnpm catalogs.

  The helper:
  - Resolves catalog: references to their actual versions
  - Falls back gracefully when catalogs aren't in use
  - Maintains consistent behavior across different package managers

  Related Issue(s)

Fixes issues with pnpm catalog compatibility in Storybook generators and
ESLint utilities.

  Related to #29772

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-12-17 14:44:40 +00:00
Leosvel Pérez Espinosa 62c13c5477 feat(misc): support prettier v3 (#33898)
## Current Behavior

Nx doesn't generate projects with Prettier v3.

## Expected Behavior

Nx should generate projects with Prettier v3.

## Related Issue(s)

Fixes #30801
2025-12-17 09:26:13 -05:00
Leosvel Pérez Espinosa c29834c0a7 fix(angular): ensure jest and jest-preset-angular are updated correctly for angular v21 (#33896)
## Current Behavior

There's a deadlock between the Angular and Jest package updates
requirements (`requires` and `incompatibleWith`) that prevents updating
Jest to v30 and `jest-preset-angular` to v16.

## Expected Behavior

Updating to Angular v21 should result in updating Jest to v30 and
`jest-preset-angular` to v16.

This is ensured by moving the `jest-preset-angular` package update
definition to the `@nx/jest` package and processing the `@nx/angular`
package updates before `@nx/jest`. That way, by the time `@nx/jest` is
processed, the migrator would have collected the Angular v21 updates,
and the requirements will be met.
2025-12-17 08:48:34 -05:00
Jack Hsu 3384b1dc91 docs(nx-dev): add Framer rewrite support for nx-dev (#33677)
## Current Behavior
The nx-dev Next.js app can only serve pages from its own codebase or
proxy to Astro docs.

## Expected Behavior
Support proxying specific pages to a Framer site via environment
variables:
- `NEXT_PUBLIC_FRAMER_URL`: Base URL of the Framer site
- `NEXT_PUBLIC_FRAMER_REWRITES`: Comma-separated paths for new pages

For existing pages like `/ai`, the proxy is handled in
`getServerSideProps`.

## Related Issue(s)
Closes DOC-349

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-17 08:16:00 -05:00
Leosvel Pérez Espinosa a24119303c feat(angular): add migration to replace jest-preset-angular/setup-jest imports (#33899)
Replaces the removed `jest-preset-angular/setup-jest` import with the
new `setupZoneTestEnv` function from
`jest-preset-angular/setup-env/zone`.
2025-12-17 14:10:36 +01:00
Chau Tran 8d5ca12b30 fix(graph): serve full project graph when navigating from PDV (#33897) 2025-12-17 18:56:32 +07:00
Jan Sudczak 4493157fb0 fix(js): allow copying generated Prisma client (asset) from 'node_modules' (#33822)
Removed 'node_modules' from the ignore list for asset copying.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Updating Nx to v22 breaks my app. Some projects use generated Prisma
clients which, because of how Prisma binaries work, have to be generated
to `node_modules` in order to work both locally and in Docker context.
With Nx v22 Prisma client is not copied when project is built using
`@nx/esbuild:esbuild` (or any other executor supporting `assets`
property) without any error or warning. It took mi couple of hours to
pinpoint the exact line of code responsible for this. `node_modules` dir
is hardcoded there without any possibility to be overridden.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Prisma client can be copied from `node_modules` to project output
directory when building.
Ignoring `node_modules` is removed **or can be overridden**. I'm open to
any solution which will let me update Nx in my repository.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 21:26:04 -05:00
Jason Jean f33d7e7c96 chore(repo): update nx to 22.3.0-beta.1 (#33873)
Updating Nx from 22.2.0-beta.4 to 22.3.0-beta.1

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-16 17:02:40 -05:00
Jack Hsu cf7ecc9111 fix(core): reduce error rate with dir validation and add more debugging data (#33887)
This PR adds a validation to the directory prompt, so users should not
hit the error as often. Only possible now if they pass the arg from CLI
_and_ they are in non-interactive mode.

We also added some more data to help debug problems, such as node
version, template/preset chosen, etc. And updated the message in
"custom" preset prompt to align with the more effective "full platform"
prompt.

Note: Also update the error message (if it hits) to be the same in new
flow and old flow.

## Related Issue(s)
Closes NXC-3624

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 22:00:24 +00:00
Copilot ffc5f69320 docs(core): document argv in task execution hook contexts (#33322)
The `argv` field was already implemented in `PreTasksExecutionContext`
and `PostTasksExecutionContext` but lacked tests and documentation for
plugin authors to discover and use it.

## Changes

- **Added unit tests**
(`packages/nx/src/daemon/server/handle-tasks-execution-hooks.spec.ts`)
validating that `argv` flows correctly through hook handlers for
different command patterns (direct, affected, run-many)

- **Enhanced existing documentation** in
`astro-docs/src/content/docs/extending-nx/task-running-lifecycle.mdoc`
with a new section covering:
  - Context property definitions showing the `argv` field
- Examples showing how to detect command types (direct execution,
affected, run-many)
- Example demonstrating conditional analytics based on the original
command
  - Common command patterns reference
  - Best practices for defensive argv parsing

## Usage

```typescript
import type { NxPlugin, PostTasksExecutionContext } from '@nx/devkit';

export const myPlugin: NxPlugin = {
  name: 'my-plugin',
  
  postTasksExecution: async (options, context: PostTasksExecutionContext) => {
    // Distinguish between nx build my-app vs nx affected -t build
    if (context.argv.includes('affected')) {
      console.log('Running in affected mode');
    }
  }
};
```

Fixes
https://linear.app/nxdev/issue/NXC-3382/add-contextargv-to-task-execution-hook-contexts

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Issue Title: Add context.argv to task execution hook contexts
> Issue Description: Expose the original CLI arguments on the plugin
worker so hooks can distinguish how execution was started (e.g., `nx
build nx-api` vs `nx affected -t build`). Proposal: include the invoking
argv on the hook context (e.g., `context.argv`).
> Fixes
https://linear.app/nxdev/issue/NXC-3382/add-contextargv-to-task-execution-hook-contexts
> 
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Aha! that worked - so you can tell it to assign to copilot instead of
"me and copilot"
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> 📋 I wasn't able to determine which GitHub repository to work in.
> 
> I think it's one of these, but can you tell me which one is right?
> 
> Comment by User :
> Created issue
[NXC-3382](https://linear.app/nxdev/issue/NXC-3382/add-contextargv-to-task-execution-hook-contexts)
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> This comment thread is synced to a corresponding [thread in
Slack](https://nrwl.slack.com/archives/C070BJ2JYLW/p1761928859857989?thread_ts=1761928859.857989&cid=C070BJ2JYLW).
All replies are displayed in both locations.
> 
> Comment by User :
> This thread is for an agent session with githubcopilot.
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> @Linear make a ticket and assign it to copilot
> 
> Comment by User f5ae6d50-28e9-4ee7-ad51-3da8208d5914:
> Makes sense to me
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Sure, context.argv?
> 
> Comment by User f5ae6d50-28e9-4ee7-ad51-3da8208d5914:
> We can add them as `argv`?
> 
> Comment by User f5ae6d50-28e9-4ee7-ad51-3da8208d5914:
> Yeah they would run on the plugin worker so it's not there
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> @jason we could add `originalArgv` to the contexts?
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Eh, probably not... they run on the plugin worker
> 
> Comment by User 4215f3ef-50bd-4f09-85a0-b489c88057b6:
> Yeah, I don't think the hooks know.... I'd be curious if process.argv
would just have that info though
> 
> Comment by User 439b15a6-827b-4258-971a-d86133ad59de:
> payfit does
> 
> Comment by User 74901385-a023-4825-8470-fe68b1b55664:
> I can’t see anything about that in the docs - so I would assume the
hooks are agnostic to how the tasks were triggered?
> 
> Comment by User 74901385-a023-4825-8470-fe68b1b55664:
> so they’re asking is there’s a way to tell the difference between `nx
build nx-api` or `nx affected -t build` in the task hook?
> 
> Comment by User 74901385-a023-4825-8470-fe68b1b55664:
> > I’ve been playing around with the Task Execution Hooks, specifically
the postTasksExecution hook, and I think it will be really useful for me
to grab some detailed metrics for our specific use cases.
> > What I feel like it’s missing is a way to see what command actually
started the task execution, whether it was a specific target or an
affected command. As long as it was a specific target, I think the tasks
are sorted in order so the last taskResult will probably be the actual
target of the command but for affected it seems a bit more random what
the last result will be.
> > Is there a way to know exactly which command kicked off the ‘task
execution’?
> 
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: AgentEnder <6933928+AgentEnder@users.noreply.github.com>
Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
Co-authored-by: Caleb Ukle <caleb@nrwl.io>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Copilot <Copilot@users.noreply.github.com>
2025-12-16 16:15:17 -05:00
Leosvel Pérez Espinosa 035e0fd872 fix(core): prevent pinning the same task in multiple panes in the tui (#33863)
## Current Behavior

The same task can be pinned in multiple terminal panes of the TUI. This
causes one pane to scroll the other because they share the same data.

## Expected Behavior

The same task can only be pinned in a single terminal pane of the TUI.
2025-12-16 16:09:23 -05:00
Jason Jean 4ebbe9735c fix(web): update e2e test regex for SWC decorator metadata (#33892)
## Current Behavior

The e2e test `should emit decorator metadata when using --compiler=swc`
fails because the regex `/Foo=.*?_decorate/` expects the old transpiled
output format where classes were assigned to variables.

## Expected Behavior

The test should pass by matching the current SWC output format which
uses native ES class syntax.

## Solution

Updated the regex from `/Foo=.*?_decorate/` to `/class
Foo.*_ts_metadata/` which:
- Matches `class Foo` (native ES class syntax)
- Verifies `_ts_metadata` is present (decorator metadata)
2025-12-16 15:53:36 -05:00
Leosvel Pérez Espinosa d61ae25b2a fix(core): display task output in TUI when native command runner is disabled (#33881)
## Current Behavior

When `NX_NATIVE_COMMAND_RUNNER=false` is set, tasks running in the TUI
don't display any output in the terminal pane. The pane remains empty
even though the task is running.

## Expected Behavior

Task output is displayed in the TUI terminal pane regardless of the
`NX_NATIVE_COMMAND_RUNNER` setting.

## Related Issues

Fixes #32803
2025-12-16 15:21:07 -05:00
Caleb Ukle 7d1ea67cf0 chore(repo): remove legacy community/approved-plugins.json file (#33869)
use astro-docs/src/content/approved-community-plugins.json instead. 


Fixes DOC-363

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2025-12-16 15:20:30 -05:00
Caleb Ukle 80501c9848 docs(core): add examples for dependentTasksOutputFiles (#33870) 2025-12-16 15:10:48 -05:00
MaxKless e7758aa6cc cleanup(gradle): fix failing nightly (#33884)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-16 14:32:43 -05:00
Leosvel Pérez Espinosa 71bfc216c3 feat(angular): add migration to set isolateModules: true to jest tsconfig files (#33889)
## Current Behavior

When upgrading to Angular 21 with Jest, users may encounter TypeScript
compilation issues because their `tsconfig.spec.json` files don't have
`isolatedModules: true` set, which is required for compatibility with
Jest and `jest-preset-angular`.

## Expected Behavior

After running `nx migrate`, Angular projects using Jest will
automatically have `isolatedModules: true` added to their
`tsconfig.spec.json` files (or custom test tsconfig files referenced by
`@nx/jest:jest` tasks) if not already set or inherited from a parent
tsconfig.
2025-12-16 19:30:42 +01:00
Louie Weng 4931fbfdad docs(nx-cloud): fix references to metrics enablement (#33888)
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Update references to disablement variable for metrics collection for Nx
Cloud enterprise users.

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-12-16 10:25:02 -08:00
Colum Ferry 497345ab74 chore(misc): add agents.md and gemini to codeowners (#33886) 2025-12-16 17:05:35 +00:00
Colum Ferry 3db0fb2ce9 fix(node): use @swc/helpers instead of tslib when compiler is swc (#33885)
When using `@nx/node:library` generator with `--compiler=swc`, the
generator
was incorrectly adding `tslib` as a dependency instead of
`@swc/helpers`.

This change fixes two issues:
1. Pass the correct bundler (matching the compiler) to
jsLibraryGenerator
so it adds the correct helper dependency to the project's package.json
2. Update ensureDependencies to only add tslib when compiler is tsc

Fixes #31202
2025-12-16 17:02:42 +00:00
Caleb Ukle db33a7b9c9 chore(nx-dev): update agent files (#33883)
update claude/agent.md with info about how to use docs
2025-12-16 11:16:53 -05:00
Tine Kondo af003c1a0c feat(nx-plugin): allow customizing the location of the companion E2E project (#32073)
Fixes #32069

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-16 15:44:13 +00:00
Leosvel Pérez Espinosa 6d34960175 fix(core): add back ability to create cache_outputs table without a foreign key (#33880)
Add back the ability to create the `cache_outputs` table without a
foreign key to `task_details`. Nx Cloud still needs this.
2025-12-16 09:02:35 -05:00
Kasper Christensen 5ccc0a8c4b fix(misc): use string type for fetchDepth in azure-pipelines.yml (#33727)
The Azure Pipelines schema requires fetchDepth to be a string, but the
generator was outputting a number.
This fix changes the value to a string to match the official schema
specification.

## Current Behavior
The generator creates `azure-pipelines.yml` with `fetchDepth: 0`
(number), which causes YAML schema validation error because the Azure
Pipelines schema expects `fetchDepth` to be a string.

According to the [Azure Pipelines
schema](https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json),
`fetchDepth` is defined as:
```json
"fetchDepth": {
    "description": "Depth of Git graph to fetch",
    "$ref": "#/definitions/string"
}
```

## Expected Behavior
The generator should output `fetchDepth: '0'` (string) to match the
schema specification and prevent validation errors.

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2025-12-16 14:00:42 +00:00
Charlie Croom d5bd57e697 fix(core): include PNPM patches in externalDependencies hash computations (#33551)
## Current Behavior
If a workspace uses pnpm and adds a local patch to a dependency (e.g.
`vitest`), this patch is not taken into account when computing that
dependency's hash for purposes of determining cache changes. In
practice, you could patch vitest locally, and tests would pull from the
cache.

## Expected Behavior
Patches can alter behavior in the same way that updating the version
could, it's just that the version is not created and the patch is
applied locally.

This updates the pnpm lockfile parsing functionality to read the patches
field into a map and then combine the patch hash with the integrity
hash. The integrity hash ONLY represents the remote / tarball
intergrity, so these have to be combined in order to create a proper
key.

## Related Issue(s)
(Could not find any, but saw this in my work today)

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-16 13:53:55 +01:00
teawithfruit de966a21c0 fix(js): adjusted stdout and stderr handling to support the latest @swc/cli version (#32685)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Due to this PR https://github.com/swc-project/pkgs/pull/53 at SWC, it is
not possible to use the latest version of @swc/cli in NX.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
stdout and stderr are now handled more precisely, allowing you to update
to the latest version of @swc/cli.

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-16 12:22:08 +00:00
Zachary DeRose 68d4d4e994 fix(js): check package.json for name when project.json exists but has no name (#31887)
## Current Behavior

When a project has a `project.json` file but no `name` field, the
`addBuildAndWatchDepsTargets` function in
`packages/js/src/plugins/typescript/util.ts` returns early without
creating build and watch deps targets, even if the project has a valid
name in its `package.json`.

## Expected Behavior

The function should fall back to checking `package.json` for the project
name when `project.json` exists but has no `name` field, allowing the
build and watch deps targets to be created properly.

## Related Issue(s)

This fixes an issue where projects with `project.json` files missing the
`name` field would not get proper build and watch dependency targets
generated.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-16 11:05:58 +00:00
Craigory Coppola 98e479210d fix(js): detect changes to pnpm.overrides and overrides in package.json (#31914)
## Current Behavior

`getProjectPathsAffectedByDependencyUpdates` in
`@packages/nx/src/plugins/js/project-graph/affected/lock-file-changes.ts`
doesn't return projects affected when updating `pnpm.overrides` or
`overrides` in package.json.

## Expected Behavior

When `overrides`, `resolutions`, or `pnpm.overrides` fields are changed
in package.json, the affected projects should be properly detected and
returned.

## Related Issue(s)

This addresses reports that affected project detection isn't working
properly when package manager override configurations are changed.

## Changes Made

- Enhanced `getTouchedNpmPackages` function to detect changes to
`overrides`, `resolutions`, and `pnpm.overrides` fields
- When a known package is changed in overrides, only that specific
package is marked as affected
- When an unknown package is changed in overrides, all projects are
marked as affected (since overrides can affect transitive dependencies)
- Added comprehensive tests for all override scenarios

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2025-12-16 11:05:37 +00:00
Asif Rahman 28c9673887 docs(storybook): fix incorrect version references in storybook v9 docs (#32727)
### Summary:
This PR updates the Nx documentation for the Storybook migration
generator to ensure clear and accurate guidance for migrating to
Storybook version 9. It replaces outdated references to version 8,
corrects migration links, and updates example configurations for Angular
and React (Vite) projects to reflect Storybook v9. These improvements
help users follow the correct steps and avoid confusion when upgrading
their workspace to the latest major release.

### Key Updates:

- Updated all migration documentation links and text to target Storybook
v9 resources.
- Corrected example .storybook/main.js|ts file descriptions for Angular
and React projects to reference version 9.
[[1]](diffhunk://#diff-2bd0403b5cc6e0c92d83a89400b36d55ad50eb0f82688aa976ecb3c93ff69eceL44-R44)
[[2]](diffhunk://#diff-2bd0403b5cc6e0c92d83a89400b36d55ad50eb0f82688aa976ecb3c93ff69eceL61-R61)
- Ensured users will be directed to the right guides and migration steps
for a smoother upgrade experience.

### Type of Change:
Documentation only; no changes to code or functionality.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
N/A - Docs update

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
N/A - Docs update

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
N/A
2025-12-16 10:25:20 +00:00
Raphael Araújo 45cdecef50 fix(nextjs): accept fileName option to generate page (#30013)
## Current Behavior
The `pageGenerator` has the option `fileName`, but it is not affecting
anything.

## Expected Behavior
The `pageGenerator` has the option `fileName`, it will define the page
file name.
2025-12-16 10:08:23 +00:00
Jason Jean 02b4dbe08b fix(misc): send connectUrl in completion metadata (#33878)
## Current Behavior

The `recordStat` telemetry for `create-nx-workspace` and
`create-nx-plugin` completion events does not include the Nx Cloud
connect URL.

## Expected Behavior

The connect URL (e.g., `https://cloud.nx.app/connect/{shortlinkId}`) is
now included in the completion metadata sent to `/nx-cloud/stats`.

## Related Issue(s)

N/A - Internal telemetry enhancement
2025-12-15 23:31:42 +00:00
Jack Hsu 63306c01ae chore(repo): fix nightlies (#33875)
NODE_VERSION was set only on the mise-action step, so subsequent steps
defaulted to the wrong node version and corepack couldn't create the
pnpm shim.

Also update corepack first, otherwise you might run into intermittent
integrity check issues:
- https://github.com/nodejs/corepack/issues/612
- https://vercel.com/kb/guide/corepack-errors-github-actions

---

  Before (NODE_VERSION at step-level):

  1. mise-action runs with NODE_VERSION=20
    - mise installs Node 20
- mise adds /home/runner/.local/share/mise/installs/node/20.x.x/bin/ to
PATH
2. corepack enable runs - NODE_VERSION is NOT set anymore (step env is
gone)
    - corepack shim calls mise
- mise reads mise.toml template: node = "{{ env['NODE_VERSION'] |
default(value='24.11.0') }}"
    - NODE_VERSION is unset → defaults to 24.11.0
    - mise runs corepack from Node 24's install
    - corepack creates pnpm shim in Node 24's bin directory
  3. pnpm install runs
    - PATH has Node 20's bin (from step 1)
    - pnpm is in Node 24's bin (from step 2)
    - pnpm not found!

  After (NODE_VERSION at job-level):

  1. mise-action runs with NODE_VERSION=20 (from job env)
    - mise installs Node 20, adds its bin to PATH
  2. corepack enable runs - NODE_VERSION=20 is still set
    - corepack shim calls mise
    - mise sees NODE_VERSION=20
    - corepack runs from Node 20's install
    - pnpm shim created in Node 20's bin
  3. pnpm install runs
    - PATH has Node 20's bin ✓
    - pnpm is in Node 20's bin ✓
    - Works!
---

Closes NXC-3620

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 17:36:30 -05:00
Philip Fulcher b9ca315b71 docs(nx-dev): updating blog posts related to Powerpack (#33798) 2025-12-15 17:29:33 -05:00
Jason Jean 2be4dde7ce fix(core): restore linkTaskDetails param for backwards compatibility (#33874)
## Current Behavior

The `linkTaskDetails` parameter was removed from the `NxCache`
constructor in #33843, which broke Nx Cloud since it still passes this
parameter.

## Expected Behavior

The `NxCache` constructor should accept the `linkTaskDetails` parameter
(even if unused) to maintain backwards compatibility with Nx Cloud.

## Related Issue(s)

Fixes
https://github.com/nrwl/nx/commit/ed09ee1daed597b7be60255f0cebe52efdd1ae69#r172894152
2025-12-15 21:19:05 +00:00
Philip Fulcher c5dac1eb95 docs(nx-dev): add changelog for 22.2 (#33795) 2025-12-15 15:06:28 -06:00
Jack Hsu e864b6a266 fix(core): update CNW messaging and remove cancel event from SIGINT (#33872)
Updates CNW messages and removes `cancel` event from being recorded in
SIGINT handler, since it didn't work.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2025-12-15 14:19:46 -05:00
Colum Ferry 68d539c19c fix(module-federation): check port availability before starting remote proxies (#33871)
When multiple MF dev servers run concurrently and share the same remote,
they would both attempt to start proxies on the same port, causing
EADDRINUSE errors.

This fix checks if a port is already in use before attempting to start
a proxy. If the port is occupied (likely by another MF dev server that
started earlier), the proxy is skipped for that remote since it's
already being served.

Uses the existing `waitForPortOpen` utility with retries: 0 to perform
an immediate check.

Fixes #33470
2025-12-15 17:53:34 +00:00
Colum Ferry ae0a47aaf1 docs(misc): clarify dryRun behavior for releasePublish (#33868)
Update the programmatic API documentation to clarify that the dryRun
option for releasePublish does not prevent the underlying commands
from being executed. Instead, it forwards the flag to the executor
and sets the NX_DRY_RUN environment variable.

This makes it clear that:
- The built-in @nx/js:release-publish executor handles dryRun correctly
- Custom nx-release-publish executors must implement dryRun support
themselves

Fixes #33443
2025-12-15 17:01:36 +00:00
Colum Ferry 2516974bd6 docs(release): add independent versioning guidance for publish workflow (#33867)
The publish workflow template was designed for fixed versioning strategy
(where all packages share the same version). This commit adds:

- A callout explaining that the template works best with fixed
versioning
- A new section covering considerations for independent versioning
- Documentation of GitHub's 3-tag event limitation
- Alternative approaches: workflow_dispatch, branch-based triggers, or
batch tag pushing

Fixes #33502
2025-12-15 17:00:45 +00:00
Craigory Coppola 72c47e7452 fix(core): preserve command output in TUI summary for non-cached tasks (#33673)
## Current Behavior

The `printTaskTerminalOutput` callback in the TUI summary life cycle
overwrites terminal output for all tasks when output is provided. This
causes the command line information (the actual command that was run) to
be lost for non-cached tasks because non-cached tasks stream their
output via `appendTaskOutput`, which includes the command information.

## Expected Behavior

For non-cached tasks (those with 'failure' or 'success' status), the
output should be preserved from the streaming via `appendTaskOutput`
which includes the complete command line that was executed. Only cached
tasks should have their output overwritten by `printTaskTerminalOutput`
since they don't go through the streaming path.

## Related Issue(s)

<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2025-12-15 11:50:07 -05:00
Colum Ferry 026756cf80 fix(nest): ensure library is generated with correct outputPath for TS Soln #32060 (#33864)
## Current Behavior
NestJs libraries are generated with output path pointing to workspace
level dist folder. With TS Soln setups, we expect the dist folder to be
local to the project.

## Expected Behavior
Ensure the outputPath generated is correct

## Related Issue(s)

Fixes #32060
2025-12-15 16:29:00 +00:00
Colum Ferry 999d9e32a2 chore(misc): update codeowners to reflect latest ownership (#33860)
Update codeowners
2025-12-15 13:31:19 +00:00
Leosvel Pérez Espinosa ae8612fba6 fix(core): do not invoke prettier with --write and --list-different when unsupported (#33857)
## Current Behavior

`nx format:write` fails with Prettier 4+ (and Prettier 3.6+ with the
experimental CLI enabled) with the error:

```bash
Incompatible options: "write" and "list-different" cannot be used together
```

## Expected Behavior

`nx format:write` works seamlessly across all Prettier versions (2.x,
3.x, and 4.x).

## Related Issue(s)

Fixes #33658 
Fixes #31951

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-12-15 14:22:25 +01:00
Jason Jean c3ace6deba chore(repo): add root Maven and Gradle files to Java reviewers in CODEOWNERS (#33714)
## Current Behavior

Root Maven and Gradle build files (pom.xml, build.gradle.kts,
settings.gradle.kts) are not explicitly assigned to the Java reviewers
in CODEOWNERS.

## Expected Behavior

With this PR, the Java reviewers (@FrozenPandaz @MaxKless @lourw) will
be automatically added as reviewers when changes are made to:
- `/pom.xml` - Root Maven build file
- `/build.gradle.kts` - Root Gradle build file  
- `/settings.gradle.kts` - Gradle settings file

This ensures the Java team has visibility into changes affecting the
root Java build configuration.

## Related Issue(s)

N/A - Maintenance improvement to CODEOWNERS
2025-12-15 08:21:36 -05:00
Rares Matei 099dc7db1a docs(nx-cloud): remove broken on-premise auth-single-admin redirect (#33840)
## Current Behavior

The `/ci/recipes/enterprise/on-premise/auth-single-admin` and
`/ci/recipes/on-premise/auth-single-admin` paths redirect to
`https://github.com/nrwl/nx-cloud-helm`, but the documentation that
should exist at these paths no longer has a target location.

## Expected Behavior

These redirect rules are removed so the broken links don't mislead users
with incorrect redirects.

## Related Issue(s)

Fixes CLOUD-4007
2025-12-15 21:56:25 +09:00
Leosvel Pérez Espinosa b6051f07af fix(angular): install compatible vitest version for angular projects (#33858)
#### Current Behavior

When creating a new Nx workspace with Angular v20 and selecting Vitest
as the unit test runner, the installation fails with an npm peer
dependency conflict:

```bash
npm error ERESOLVE could not resolve
npm error peerOptional vitest@"^3.1.1" from @angular/build@20.3.13
npm error Found: vitest@4.0.15
```

## Expected Behavior

Workspace creation completes successfully when selecting Angular with
Vitest as the unit test runner.

## Related Issue(s)

Fixes #33770
2025-12-15 11:47:51 +01:00
Jonathan Gelin ad5d9b726d fix(release): {releaseGroupName} not interpolated in changelog tag/releaseTagPattern (#33779) 2025-12-14 09:36:34 +00:00
Jason Jean 0a58d4c7f8 fix(repo): install correct Rust target for x86_64 macOS build (#33853)
## Current Behavior

The publish workflow was installing `aarch64-apple-darwin` Rust target
but attempting to build for `x86_64-apple-darwin`, causing the build to
fail with:

```
error[E0463]: can't find crate for `core`
  = note: the `x86_64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-apple-darwin`
```

## Expected Behavior

The workflow should install the correct Rust target
(`x86_64-apple-darwin`) before attempting to build for it.

## Related Issue(s)

N/A - Bug found during publish workflow debugging
2025-12-13 20:55:21 -05:00
Miroslav Jonaš ad7dfe7885 fix(core): improve performance of buildExplicitPackageJsonDependencies (#33791)
Further improvement of the graph creation.

Improving the `buildExplicitPackageJsonDependencies`.

| | Before | After |
| ---- | ----- | ---- |
| buildExplicitPackageJsonDependencies | 128 | 12 |
| isPackageJsonAtProjectRoot | 114 | 1 |

Fixes #

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-13 16:02:17 +00:00
Leosvel Pérez Espinosa ed09ee1dae fix(core): create all tables upfront when creating the database (#33843)
Create all the tables upfront when creating the database. This prevents
some issues in some scenarios where a missing table is reported.
2025-12-12 14:56:29 -05:00
Leosvel Pérez Espinosa 15a7d954fc fix(angular): improve error message when using esbuild-based build targets and generating cypress ct (#33846)
## Current Behavior

When running `nx g @nx/angular:cypress-component-configuration` on an
Angular project that uses esbuild (the default bundler since Angular
17), users receive a confusing error message:

```bash
Unable to find a valid build configuration. Try passing in a target for an Angular app.
```

This doesn't explain why the configuration fails or what the actual
limitation is.

## Expected Behavior

Users now receive a clear, informative error message that explains:
- Cypress Component Testing for Angular requires a webpack-based build
target
- Their project uses an esbuild-based executor (and which one)
- Cypress only supports webpack as the bundler for Angular component
testing

This helps users understand the limitation and make informed decisions
about how to proceed.

## Related Issue(s)

Fixes #33329
2025-12-12 18:36:48 +00:00
Adwait Athale 4ef85ffec2 chore(module-federation): optimize path mappings and remote resolution (#33752)
## Current Behavior

### 1. typescript.ts - readTsPathMappings was O(n²)

The function was spreading the accumulator object on every iteration:

```
┌─────────────────────────────────────────────────────────────┐
│                    BEFORE: O(n²)                            │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  For each path alias (n=100):                               │
│    tsPathMappings.set(tsConfigPath, {                       │
│      ...tsPathMappings.get(tsConfigPath),  ← SPREAD n items │
│      [alias]: paths                                         │
│    });                                                      │
│                                                             │
│  Iteration 1: spread 0 items                                │
│  Iteration 2: spread 1 item                                 │
│  Iteration 3: spread 2 items                                │
│  ...                                                        │
│  Iteration n: spread n-1 items                              │
│                                                             │
│  Total: 0+1+2+...+(n-1) = n(n-1)/2 = O(n²) operations       │
│                                                             │
│  For 100 aliases: 4,950 spread operations                   │
│                                                             │
└─────────────────────────────────────────────────────────────┘
```

### 2. get-remotes-for-host.ts - Multiple inefficiencies

- `Object.keys()` called twice on same object
- `replace()` called twice on same string
- Multiple array spreads for port calculation

## Expected Behavior

### 1. typescript.ts - Now O(n)

```
┌─────────────────────────────────────────────────────────────┐
│                     AFTER: O(n)                             │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  const processedPaths = {};                                 │
│  for (const [alias, paths] of entries) {                    │
│    processedPaths[alias] = paths.map(normalize);            │
│  }                                                          │
│  tsPathMappings.set(tsConfigPath, processedPaths);          │
│                                                             │
│  Total: n iterations, each O(1) = O(n)                      │
│                                                             │
│  For 100 aliases: 100 operations (vs 4,950)                 │
│                                                             │
└─────────────────────────────────────────────────────────────┘
```

### 2. get-remotes-for-host.ts - Optimized

```
┌─────────────────────────────────────────────────────────────┐
│                  OPTIMIZATIONS                              │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐         ┌─────────────────┐            │
│  │ Object.keys(x)  │  ───►   │ const keys =    │            │
│  │ Object.keys(x)  │         │   Object.keys(x)│            │
│  │ (2 calls)       │         │ // use keys     │            │
│  └─────────────────┘         └─────────────────┘            │
│                                                             │
│  ┌─────────────────┐         ┌─────────────────┐            │
│  │ r.replace(...)  │  ───►   │ const norm =    │            │
│  │ r.replace(...)  │         │   r.replace(...)│            │
│  │ (2 calls)       │         │ // use norm     │            │
│  └─────────────────┘         └─────────────────┘            │
│                                                             │
│  ┌─────────────────┐         ┌─────────────────┐            │
│  │ Math.max(       │  ───►   │ for (port of p) │            │
│  │  ...[...a,...b] │         │  if (port>max)  │            │
│  │ )               │         │    max = port   │            │
│  │ (3 arrays)      │         │ (0 extra arrays)│            │
│  └─────────────────┘         └─────────────────┘            │
│                                                             │
└─────────────────────────────────────────────────────────────┘
```

## Why Accept This PR

1. **Significant complexity reduction**: O(n²) → O(n) for path mappings
processing
2. **Zero behavior change**: Test passes, no functional changes
3. **Clean implementation**: Simple refactoring using idiomatic patterns
4. **Complementary to PR #33734**: Optimizes files not touched by that
PR

## Related Issue(s)

Performance improvement for Module Federation path mappings and remote
resolution.

 ## Merge Dependencies

This PR has no dependencies and can be merged independently.

---
2025-12-12 18:21:28 +00:00
James Kraus fe2bf86a8b fix(react): update template comment to be valid css (#33169)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
The `//` comment in the styled template [is not valid
css](https://stackoverflow.com/questions/12298890/is-it-bad-practice-to-prefix-single-lines-of-css-with-as-a-personal-comment-s/20192639#20192639)
and is causing [stylelint](https://stylelint.io/) to throw errors upon
creating new apps

## Expected Behavior
It should be valid css

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

https://github.com/nrwl/nx/issues/33579

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-12 18:20:45 +00:00
Jack Hsu 192099af44 fix(js): resolve nx binary from workspace root in node executor (#33842)
## Current Behavior

When running `nx serve` with a NestJS project (and other node apps using
`runBuildTargetDependencies`), the node executor attempts to resolve the
`nx` binary using `require.resolve('nx')`. This fails with because
`nx/package.json` does no longer has a `main` field.

## Expected Behavior

The node executor should correctly resolve and use the `nx` binary from
the workspace where it's always installed.

This is fixed by using `nx/bin/nx.js` instead of just `nx` -- as we do
in other places.

## Related Issue(s)

Fixes #33776

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 12:59:36 -05:00
Timo Santi 30e6f85b48 fix(js): handle workspace packages when nx.name differs from package.json.name (#33583)
## Current Behavior
<!-- This is the behavior we have today -->

When a workspace library has a `name` field set in its `nx`
configuration (e.g., `"nx": { "name": "buildable" }`), the
`@nx/js:prune-lockfile` executor fails to include transitive
dependencies from that library in the pruned lockfile.

The issue occurs because `addNodesAndDependencies` attempts to retrieve
workspace nodes using `graph.nodes[name]` where `name` is the package
name from `package.json`, but `graph.nodes` is keyed by the project name
(from `nx.name`). When these differ, the lookup fails and transitive
dependencies are not traversed.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The `@nx/js:prune-lockfile` executor should include all transitive
dependencies from workspace libraries regardless of whether the library
has a `name` field set in its `nx` configuration.

The fix uses the workspace node from the `workspacePackages` map (which
is keyed by package name) instead of attempting to look it up in
`graph.nodes` (which is keyed by project name).

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #33582
2025-12-12 12:59:20 -05:00
Leosvel Pérez Espinosa 80523ef09a fix(js): prevent crash when terminating task using the @nx/js:swc executor (#33845)
## Current Behavior

When terminating a task using the `@nx/js:swc` executor before it ever
got to execute its post-compilation logic, a `TypeError: disposeFn is
not a function` error is thrown.

## Expected Behavior

Terminating a task using the `@nx/js:swc` executor should not error.

## Related Issue(s)

Fixes #31938
2025-12-12 17:58:11 +00:00
Leosvel Pérez Espinosa f6189359e6 fix(angular): collect known tsconfig files from non-buildable angular libraries in migration (#33834)
## Current Behavior

The `update-21-2-0/update-module-resolution migration` doesn't process
any tsconfig files of non-buildable libraries.

## Expected Behavior

The `update-21-2-0/update-module-resolution migration` should process
common/known tsconfig files of non-buildable libraries.

## Related Issue(s)

Fixes #33705
2025-12-12 17:50:35 +00:00
Yevhenii Yusenkov 54eed65774 feat(js): improve SWC compilation error logging (#33297)
Currently, when SWC compilation fails, Nx logs only a generic message:

  "SWC compilation failed"

There is no `error.message`, no `stderr` and no `stdout` printed.  
In many cases the actual cause of failure is completely hidden, which
makes debugging very difficult, especially in CI.

This PR improves the logging by printing:

- error.message (or the error itself)
- stderr if available
- stdout if available

This makes SWC failures visible and debuggable again.



## Current Behavior
Only a generic "SWC compilation failed" message is logged. No error
message or stdout are shown.

## Expected Behavior
Include error.message, stderr, and stdout (when available) so developers
can understand and debug failures.
2025-12-12 17:40:56 +00:00
Hamza Khan 7f6db63f91 fix(node): sourceMaps option to sourceMap in webpack config (#33333)
## Current Behavior
when I run the below nx workspace command
nx g @nx/express:app kafka-service --directory=apps/kafka-service
--e2eTestRunner=none

the apps/kafka-service/webpack.config.json is generated with the below
lines

const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
const { join } = require('path');

module.exports = {
  output: {
    path: join(__dirname, 'dist'),
    ...(process.env.NODE_ENV !== 'production' && {
      devtoolModuleFilenameTemplate: '[absolute-resource-path]',
    }),
  },
  plugins: [
    new NxAppWebpackPlugin({
      target: 'node',
      compiler: 'tsc',
      main: './src/main.ts',
      tsConfig: './tsconfig.app.json',
      assets: ["./src/assets"],
      optimization: false,
      outputHashing: 'none',
      generatePackageJson: true,
      sourceMaps: true,
    })
  ],
};

there is no such property in NxAppWebpackPluginOptions called
**sourceMaps**, hence source maps are not generated
the correct property is **sourceMap**


## Expected Behavior
module.exports = {
  output: {
    path: join(__dirname, 'dist'),
    ...(process.env.NODE_ENV !== 'production' && {
      devtoolModuleFilenameTemplate: '[absolute-resource-path]',
    }),
  },
  plugins: [
    new NxAppWebpackPlugin({
      target: 'node',
      compiler: 'tsc',
      main: './src/main.ts',
      tsConfig: './tsconfig.app.json',
      assets: ["./src/assets"],
      optimization: false,
      outputHashing: 'none',
      generatePackageJson: true,
      sourceMap: true,
    })
  ],
};

## Related Issue(s)

Fixes #
2025-12-12 17:40:39 +00:00
Leosvel Pérez Espinosa 8136eaf568 feat(angular): support angular v21 (#33378)
## Current Behavior

Angular v21 is not supported.

## Expected Behavior

Angular v21 should be supported.

## Blockers

### Required

- [x] `jest-preset-angular`:
  - [x] PR: https://github.com/thymikee/jest-preset-angular/pull/3485
- [x] Release:
https://github.com/thymikee/jest-preset-angular/releases/tag/v16.0.0

### Optional

We may release Angular v21 support without waiting for these packages to
support it.

- [ ] NgRx
  - [x] PR: https://github.com/ngrx/platform/pull/5025
  - [ ] Release: N/A
- [ ] Cypress (Component Testing doesn't support Zoneless apps)
  - [ ] PR: https://github.com/cypress-io/cypress/pull/33004
  - [ ] Release: N/A

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-12-12 18:39:13 +01:00
Jack Hsu 6828a36979 fix(core): pass more error detail for CNW (#33844)
We're missing messages and variant when errors happen during CNW. This
will help us track down potential problems.

We also want to know when CNW is cancelled in order to know that we're
not missing any events.
2025-12-12 17:26:08 +00:00
Berend de Boer 32ff9e3532 docs(misc): update description for @berenddeboer/nx-aws-cdk (#33002)
Description update for @berenddeboer/nx-aws-cdk plugin: this has become
self-inferring.

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-12 16:45:55 +00:00
Adwait Athale aeb7122f76 chore(module-federation): consolidate getModuleFederationConfig implementations (#33735)
## Current Behavior

The `getModuleFederationConfig` function is implemented separately in 4
places with 70-80% duplicate code:
- `with-module-federation/webpack/utils.ts` (161 lines)
- `with-module-federation/rspack/utils.ts` (150 lines)
- `with-module-federation/angular/utils.ts` - async version (~80 lines)
- `with-module-federation/angular/utils.ts` - sync version (~80 lines)

Each implementation repeats the same core logic:
1. Get project from graph
2. Get and filter dependencies
3. Share workspace libraries and npm packages
4. Apply eager packages
5. Map remotes

## Expected Behavior

A single shared implementation with framework-specific configuration via
a `FrameworkConfig` interface. Each bundler utility becomes a thin
wrapper that provides its specific configuration.

### Changes

| File | Before | After | Change |
|------|--------|-------|--------|
| `webpack/utils.ts` | 161 lines | 54 lines | -107 lines |
| `rspack/utils.ts` | 150 lines | 51 lines | -99 lines |
| `angular/utils.ts` | 273 lines | 119 lines | -154 lines |
| **NEW** `module-federation-config.ts` | - | 289 lines | +289 lines |

**Net reduction**: 41 lines, with significantly improved maintainability

### New Shared Utility

Created
`packages/module-federation/src/utils/module-federation-config.ts` with:

- `FrameworkConfig` interface for bundler-specific customization
- `ModuleFederationConfigResult` interface for type-safe return values
- `getModuleFederationConfigAsync()` - for webpack/angular async configs
- `getModuleFederationConfigSync()` - for rspack/angular sync configs
- `createDefaultRemoteUrlResolver()` - shared remote URL generation
- Caching for `NX_MF_DEV_SERVER_STATIC_REMOTES` env variable parsing
(performance)

### Benefits

1. **Single source of truth**: Bug fixes and improvements only need to
be made once
2. **Better maintainability**: Framework-specific behavior is clearly
separated via config
3. **Performance**: Added caching for env variable parsing
4. **Type safety**: New interfaces provide better IntelliSense and
compile-time checks
5. **Backward compatible**: All existing exports and behavior preserved

## Related Issue(s)

N/A - This is a refactoring for improved code maintainability and
performance.

## Merge Dependencies

**Must be merged AFTER:** #33734

---
2025-12-12 16:09:28 +00:00
Jay Bell 11992be147 fix(core): swc register base url missing when using tsgo (#33332)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

With the new tsgo `baseUrl` has been completely removed, this breaks
compilation of plugins using swc when calling them with nx due to swc
needing the baseUrl. I patched my company workspace with this fix and it
did resolve it, not sure if its the right fix or what the ramifications
are so happy to discuss that more. Since `baseUrl` is removed in tsgo
(and recommended against in general), we need to find a way to provide
it to swc (potentially through an `.swcrc` alternatively, I tried adding
that to my workspace though and it didn't do anything).

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-12 16:07:35 +00:00
Colum Ferry cf742e7271 fix(expo): set projectRoot to workspaceRoot for Expo SDK 54+ compatibility (#33836)
Expo CLI 54.0.12+ changed how originModulePath is determined in Metro
resolvers - from workspace root to project root. This caused the Nx
custom resolver to double-path modules when resolving workspace
libraries.

This fix:
- Adds projectRoot: workspaceRoot to the Metro config to ensure
  originModulePath remains workspace-relative
- Adds defensive path normalization in pnpmResolver to handle edge cases

Fixes #33597
2025-12-12 16:04:48 +00:00
Mark Lindsey 2a3684b325 docs(nx-cloud): fix self-healing docs to include gitlab and azure devops (#33841)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Self-healing docs only reference being supported for GitHub. 
<!-- This is the behavior we have today -->

## Expected Behavior
We should show instructions for all currently supported vcs providers,
including GitLab and Azure Devops.
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-12 09:43:58 -05:00
Jack Hsu 302905ea9e feat(core): add CnwError class for typed error handling in create-nx-workspace (#33839)
Replace process.exit(1) calls with typed CnwError exceptions for
structured error reporting and telemetry tracking. Update recordStat
meta to use typed JSON objects with named keys instead of arrays.

Examples of what's sent as `meta`.

```
{"type":"start","flowVariant":"1"}
{"type":"complete","flowVariant":"1","setupCIPrompt":"which-ci-provider","setupCloudPrompt":"cloud-v2-remote-cache-visit","nxCloudArg":"skip","nxCloudArgRaw":"","pushedToVcs":"SkippedGit","template":"nrwl/empty-template"}
{"type":"start","flowVariant":"1"}
{"type":"start","flowVariant":"0"}
{"type":"complete","flowVariant":"0","setupCIPrompt":"which-ci-provider","setupCloudPrompt":"enable-caching2","nxCloudArg":"skip","nxCloudArgRaw":"","pushedToVcs":"SkippedGit","template":"custom"}
{"type":"start","flowVariant":"1"}
{"type":"error","errorCode":"DIRECTORY_EXISTS"}
{"type":"start","flowVariant":"1"}
{"type":"error","errorCode":"DIRECTORY_EXISTS"}
{"type":"start","flowVariant":"1"}
{"type":"complete","flowVariant":"1","setupCIPrompt":"which-ci-provider","setupCloudPrompt":"cloud-v2-green-prs-visit","nxCloudArg":"yes","nxCloudArgRaw":"","pushedToVcs":"FailedToPushToVcs","template":"nrwl/empty-template"}
{"type":"start","flowVariant":"1"}
{"type":"complete","flowVariant":"1","setupCIPrompt":"which-ci-provider","setupCloudPrompt":"cloud-v2-fast-ci-visit","nxCloudArg":"yes","nxCloudArgRaw":"","pushedToVcs":"FailedToPushToVcs","template":"nrwl/empty-template"}
{"type":"start","flowVariant":"1"}
{"type":"start","flowVariant":"1"}
{"type":"complete","flowVariant":"1","setupCIPrompt":"which-ci-provider","setupCloudPrompt":"cloud-v2-green-prs-visit","nxCloudArg":"skip","nxCloudArgRaw":"","pushedToVcs":"SkippedGit","template":"nrwl/typescript-template"}
{"type":"start","flowVariant":"1"}
{"type":"error","errorCode":"WORKSPACE_CREATION_FAILED"}
```

Known errors like "directory exists" does not print stack trace:

<img width="1061" height="362" alt="image"
src="https://github.com/user-attachments/assets/8f29f303-3839-4297-b789-d23ac3af6d52"
/>

Another known error (invalid custom preset):

<img width="1091" height="391" alt="image"
src="https://github.com/user-attachments/assets/c7f6e586-42a8-493b-b595-f7d77743683f"
/>

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 09:25:58 -05:00
Andreas Jagiella 85558dce76 fix(rspack): enable build mode for TypeScript checker in TS solution setups (#33447)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When using Nx React Module Federation with Rspack, running `nx run-many
-t e2e` before `nx run-many -t typecheck`, it causes typecheck to fail.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
`nx run-many -t typecheck` should succeed regardless of whether Rspack
(via `nx preview`) was executed before it.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes https://github.com/nrwl/nx/issues/33445
2025-12-12 14:03:27 +00:00
Colum Ferry e588a0e5fb fix(js): make CopyAssetsHandler per-file logs opt-in via verbose mode (#33835)
The CopyAssetsHandler was logging every copied file to the console,
causing noisy output when a project copies many files. This could
cause build errors to be cut off in terminals with scroll limits.

Change logger.log() to logger.verbose() so per-file logging only
appears when --verbose is passed or NX_VERBOSE_LOGGING=true.

Fixes #33521
2025-12-12 13:50:29 +00:00
Colum Ferry ea97487a52 fix(js): display pnpm publish errors without requiring --verbose (#33837)
The release-publish executor was only displaying npm-style errors
(error.summary
and error.detail), but pnpm returns errors with a different format
(error.code
and error.message). This caused pnpm publish errors to be invisible
unless users
passed the --verbose flag.

This fix adds handling for pnpm's error format so that error messages
are
properly displayed to users without requiring --verbose.

Fixes 33537
2025-12-12 13:50:21 +00:00
Aaro Karell 60fffd3c1a feat(js): add option for using tsgo compiler when inferring build and typecheck tasks (#33821)
Adds a 'compiler' option to the @nx/js/typescript plugin configuration,
with options 'tsc' and 'tsgo'. Affects both typecheck and build targets.

## Current Behavior

The `@nx/js/typescript` plugin always uses `tsc` as the compiler, with
no way to use the native `tsgo` preview.

## Expected Behavior

The `@nx/js/typescript` plugin can be configured to use `tsgo` for
building and typechecking.

## Related Issue(s)

Related discussion #32591.
2025-12-12 14:13:01 +01:00
Colum Ferry 1409648739 feat(webpack): add support for merging externals to NxAppWebpackPlugin (#33833)
This pull request introduces a new option to the Nx Webpack plugin that
allows users to control whether the plugin should merge its external
dependencies configuration with any existing Webpack externals
configuration. This provides greater flexibility when customizing how
external dependencies are handled during the build process.

Configuration enhancements:

* Added a new `mergeExternals` boolean option to the
`NxAppWebpackPluginOptions` interface, allowing users to specify whether
to combine the plugin's externals configuration with the existing
Webpack config.
* Updated the logic in `apply-base-config.ts` so that the `externals`
array is set based on the new `mergeExternals` option, defaulting to not
merging unless specified.

---------

Co-authored-by: David Antoon <davidmantoon@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-12-12 12:03:34 +00:00
Jack Hsu b367b5437b fix(core): add pnpm/yarn support for CNW templates (#33827)
Currently the template flow will only set up `npm`, even if you run
`yarn create` or `pnpx create-nx-workspace`. This PR adds support back
for other package managers.
2025-12-11 20:29:11 -05:00
Caleb Ukle 1310ee6f28 docs(misc): mcp client list cleanup (#33826)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2025-12-11 20:09:13 +00:00
Kamenskih Dmitriy 205daee6e6 fix(webpack): interpolate process.env more verbosely to reduce bundle size with DefinePlugin (#30826)
## Current Behavior
When we prepare ENVs for the DefinePlugin, we are creating the
`process.env` object.
For example:
```
// .env
NX_PUBLIC_VALUE1=1
NX_PUBLIC_VALUE2=2
NX_PUBLIC_VALUE3=3
```
As result we will have:
```js
{
   'process.env': {
      "NX_PUBLIC_VALUE1": "1",
      "NX_PUBLIC_VALUE2": "2",
      "NX_PUBLIC_VALUE3": "3"
   }
}
```

As a result, in the final bundle, we will replace process.env with this
object.
The issue:
If I use all 3 values in my application DefinePlugin will inject this
object 3 times, instead of injecting it once.
It will look like that:
```js
const a = {
      "NX_PUBLIC_VALUE1": "1",
      "NX_PUBLIC_VALUE2": "2",
      "NX_PUBLIC_VALUE3": "3"
}.NX_PUBLIC_VALUE1
const b = {
      "NX_PUBLIC_VALUE1": "1",
      "NX_PUBLIC_VALUE2": "2",
      "NX_PUBLIC_VALUE3": "3"
}.NX_PUBLIC_VALUE2
const c = {
      "NX_PUBLIC_VALUE1": "1",
      "NX_PUBLIC_VALUE2": "2",
      "NX_PUBLIC_VALUE3": "3"
}.NX_PUBLIC_VALUE3
```

## Expected Behavior
DefinePlugin injects values instead of env object in each place
```js
const a = "1"
const b = "2"
const c = "3"
```

## Fixes
- fixed this issue for webpack
- fixed this issue for storybook
- fixed this issue for rspack

TLDR:
now we have object like so:
```js
{
    "process.env.NX_PUBLIC_VALUE1": "1",
    "process.env.NX_PUBLIC_VALUE2": "2",
    "process.env.NX_PUBLIC_VALUE3": "3"
}
```

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-11 18:42:14 +00:00
Jonathan Wilbur b6aa097cdc fix(js): recognize NodeNext as ESM (#31508)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
NodeNext is not recognized as ESM. This causes this warning message to
be logged, even when you have `"type": "module",` in the `package.json`
file and are compile TypeScript to `"module": "NodeNext"`.

```
Package type is set to "module" but "cjs" format is included. Going to use "esm" format instead. You can change the package type to "commonjs" or remove type in the package.json file.
```

## Expected Behavior
Don't log this message. It is incorrect.

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-11 16:53:56 +00:00
Nicholas Cunningham 2c043bc670 fix(testing): update jest ci target to forward top level args (#31379)
This pull request refactors the `dependsOn` configuration for Jest
targets in the Nx plugin to improve flexibility and maintainability. The
changes replace string-based dependencies with structured objects,
ensuring better alignment with Nx's target configuration standards.

This PR updates the `dependsOn` configuration for Jest `ciTarget` to
ensure that top-level args are passed on if the parent target has a
dependsOn for other targets.

For example if i pass `nx run-many e2e-ci -- --json
--outputFile=my-test-results.json` the options:
- `--json`
- `--outputFile`

Should be forwarded to the dependent targets.

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-11 15:36:47 +00:00
Jack Hsu 8df9d50061 chore(misc): fix release script to check GITHUB_ACTIONS not NODE_AUTH_TOKEN (#33824)
The check should be for `GITHUB_ACTIONS` since that is the intention.
The token may not be set due to Trusted Publisher flow.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-12-11 09:53:52 -05:00
Guilherme Siquinelli 2917b3e545 fix(vite): update worker configuration in generator to follow Vite's … (#30465)
…new convention

## Current Behavior

Currently, the @nx/vite plugin generates a `vite.config.ts` file where
the worker configuration is commented out, but uses the old format:

```ts
// worker: {
//  plugins: [ nxViteTsPaths() ],
// }
```

If uncomment, this format triggers a warning from Vite, as the worker
configuration should now be a function that returns an array of plugins.
While Vite automatically converts the old format for compatibility, it
is not ideal to rely on this behavior.

## Expected Behavior

With the changes in this PR, the @nx/vite plugin will generate a Vite
configuration where the worker configuration follows the new convention,
avoiding warnings and ensuring compatibility with future versions of
Vite. The updated configuration will look like this:

```ts
// worker: {
//  plugins: () => [ nxViteTsPaths() ],
// }
```

This change ensures that the generated configuration aligns with Vite's
recommended practices and eliminates unnecessary warnings.

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
2025-12-11 15:19:53 +01:00
ResonAtom 0f2c2c4ff8 fix(webpack): show webpack chunks when verbose (#30960)
The NxAppWebpackPlugin option 'verbose' should show chunk output during
webpack build when true, and hide them when false. It's currently the
reverse, causing a lot of console spam during dev, and the hiding the
info during ci/cd.

## Current Behavior
Setting the NxAppWebpackPlugin option 'verbose' to false shows chunk
output.

<img width="848" alt="chunky"
src="https://github.com/user-attachments/assets/4cd5502d-d059-4ace-9e42-28eb160bc1d0"
/>

## Expected Behavior
Setting the NxAppWebpackPlugin option 'verbose' to false hides chunk
output.
2025-12-11 11:26:28 +00:00
Alexey Balmasov 6c2c49cd03 fix(bundling): correct project path for createTmpTsConfig (#31314)
Resolve issue when
projectRoot was created from
join workspaceRoot and projectNode.data.root
but method createTmpTsConfig also make join

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
```
 method withNx create
 const projectRoot = join(workspaceRoot, projectNode.data.root);

```
method createTmpTsConfig 
apply also join
```
  const tmpTsConfigPath = join(
    workspaceRoot,
    'tmp',
    projectRoot,
    process.env.NX_TASK_TARGET_TARGET ?? 'build',
    `tsconfig.generated.${randomUUID()}.json`
  );
```

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #31522
2025-12-11 11:26:09 +00:00
Khalil LAGRIDA 0acce33d4e chore(core): nx plugin submission @gridatek/nx-supabase (#33718) 2025-12-11 11:21:47 +00:00
Svyatoslav Zaytsev db1b8f5a3a feat(testing): add option to playwright preset to open html report (#31282)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
No option to manage opening html report after run.

## Expected Behavior
Added option to manage opening html report after run.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-11 12:03:33 +01:00
Altan Stalker 620f6ea0ad chore(repo): lock default node version to 24.11.0 (#33801) 2025-12-11 14:08:57 +04:00
Caleb Ukle c4af67343f docs(misc): add nx-mcp reference page (#33767)
fixes: DOC-341

https://deploy-preview-33767--nx-docs.netlify.app/docs/reference/nx-mcp

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2025-12-10 15:54:01 -06:00
Jason Jean 4147b62a16 fix(repo): revert to older nightly Rust for WASM builds (#33797)
## Current Behavior

The nightly-2025-12-10 Rust version removed `mtim()` from the WASI
`MetadataExt` trait, causing the WASM build to fail with:

```
error[E0599]: no method named `mtim` found for reference `&std::fs::Metadata` in the current scope
```

## Expected Behavior

WASM builds should compile successfully.

## Solution

Revert to `nightly-2025-05-09` which still has the `mtim()` API
available in the WASI `MetadataExt` trait.
2025-12-10 16:18:35 -05:00
Jason Jean 6cdbeb6e1a fix(repo): use RUSTUP_TOOLCHAIN env var for WASM builds (#33794)
## Current Behavior

The `build:wasm` script uses `rustup override set nightly-2025-12-10` to
set the Rust toolchain. However, when mise is configured to manage Rust
(e.g., `rust = "1.90.0"` in `mise.toml`), it sets the `RUSTUP_TOOLCHAIN`
environment variable which has higher precedence than directory
overrides.

This causes the WASM build to fail with:
```
error[E0554]: `#![feature]` may not be used on the stable release channel
```

## Expected Behavior

WASM builds should use nightly Rust regardless of mise configuration.

## Solution

Set `RUSTUP_TOOLCHAIN=nightly-2025-12-10` directly in the script, which
overrides any existing env var from mise or other sources.
2025-12-10 14:57:27 -05:00
Caleb Ukle be035dce59 docs(misc): add reference for Nx Console settings (#33363)
## Current Behavior

The Nx Console settings reference lacks explanation of VSCode's user vs
workspace settings and incorrectly states that Project Viewing Style is
unavailable in JetBrains IDEs.

## Expected Behavior
Nx consoles are documented for vscode/jetbrains editors


https://deploy-preview-33363--nx-docs.netlify.app/docs/reference/nx-console-settings

fixes: DOC-315

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-10 19:15:13 +00:00
Jason Jean 0d7ecb937b fix(repo): install nightly Rust for WASM build in publish workflow (#33792)
## Current Behavior

After the mise migration (#33772), the `publish.yml` workflow fails
during the "Build Wasm" step with:

```
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> packages/nx/src/lib.rs:2:33
  |
2 | #![cfg_attr(target_os = "wasi", feature(wasi_ext))]
```

The WASM build requires nightly Rust because it uses the unstable
`wasi_ext` feature. The `build:wasm` script attempts to switch to
nightly via `rustup override set`, but after the mise migration, the
nightly toolchain is no longer pre-installed, causing the build to fail
with the stable compiler.

## Expected Behavior

The WASM build should successfully compile using nightly Rust with the
`wasi_ext` feature.

## Related Issue(s)

Fixes the publish workflow regression introduced in #33772
2025-12-10 14:08:45 -05:00
Miroslav Jonaš 72d91de8c4 fix(core): improve node creation for pnpm parser (#33788)
| | Before | After |
| ---- | ----- | ---- |
| Total createNodes | 812 | 104 |
| Total matchPropValue | 672 | 2 |

## Current Behavior
The `createNode` function is slow for pnpm due to suboptimal
`matchPropValue` function.

## Expected Behavior
The `createNode` function should be fast and not slowdown the graph
creation.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-10 13:54:27 -05:00
Leosvel Pérez Espinosa 04bd4dfdab fix(core): ensure terminalOutput is always a string in task results (#33782)
## Current Behavior

When some tasks fail during execution, it can result in a cryptic:

```bash
Failed to convert JavaScript value 'Undefined' into rust type 'String'
```

This happens because the reported `terminalOutput` for the errored tasks
can be `undefined`, and it hides the actual error that occurred.

## Expected Behavior

Error handling paths should always provide a valid string for
`terminalOutput`, using the error stack/message, or an empty string as a
fallback.

## Related Issue(s)

Fixes #32675
2025-12-10 13:25:09 -05:00
Jason Jean 33c3adaa15 fix(repo): restore mise tools in e2e-matrix workflow (#33785)
## Current Behavior

The inline `mise_toml` config in `e2e-matrix.yml` was overwriting the
entire `mise.toml` file, causing rust, dotnet, bun, and java to NOT be
installed by mise. This resulted in slow package installs as these tools
were downloaded during `pnpm install` instead.

## Expected Behavior

All tools from `mise.toml` (rust, dotnet, bun, java) should be installed
by mise, with only the node version varying based on the matrix.

## Solution

Use mise's template syntax to make node version configurable via
`NODE_VERSION` env var while preserving all other tools from
`mise.toml`:

```toml
node = "{{ env['NODE_VERSION'] | default(value='24') }}"
```

Then in the workflow, set the env var instead of overriding the entire
config:

```yaml
- name: Setup dev tools with mise
  uses: jdx/mise-action@v3
  env:
    NODE_VERSION: ${{ matrix.node_version }}
```

## Related Issue(s)

Fixes slow install times in nightly e2e-matrix workflow after #33772.
2025-12-10 11:46:59 -05:00
Jason Jean b2219f2cd0 fix(repo): fix dotnet installation on Windows (#33786)
## Current Behavior

The mise vfox-dotnet plugin fails on Windows with:
```
mise ERROR Failed to install vfox:mise-plugins/vfox-dotnet@9:
     0: error converting Lua table to PreInstall (no version returned from vfox plugin)
```

This prevents dotnet from being installed via mise on Windows CI
runners.

## Expected Behavior

Dotnet should install successfully on all platforms including Windows.

## Related Issue(s)

Related upstream issue: https://github.com/jdx/mise/discussions/4738

## Solution

1. **mise.toml** - Made dotnet installation conditional on Linux/macOS
only using the `os` option
2. **.github/workflows/publish.yml** - Added `winget install` to install
.NET SDK 9 on Windows CI runners

This approach works around the buggy vfox plugin by using the native
Windows package manager instead.
2025-12-10 11:46:50 -05:00
Leosvel Pérez Espinosa eb6712e738 fix(angular): process only the in progress entry points in ng-packagr-lite's write bundles transform function (#33784)
## Current Behavior

When building Angular libraries with `ng-packagr` >20.3.0, the build
fails with:

```bash
TypeError: Cannot read properties of undefined (reading 'outputCache')
```
This occurs because `ng-packagr` v20.3.1 introduced a memory
optimization
([ng-packagr#3172](https://github.com/ng-packagr/ng-packagr/pull/3172))
that calls `dispose()` on entry points after they're processed, setting
`entry.cache = undefined`.

Nx's custom `writeBundlesTransform` was iterating over **all** entries
in the graph, including already-disposed entry points, causing the crash
when accessing their cache.

## Expected Behavior

Angular library builds should succeed with `ng-packagr` >20.3.0,
including libraries with secondary entry points. Workspaces using lower
versions of `ng-packagr` should remain unaffected.

## Solution

Align with `ng-packagr`'s own pattern by using
`graph.find(isEntryPointInProgress())` to process only the currently
in-progress entry point, rather than iterating over all graph entries.

**Key changes:**

- Use `isEntryPointInProgress()` instead of iterating all entries with
`isEntryPoint()`
- Remove unused `BuildGraph` import (no longer creating a new graph)
- Update package node only when processing the primary entry point (more
efficient)
- Return nothing from the transform (original graph passes through, same
as ng-packagr)

This approach:

- Matches `ng-packagr`'s `writeBundlesTransform` implementation pattern
- Only accesses cache of the in-progress entry point (guaranteed not to
be disposed)
- Works with all supported `ng-packagr` versions (v19+) since
`isEntryPointInProgress()` has been available since v19

## Related Issue(s)

Fixes #33560
2025-12-10 17:13:24 +01:00
Jack Hsu e4b9e5822d fix(core): fix record stat on initial CNW call (#33783)
This PR fixes an issue with CNW where the initial `recordStat` call is
not working due to a logic error on passing `directory` that isn't
initialized yet.
2025-12-10 10:48:19 -05:00
Miguel 8da37b04f3 fix(core): exit with error when generator prompts fail (#33691)
## Current Behavior

If there are issues with values passed to generators via prompt, we
still see a green output and exit code 0.

A colleague found out about this by pressing `Ctrl+C` when being
prompted for parameters for a generator, and this led to the CLI simply
continuing execution and showing no issue.

## Expected Behavior

CLI fails.
2025-12-10 16:45:02 +01:00
Andrew Ovens 691a64532b feat(core): add NX_DEFAULT_OUTPUT_STYLE env var (#33493)
Allows setting a default output style instead of having to include it on
every command

Closes #27490

## Current Behavior
We must specify --outputStyle on every command

## Expected Behavior
Should allow overriding the default with an environment variable

## Related Issue(s)
#27490

Fixes #27490
2025-12-10 12:22:46 +01:00
Ashish Shanker cc369a3e11 fix(core): set max listeners for process in task orchestrator (#33596)
When 8+ dependent tasks exist, each adds an `exit` listener to track
completion. This listener attaches to `process`. So we apply the same
fix that worked for `stdout` and `stderr`, and was merged through [PR
16693](https://github.com/nrwl/nx/pull/16993)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
For `nx` targets with 8+ dependent targets, we encounter
`maxListenersExceededWarning`:
```
(node: 22553) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit.
(node: 22553) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGTERM listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit.
(node: 22553) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit.
```
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
No `MaxListenersExceededWarning` should be thrown on account of the nx
run.
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #32439

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-10 11:45:13 +01:00
Adwait Athale badc998c65 fix(core): share visited Set across affected graph traversal (#33756)
## Current Behavior

In `filterAffectedProjects`, a **new visited Set is created for each
touched project**:

```typescript
ctx.touchedProjects.forEach((p) => {
  addAffectedNodes(p, reversed, result, new Set());  // NEW Set per project!
});
ctx.touchedProjects.forEach((p) => {
  addAffectedDependencies(p, reversed, result, new Set());  // NEW Set per project!
});
```

This defeats the purpose of the visited Set for deduplication. If
projects A and B both depend on shared project C, then C gets visited
**twice**.

## Expected Behavior

Share a single visited Set across all touched projects:

```typescript
const visitedNodes = new Set<string>();
const visitedDeps = new Set<string>();
for (const p of ctx.touchedProjects) {
  addAffectedNodes(p, reversed, result, visitedNodes);  // SHARED Set
}
for (const p of ctx.touchedProjects) {
  addAffectedDependencies(p, reversed, result, visitedDeps);  // SHARED Set
}
```

## Performance Impact

```
Before (separate Sets):              After (shared Sets):
┌─────────────────────────┐         ┌─────────────────────────┐
│  touchedProjects: [A,B] │         │  touchedProjects: [A,B] │
└───────────┬─────────────┘         └───────────┬─────────────┘
            │                                   │
    ┌───────┴───────┐                   ┌───────┴───────┐
    ▼               ▼                   ▼               ▼
┌───────┐       ┌───────┐           ┌───────┐       ┌───────┐
│ A     │       │ B     │           │ A     │       │ B     │
│visited│       │visited│           │       │       │       │
│= {}   │       │= {}   │           │ shared visitedNodes   │
└───┬───┘       └───┬───┘           └───┬───┘       └───┬───┘
    │               │                   │               │
    ▼               ▼                   ▼               ▼
┌───────┐       ┌───────┐           ┌───────────────────────┐
│visit C│       │visit C│           │ visit C (ONCE)        │
│(dup!) │       │(dup!) │           │ skip C from B         │
└───────┘       └───────┘           └───────────────────────┘

Complexity:                         Complexity:
O(touched × shared_deps)            O(total_nodes)
```

**Example**: With 50 touched projects sharing 100 common dependencies:
- Before: 50 × 100 = 5,000 node visits
- After: ~150 node visits (each node visited once)

## Why Accept This PR

1. **Bug-like behavior**: The current code defeats the purpose of the
visited Set
2. **Significant impact**: Affects every `nx affected` command
3. **Zero risk**: Same traversal logic, just shared deduplication
4. **Common scenario**: Monorepos often have shared dependencies (utils,
types, etc.)
## Related Issue(s)

Contributes to #32265

## Merge Dependencies

This PR has no dependencies and can be merged independently.

---

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-10 10:21:44 +01:00
Adwait Athale 58a69f99b1 fix(core): optimize pnpm lockfile parsing with pre-built indexes (#33750)
## Current Behavior

When parsing pnpm lockfiles to build the project graph:

### matchPropValue function
- Uses separate `Object.values()` + `Object.keys()` iterations
- Two passes over the same data to find a value and get its key

### Hoisted Dependencies Lookup
- For each package, calls `Object.keys(hoistedDeps).find(k =>
k.startsWith(...))`
- O(n) search performed m times = O(n*m) total

## Expected Behavior

### Single-pass Iteration

```
BEFORE: matchPropValue
┌─────────────────────────────────────────────────────────────┐
│  const index = Object.values(record).findIndex(v === key)   │
│  if (index > -1)                                            │
│    return Object.keys(record)[index]  ← Another iteration!  │
│                                                             │
│  = 2 iterations over the same data                          │
└─────────────────────────────────────────────────────────────┘

AFTER: Object.entries() single pass
┌─────────────────────────────────────────────────────────────┐
│  for (const [name, version] of Object.entries(record)) {    │
│    if (version === key) return name  ← Early exit           │
│  }                                                          │
│                                                             │
│  = 1 iteration with early exit on match                     │
└─────────────────────────────────────────────────────────────┘
```

### Pre-built Index for Hoisted Dependencies

```
BEFORE: O(n*m) Hoisted Lookup
┌─────────────────────────────────────────────────────────────┐
│  for each package (n packages):                             │
│    Object.keys(hoistedDeps).find(k => k.startsWith(...))    │
│    ← O(m) search where m = hoisted deps                     │
│                                                             │
│  Total: O(n * m)                                            │
│                                                             │
│  Example: 500 packages × 200 hoisted deps                   │
│         = 100,000 string comparisons                        │
└─────────────────────────────────────────────────────────────┘

AFTER: Pre-built Index Map O(n+m)
┌─────────────────────────────────────────────────────────────┐
│  Build hoistedKeysByPackage Map once:  O(m)                 │
│    Map<packageName, hoistedKey>                             │
│                                                             │
│  for each package (n packages):                             │
│    hoistedKeysByPackage.get(packageName)  O(1)              │
│                                                             │
│  Total: O(n + m)                                            │
│                                                             │
│  Example: 500 packages + 200 hoisted deps                   │
│         = 700 operations (vs 100,000)                       │
└─────────────────────────────────────────────────────────────┘
```

## Impact

For large pnpm monorepos:

| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| matchPropValue iterations | 2 | 1 | 50% fewer iterations |
| Hoisted lookup complexity | O(n×m) | O(n+m) | ~100x for large repos |
| String comparisons | n×m | n+m | Dramatic reduction |

## Related Issue(s)

Contributes to #32669, #32254

## Merge Dependencies

This PR has no dependencies and can be merged independently.

**Must be merged BEFORE:** #33751

---
2025-12-10 10:20:49 +01:00
Khalil LAGRIDA 6feae2e1fb docs(misc): update github username (#32652)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

Co-authored-by: khalilou88 <32600911+khalilou88@users.noreply.github.com>
Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-10 07:31:57 +00:00
Joe Prisk bff97e01cb feat(rspack): add support for cssFilename config #32498 (#32506)
## Current Behavior
Passing cssFilename does not change the outputted css bundle

## Expected Behavior
Specifying cssFilename in the rspack.config will be honoured by
@nx/rspack

## Related Issue(s)
https://github.com/nrwl/nx/discussions/32498

Co-authored-by: Joe Prisk <joe.prisk@elmosoftware.com.au>
Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-10 08:18:34 +01:00
Jason Jean 029df7a649 chore(repo): migrate GitHub workflows to use mise for dev tools (#33772)
## Summary

Migrates GitHub workflows to use [mise](https://mise.jdx.dev/) for
managing development tool installations instead of individual setup
actions.

## Changes

- **mise.toml**: Added pnpm@10.11.1 to tool configuration
- **ci.yml**: Replaced pnpm, node, rust, and java setup actions with
`mise-action@v3` in both Linux and macOS jobs
- **e2e-matrix.yml**: Replaced all tool setup actions with mise-action
in preinstall and e2e jobs
- **publish.yml**: Replaced tool setup actions with mise-action in build
and publish jobs
- **codeql workflows**: Updated to use `mise-action@v3`

## Benefits

- **Single source of truth**: All tool versions defined in `mise.toml`
- **Faster CI setup**: Mise provides better caching than individual
actions
- **Consistency**: Same tool versions across local dev and CI
- **Easier maintenance**: Update versions in one place

## Test Plan

- [ ] CI workflow passes on Linux
- [ ] CI workflow passes on macOS
- [ ] E2E matrix builds successfully
- [ ] Publish workflow can run (test with dry-run if possible)
- [ ] CodeQL scans complete successfully

Fixes #ISSUE_NUMBER
2025-12-09 16:08:01 -05:00
Philip Fulcher 7342e603b3 docs(nx-dev): update 22.1 release article (#33773) 2025-12-09 14:03:48 -06:00
Colum Ferry 60920310c0 docs(vitest): add guide on testing without building deps (#33769)
## Current Behavior
We do not have a guide showing how to use Vitest with custom conditions

## Expected Behavior
Add a guide showing how to use Vitest with custom conditions
2025-12-09 16:16:25 +00:00
Jack Hsu 22c0f002fd docs(nx-dev): add search and filter controls to plugin registry (#33765)
The Plugin Registry page in astro-docs displays a static grid of plugins
without any search or filtering capabilities, making it hard to find
specific plugins.

Users can search plugins by name or description, and sort by release
date, npm downloads, GitHub stars, or Nx version compatibility.

<img width="975" height="1059" alt="image"
src="https://github.com/user-attachments/assets/a08e2a12-697e-4e3b-b9c0-2983d50fdad8"
/>


Closes DOC-343

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2025-12-09 11:00:06 -05:00
Kasper Christensen cb5510d277 fix(storybook): conditionally include node imports only for non-angular frameworks (#33728)
## Current Behavior
The fileURLToPath and dirname imports are only used in the
getAbsolutePath function, which is only generated for non-Angular
Storybook projects.

## Expected Behavior
This change prevents unnecessary imports from being added to Angular
Storybook configurations.
2025-12-09 11:00:44 +00:00
Adwait Athale 68783a9c78 fix(module-federation): normalize workspace protocol versions in requiredVersion (#33733)
## Current Behavior

When using pnpm with workspace protocol (`workspace:*`, `workspace:^`,
etc.), module federation sets `requiredVersion` to the raw protocol
string (e.g., `workspace:*`) instead of resolving it to the actual
semver version from the library's package.json.

This causes issues like:
- `requiredVersion: "workspace:*"` which is not a valid semver
- Module federation failing to properly share workspace libraries
- Warnings about unable to find required versions

Example of the broken output:
```json
{
  "version": "*",
  "singleton": true,
  "requiredVersion": "^*"
}
```

## Expected Behavior

When a workspace protocol version is detected, it should be resolved to
the actual version from the library's package.json:

```json
{
  "version": "2.0.0",
  "singleton": true,
  "requiredVersion": "2.0.0"
}
```

## Changes Made

1. **Added helper functions** in `share.ts`:
- `isWorkspaceProtocolVersion()` - Detects workspace protocol versions
(`workspace:*`, `workspace:^`, `*`, `file:`)
- `normalizeWorkspaceProtocolVersion()` - Resolves protocol versions to
actual semver by looking up the library's package.json

2. **Applied normalization in `shareWorkspaceLibraries()`**:
- After getting version from `getDependencyVersionFromPackageJson`,
normalize it if it's a workspace protocol
- Simplified the `workspaceLibrariesAsDeps` loop by using the helper
function (removed duplicated logic)

3. **Updated `getNpmPackageSharedConfig()`**:
- Added a check to warn and return undefined when workspace protocol
versions are passed
- Helps users understand that workspace libraries should be configured
properly

4. **Added comprehensive tests** (13 new tests):
- 6 tests for workspace protocol version normalization in
`shareWorkspaceLibraries`
- 7 tests for `getNpmPackageSharedConfig` handling workspace protocol
versions

## Related Issue(s)

Fixes #31397

## Merge Dependencies

This PR has no dependencies and can be merged independently.

**Must be merged BEFORE:** #33734

---
2025-12-09 10:23:34 +00:00
Jason Jean 52e2995917 chore(repo): update nx to 22.2.0-beta.4 (#33722)
Updating Nx from 22.2.0-beta.3 to 22.2.0-beta.4

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2025-12-08 17:07:27 -05:00
Adwait Athale 5d597ee55c fix(js): use Set for O(1) package.json root lookup (#33757)
## Current Behavior

In `buildExplicitPackageJsonDependencies`, for every file in the project
file map, we call `isPackageJsonAtProjectRoot` which uses
`Array.find()`:

```typescript
function isPackageJsonAtProjectRoot(nodes, fileName) {
  return (
    fileName.endsWith('package.json') &&
    nodes.find((projectNode) =>  // O(n) lookup per file!
      joinPathFragments(projectNode.root, 'package.json') === fileName
    )
  );
}
```

This is O(files × projects) complexity.

## Expected Behavior

Build a Set of valid package.json paths once, then use O(1) Set lookup:

```typescript
const projectPackageJsonPaths = new Set(
  Object.values(ctx.projects).map((project) =>
    joinPathFragments(project.root, 'package.json')
  )
);

// Later: O(1) lookup
if (projectPackageJsonPaths.has(f.file)) { ... }
```

## Performance Impact

```
Before (Array.find per file):       After (Set.has):
┌─────────────────────────┐         ┌─────────────────────────┐
│ For each file:          │         │ Build Set once:         │
│   nodes.find(...)       │         │   O(projects)           │
│   O(projects) per file  │         └───────────┬─────────────┘
└───────────┬─────────────┘                     │
            │                                   ▼
            ▼                         ┌─────────────────────────┐
┌─────────────────────────┐         │ For each file:          │
│ Total: O(files×projects)│         │   Set.has(f.file)       │
└─────────────────────────┘         │   O(1) per file         │
                                    └───────────┬─────────────┘
                                                │
                                                ▼
                                    ┌─────────────────────────┐
                                    │ Total: O(files+projects)│
                                    └─────────────────────────┘
```

**Example**: With 5,000 files and 200 projects:
- Before: 5,000 × 200 = 1,000,000 comparisons (worst case)
- After: 200 (build Set) + 5,000 (lookups) = 5,200 operations

## Additional Changes

- Replaced `forEach` with `for...in/of` loops
- Removed unused `isPackageJsonAtProjectRoot` function
- Removed unused `ProjectConfiguration` import
- Net reduction of 7 lines

## Why Accept This PR

1. **Significant complexity reduction**: O(n²) → O(n)
2. **Hot path**: Called during dependency graph construction for every
file
3. **Cleaner code**: Removed unused function, fewer lines

## Related Issue(s)

Contributes to #32265

## Merge Dependencies

This PR has no dependencies and can be merged independently.

---
2025-12-08 16:52:12 -05:00
Louie Weng e6a5a7ed84 fix(gradle): do not add gradle plugin to plugins block if using version catalogs (#33763)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
We would add the gradle project graph plugin to your build.gradle files
if we did not already detect it. However, this did mechanism did not
recognize aliases for the project graph plugin that came from version
catalogs.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

When adding the project graph plugin to build.gradle.kts, we check if a
version catalogue exists, and if it does we add the alias for the
project graph plugin.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-12-08 15:09:14 -05:00
Adwait Athale 300493ec0b fix(core): use Set for O(1) visited node lookup in hasPath (#33754)
## Current Behavior

The `hasPath` function in `graph.ts` uses an array with `indexOf()` for
tracking visited nodes during recursive graph traversal:

```typescript
function hasPath(graph, target, node, visited: string[]) {
  for (let d of graph.dependencies[node] || []) {
    if (visited.indexOf(d.target) > -1) continue;  // O(n) lookup
    visited.push(d.target);
    // recursive call...
  }
}
```

This results in O(n) lookups per node visited, making worst-case
traversal O(n²).

## Expected Behavior

Use `Set` for O(1) visited node tracking:

```typescript
function hasPath(graph, target, node, visited: Set<string>) {
  for (const d of graph.dependencies[node] || []) {
    if (visited.has(d.target)) continue;  // O(1) lookup
    visited.add(d.target);
    // recursive call...
  }
}
```

## Performance Impact

```
Before (Array + indexOf):              After (Set + has):
┌─────────────────────────┐           ┌─────────────────────────┐
│   hasPath() called      │           │   hasPath() called      │
└───────────┬─────────────┘           └───────────┬─────────────┘
            │                                     │
            ▼                                     ▼
┌─────────────────────────┐           ┌─────────────────────────┐
│ visited.indexOf(target) │           │  visited.has(target)    │
│      O(n) lookup        │           │      O(1) lookup        │
└───────────┬─────────────┘           └───────────┬─────────────┘
            │                                     │
            ▼                                     ▼
┌─────────────────────────┐           ┌─────────────────────────┐
│   visited.push(target)  │           │   visited.add(target)   │
│        O(1)             │           │        O(1)             │
└───────────┬─────────────┘           └───────────┬─────────────┘
            │                                     │
            ▼                                     ▼
    Complexity: O(n²)                     Complexity: O(n)
    for full traversal                    for full traversal
```

**Example with 500 nodes:**
- Before: 500 nodes × avg 250 indexOf lookups = ~125,000 comparisons
- After: 500 nodes × 1 Set lookup each = 500 operations

## Why Accept This PR

1. **Zero risk**: Same semantics, just faster data structure
2. **Standard pattern**: Set is the idiomatic choice for visited
tracking in graph algorithms
3. **Measurable impact**: Graph filtering with `--focus` flag will be
significantly faster on large monorepos
## Related Issue(s)

Contributes to #32265

## Merge Dependencies

This PR has no dependencies and can be merged independently.

---
2025-12-08 14:03:23 -05:00
Philip Fulcher c6b2a26156 docs(nx-dev): add december 2025 webinar (#33760) 2025-12-08 14:52:54 +00:00
Louie Weng 60d019e0c7 Revert "docs(nx-cloud): update resource usage minimum version to 22.2" (#33725)
Reverts nrwl/nx#33723
2025-12-05 19:18:48 +00:00
Philip Fulcher 6c2c50d84c docs(nx-dev): update youtube link in resource usage article (#33724) 2025-12-05 18:22:26 +00:00
Louie Weng f70a9c1cc7 docs(nx-cloud): update resource usage minimum version to 22.2 (#33723)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Correcting docs to mention that resource collection on Nx Cloud will be
availabe from 22.2 onwards.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-05 17:32:26 +00:00
Philip Fulcher 3cd1c73d3d docs(nx-dev): add resource usage article (#33721)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: philipjfulcher <philipjfulcher@users.noreply.github.com>
2025-12-05 10:31:43 -06:00
Colum Ferry 19e6404eb5 fix(release): ensure --preid flag considers stable tags for version determination (#33703)
When using `nx release version --preid=alpha`, the version determination
now correctly considers both prerelease tags AND stable release tags to
determine the "latest" version. Previously, it would only look at
prerelease tags matching the preid, ignoring stable releases that should
have become the new baseline.

For example, with tags: 1.1.0, 1.1.0-alpha.0, 1.1.0-alpha.1, 1.1.1
- Before: Would return 1.1.0-alpha.1 → bump to 1.1.0-alpha.2
- After: Returns 1.1.1 (stable >= preid base) → bump to 1.1.2-alpha.0

Fixes #33343
2025-12-05 12:28:01 +00:00
Colum Ferry f0252323f8 fix(misc): update output location of ai-migration files (#33696)
Place `ai-migration` files into `tools/ai-migrations`
2025-12-04 17:42:10 -05:00
Jason Jean 71bfd7eb7e feat(maven): update Maven plugin version to 0.0.11 (#33713)
## Current Behavior

The Maven plugin version is currently at 0.0.10 across all pom.xml files
in the repository.

## Expected Behavior

With this PR, the Maven plugin version will be updated to 0.0.11. This
includes:
- Updating the version in the root pom.xml
- Updating the version in packages/maven/maven-plugin/pom.xml
- Updating the mavenPluginVersion constant in
packages/maven/src/utils/versions.ts
- Adding a migration script to automatically update user pom.xml files
from 0.0.10 to 0.0.11

## Related Issue(s)

N/A - Version bump for the Maven plugin
2025-12-04 17:35:01 -05:00
Jack Hsu 2fdf5b278d chore(repo): add debug logging to hanging webpack e2e tests (#33712)
Webpack e2e tests occasionally hang in CI without clear indication of
where the test gets stuck.

Debug logs will help identify which step the test hangs at, making it
easier to diagnose and fix the root cause.

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 17:02:17 -05:00
Louie Weng 0f45aaff8a chore(gradle): bump version to 0.1.10 (#33711)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Current gradle plugin version is at 0.1.9

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Take gradle plugin to 0.1.10

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-12-04 21:31:36 +00:00
Jason Jean 4627345d4e chore(repo): update nx to 22.2.0-beta.3 (#33706)
Updating Nx from 22.2.0-beta.2 to 22.2.0-beta.3
2025-12-04 20:43:21 +00:00
Jack Hsu e807320d74 docs(nx-dev): add global Cmd+K search shortcut for non-docs pages (#33709)
Pressing Cmd+K (or Ctrl+K) on non-docs pages does nothing. The Pagefind
search is only accessible when already on the documentation pages.

Pressing Cmd+K on any non-docs page redirects to the docs and
automatically opens the search modal with focus on the input field.


https://www.loom.com/share/72fcee74620640cab28639e9ad33d962


Closes DOC-314

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 14:57:23 -05:00
Jason Jean 0f24bf559d chore(repo): update ocean repo to use pnpm (#33707)
## Current Behavior

The `tools/update-repos/config/repos.json` configuration has the ocean
repository set to use `npm` as its package manager.

## Expected Behavior

The ocean repository should be configured to use `pnpm` as its package
manager, reflecting the actual package manager used by the repository.

## Related Issue(s)

N/A - Configuration update to reflect actual repository state.
2025-12-04 14:30:18 -05:00
Jack Hsu aba0eb280d fix(core): cnw sends correct selectedRepositoryName; prints instructions when user Ctrl+C (#33699)
This PR adds `SIGINT` handling when user kills the process via `Ctrl+C`
during CNW. This only prints when the workspace setup is complete, and
we also print the Cloud onboarding URL if it has been set up.

Also fixes an issue where `selectedRepositoryName` is never sent during
CNW.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-04 14:27:49 -05:00
Benjamin Cabanes ba2c982ae8 docs(nx-dev): add redirect for Self-Healing CI feature (#33708)
Add self-healing redirect.
2025-12-04 14:23:54 -05:00
MaxKless d2e85ba720 feat(gradle): add targetNamePrefix option to mark all gradle targets (#33685)
## Current Behavior
you can mark some targets generated by gradle by specifying options.

## Expected Behavior
you can apply a prefix to all targets generated by gradle. This is
useful for targetDefaults, for example.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds a Gradle option to prefix all generated Nx target names
(including dependencies and CI targets) with tests to avoid
double-prefixing.
> 
> - **Gradle project graph**:
> - Apply optional `targetNamePrefix` to all target names and dependency
rewrites in `createNodeForProject`, `processTargetsForProject`, and
`getDependsOnForTask`.
> - Wire prefix through plugin/task: read in
`NxProjectGraphReportPlugin`, expose on `NxProjectReportTask`, and pass
to processing functions.
> - Ensure CI targets (`ciTestTargetName`, `check-ci`, `build-ci`) are
correctly prefixed and not double-prefixed; update dependency
replacement logic accordingly.
>   - Add logging for prefix usage.
> - **Plugin options (TS)**:
> - Extend `GradlePluginOptions` with `targetNamePrefix` in
`packages/gradle/src/plugin/utils/gradle-plugin-options.ts`.
> - **E2E tests**:
> - Add tests validating prefixed targets exist and run, and that CI
test targets are not double-prefixed in `e2e/gradle/src/gradle.test.ts`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9a5160b8855a32d6c13c33c97379e7aa143a0737. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-12-04 13:57:41 -05:00
Philip Fulcher c5e9489f2f docs(nx-dev): add nx vs diy article (#33704) 2025-12-04 16:11:45 +00:00
Caleb Ukle 1a877efc98 docs(nx-cloud): update guide for ci resource usage (#33697) (#33701) 2025-12-04 08:13:06 -05:00
Berend de Boer 8352d40df5 fix(core): optimize bun lockfile parser (#33623)
Key optimisations:

1. Pre-computed PackageIndex - Built once during lockfile parsing:
   - byName: Map from package name → array of versions (O(1) lookup)
   - workspaceNames: Set of workspace package names (O(1) lookup)
   - workspacePaths: Set of workspace paths (O(1) lookup)
- packagesWithWorkspaceVariants: Set of packages with workspace-specific
variants (O(1) lookup)
   - patchedPackages: Set of patched package names (O(1) lookup)
2. findResolvedVersion: Changed from O(n) scan through all packages to
O(1) map lookup + O(k) where k = number of versions for that package
(typically 1-3)
3. isWorkspacePackage: Changed from O(n) scan to O(1) set lookup
4. hasWorkspaceSpecificVariant: Changed from O(n) scan to O(1) set
lookup
5. isNestedPackageKey: Now uses pre-computed workspace paths/names sets
instead of computing them each call

On my 40 project typescript monorepo my time goes from about 30 seconds
to 4.5s, a speed-up of 6-7x.

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-12-04 11:52:22 +01:00
Caleb Ukle 77692feae4 docs(nx-cloud): add guide for ci resource usage (#33697)
add info about how to use the Nx 22.1+ task metric gathering w/ Nx Cloud


https://deploy-preview-33697--nx-docs.netlify.app/docs/guides/nx-cloud/task-resource-usage

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: barbados-clemens <barbados-clemens@users.noreply.github.com>
2025-12-03 14:35:58 -06:00
Copilot 3ca68887de docs(nx-cloud): standardize terminology to "Access token" (#33334)
## Current Behavior

The Bitbucket integration documentation uses inconsistent terminology:
"App Password" for Bitbucket Cloud and "HTTP Access Tokens" for
Bitbucket Data Center.

## Expected Behavior

Documentation should use consistent "Access token" terminology across
both Bitbucket Cloud and Data Center sections.

## Changes

- Updated section headers to use "Acces token" terminology
- Replaced all instances of "app password" with "API token"
- Fixed plural "HTTP Access Tokens" → "HTTP Access Token"
- Updated image alt text for consistency
- Updated aside note title: "User linked access tokens" → "User linked
API tokens"

## Related Issue(s)

Fixes
https://linear.app/nxdev/issue/DOC-322/update-bitbucket-docs-to-use-api-tokens-terminology

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `staging.nx.app`
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/nrwl/nx/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Issue Title: Update Bitbucket docs to use API tokens terminology
> Issue Description: Update the Nx Cloud Bitbucket source control
integration docs to reference API tokens instead of App Passwords.
Update the language on the docs page accordingly:
[bitbucket.mdoc](https://github.com/nrwl/nx/blob/master/astro-docs/src/content/docs/guides/Nx%20Cloud/Source%20Control%20Integration/bitbucket.mdoc)
> Fixes
https://linear.app/nxdev/issue/DOC-322/update-bitbucket-docs-to-use-api-tokens-terminology
> 
> 
> Comment by User 439b15a6-827b-4258-971a-d86133ad59de:
> [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> 📋 I wasn't able to determine which GitHub repository to work in.
> 
> I think it's one of these, but can you tell me which one is right?
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> Waiting for https://linear.app/nxdev/profiles/caleb to link their
GitHub account. [Click to authorize
→](https://linear.business.githubcopilot.com/linear/auth)
> 
> Comment by User :
> Created issue
[DOC-322](https://linear.app/nxdev/issue/DOC-322/update-bitbucket-docs-to-use-api-tokens-terminology)
> 
> Comment by User 439b15a6-827b-4258-971a-d86133ad59de:
> This comment thread is synced to a corresponding [thread in
Slack](https://nrwl.slack.com/archives/C04ML056D99/p1762090527735769?thread_ts=1762090527.735769&cid=C04ML056D99).
All replies are displayed in both locations.
> 
> Comment by User :
> This thread is for an agent session with githubcopilot.
> 
> Comment by User 439b15a6-827b-4258-971a-d86133ad59de:
> @Linear make a docs issue to update the language for the bitbucket
source control integration to talk about api tokens instead of app
passwords.
> Assign it to copilot. 
> Here is the docs page in question 
>
[https://github.com/nrwl/nx/blob/master/astro-docs/src/content/docs/guides/Nx%20Cloud/Source%20Control%20Integration/bitbucket.mdoc](https://github.com/nrwl/nx/blob/master/astro-docs/src/content/docs/guides/Nx%20Cloud/Source%20Control%20Integration/bitbucket.mdoc)
> 
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/nrwl/nx/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Caleb Ukle <caleb@nrwl.io>
2025-12-03 20:29:17 +00:00
Jack Hsu 2e442d56b4 feat(core): add template support to create-nx-workspace (#33468)
This PR simplifies the CNW process so we only prompt for a starter (TS,
NPM Packages, React, Angular) and we clone a full example to showcase Nx
monorepo for the given starter. This speeds up CNW drastically and
allows users to get the workspace in 5-10 seconds vs 1-3 minutes.

Users can choose `Custom` to fall back to the previous prompts, which
will ask framework, unit test runner, e2e runner, etc.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 13:12:55 -05:00
Colum Ferry 7792d80258 fix(core): sanitize project names for valid git tag names in nx release (#33692)
Gradle multi-module projects have project names with colons (e.g.,
`:common:iam-client`)
which are invalid in git tag names. This adds a
`sanitizeProjectNameForGitTag()` function
that replaces colons with slashes and other invalid git ref characters
with hyphens.

The sanitization is applied when:
- Creating git tags in `createGitTagValues()`
- Creating the `ReleaseVersion` class gitTag property
- Matching existing tags in `getLatestGitTagForPattern()`

Fixes #33262
2025-12-03 16:32:18 +00:00
Colum Ferry e6eed35426 feat(expo): support Expo 54 (#33612)
## Current Behavior
We only support Expo 53

## Expected Behavior
Add support for Expo 54
Allow existing workspaces wishing to remain on Expo 53 to continue to be
supported
Add migrations allowing LLMs to handle migrating from Expo 53 to Expo 54


## Related Issue(s)

Closes NXC-3526

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-12-03 10:37:24 -05:00
Colum Ferry 5895c9acf6 fix(angular-rspack): ensure rebuild logs are only printed once (#33694)
## Current Behavior
Rebuild logs during serve of Angular Rspack applications are logged an
exponential number of times with each change.

## Expected Behavior
Log only once
2025-12-03 15:26:48 +00:00
Colum Ferry 2ee5d69ca3 fix(react): update @emotion/styled to latest version #31252 (#33690)
## Current Behavior
We currently install an outdated version of `@emotion/styled` that
causes Typecheck issues.

## Expected Behavior
Use latest version of Emotion

## Related Issue(s)

Fixes #31252
2025-12-03 13:48:57 +00:00
Colum Ferry b740baf57a fix(angular-rspack): use CJS when serving applications for HMR #33106 (#33693)
## Current Behavior
Angular Rspack outputs ESM for build and serve. However, with serve, it
causes issue for HMR.

## Expected Behavior
Use CJS for serve to allow HMR to work correctly

## Related Issue(s)

Fixes #33106
2025-12-03 13:31:22 +00:00
Jack Hsu b314dd187b chore(testing): add jest migration example (#33687)
This  adds the missing example for the new `jest.config.cts` migration.
2025-12-02 18:29:21 -05:00
Colum Ferry 30acb10c89 feat(vitest): make initial generation for JS projects more lightweight (#33670)
## Expected Behavior
Generate only `vitest.config.mts` file when not bundling with Vite
Use `vite.config` file if it exists already
Add `testMode` option to the `@nx/vitest` Inference Plugin to allow
easier switching between `vitest` and `vitest run`.

## Related Issue(s)

Fixes NXC-3334
2025-12-02 16:29:13 +00:00
MaxKless adc6d0757e fix(core): stop adding outdated vscode/cursor rule files to gitignore (#33680)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Removes legacy additions of `.cursor/rules/nx-rules.mdc` and
`.github/instructions/nx.instructions.md` to `.gitignore` across code,
templates, and migrations.
> 
> - **.gitignore behavior**:
> - Remove logic in
`packages/nx/src/command-line/init/implementation/utils.ts` that
appended `.cursor/rules/nx-rules.mdc` and
`.github/instructions/nx.instructions.md`.
>   - Clean up root `.gitignore` to exclude those entries.
> - Update new workspace templates
(`packages/workspace/.../__dot__gitignore`) to omit those entries.
> - **Migrations**:
> - Remove migration `21-1-0-add-ignore-entries-for-nx-rule-files` from
`packages/nx/migrations.json` and delete its implementation and spec.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7863fa5beee127777f819a5155ae17239c5b16cd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-12-02 11:18:46 -05:00
Colum Ferry 804d4c2e0c feat(vitest): update @analogjs/vitest-angular to 2.1.2 #33602 (#33681)
## Current Behavior
Trying to create a new workspace is failing on npm peer dep conflicts
when trying to use Vitest with Angular.
The version of `@analogjs/vitest-angular` only supports Vitest <4.

## Expected Behavior
Update to latest version of `@analogjs/vitest-angular` to support Vitest
4

## Related Issue(s)

Fixes #33602
2025-12-02 15:45:21 +00:00
Colum Ferry 5f8540488b fix(bundling): set buildLibsFromSource in normalize options for Rollup (#33679)
## Current Behavior
`buildLibsFromSource` defaults to true only in the `@nx/rollup:rollup`
executor.
In the normalize options helper for the executor, it is not handled at
all. Programmatic usage would therefore result in `undefined`.

For pure Inference Plugin usage, `buildLibsFromSource` is also not
handled in normalize options.
Therefore, it always defaults to `undefined`.

## Expected Behavior
To reduce breaking changes, force `buildLibsFromSource` to be false for
Inference Plugin usage.
Explicitly set it in executor's normalize options helper to true to
match the schema default.

## Related Issue(s)

Fixes NXC-3537
2025-12-02 14:03:52 +00:00
Jonathan Gelin 4923c15e7e fix(release): interpolate releaseGroupName in getLatestGitTagForPattern (#33674)
# Fix: Pass releaseGroupName to getLatestGitTagForPattern for proper tag
resolution

## Problem

When using `releaseTag.pattern: "{releaseGroupName}@{version}"`, Nx
fails to resolve versions from git tags because the `{releaseGroupName}`
placeholder is not interpolated.

For example, with git tag `my-group@2.9.0`:
- **Expected**: Extract version `2.9.0`
- **Actual**: Extracts `"my-group"` → Error: `Invalid semver version
'my-group' provided`

## Root Cause

In `release-graph.ts:627-631`, only `projectName` is passed to
`getLatestGitTagForPattern()`, missing `releaseGroupName` needed for
interpolation.

## Solution

Pass `releaseGroupName` to the interpolation data (1-line change at
`release-graph.ts:631`):

```typescript
latestMatchingGitTag = await getLatestGitTagForPattern(
  releaseTagPattern,
  {
    projectName: projectGraphNode.name,
    releaseGroupName: releaseGroupNode.group.name, //  Added
  },
  { ... }
);
```

## Backward Compatibility

 Fully backward compatible:
- `releaseGroupNode.group.name` is always defined (user-defined or
`"__default__"`)
- Unused interpolation data is safely ignored
- Existing patterns (`v{version}`, `{projectName}@{version}`) continue
to work

## Tests

Added test case in `git.spec.ts` for `{releaseGroupName}@{version}`
pattern that verifies correct tag matching and version extraction.

## Files Changed

- `packages/nx/src/command-line/release/utils/release-graph.ts` (1 line)
- `packages/nx/src/command-line/release/utils/git.spec.ts` (1 test case)

Co-authored-by: James Henry <james@henry.sc>
2025-12-02 10:23:26 +00:00
Jonathan Gelin 8207c94617 feat(docker): auto-select version scheme when only one is available (#33671) 2025-12-02 11:27:40 +04:00
Jonathan Gelin a4c13212ab fix(docker): fix releasing non docker projects (#33667) 2025-12-02 11:26:11 +04:00
Jason Jean 02c01e5daf fix(repo): enable wayland-data-control feature for arboard (#33675)
## Current Behavior

The arboard crate is used without the `wayland-data-control` feature,
which means clipboard operations may not work properly on Wayland-based
Linux systems.

## Expected Behavior

With the `wayland-data-control` feature enabled, arboard can interact
with the clipboard on Wayland systems using the wlr-data-control
protocol.

## Related Issue(s)

N/A - Enhancement for better Wayland support
2025-12-01 21:57:22 -05:00
Jason Jean a5015d3992 chore(repo): update nx to 22.2.0-beta.2 (#33676)
Updating Nx from 22.2.0-beta.1 to 22.2.0-beta.2
2025-12-01 21:57:06 -05:00
Jason Jean c888ac72c6 fix(maven): remove incorrect threadSafe to parallelism mapping (#33678)
## Current Behavior

The Maven plugin incorrectly maps Maven's `isThreadSafe` mojo property
to Nx's `parallelism` target property. Maven's `isThreadSafe` indicates
whether a mojo can safely run in parallel with other mojos of the same
type within the same Maven build (multi-threaded Maven builds).

## Expected Behavior

Nx's `parallelism` controls whether the target can run in parallel
alongside anything else - a fundamentally different concept. All Maven
targets now default to `parallelism: true`, letting Nx handle
parallelism based on its own task graph analysis rather than using
Maven's unrelated thread-safety concept.

## Related Issue(s)

N/A - Internal cleanup based on code review feedback.
2025-12-01 16:58:24 -05:00
Jack Hsu 731aba377a fix(testing): remove --no-experimental-strip-types flag from @nx/jest/plugin + migrate to jest.config.cts if needed (#33657)
## Current Behavior
On Node.js v24+, the `@nx/jest/plugin` sets
`--no-experimental-strip-types` in NODE_OPTIONS which causes an error:
"node: --no-experimental-strip-types is not allowed in NODE_OPTIONS".

Additionally, `jest.config.ts` files using ESM syntax (`export default`,
`import`) fail to load correctly under Node.js type-stripping when the
project is configured for CommonJS.

## Expected Behavior
- Remove the NODE_OPTIONS manipulation that adds
`--no-experimental-strip-types`
- Add a migration (22.2.0-beta.2) that converts `jest.config.ts` files
from ESM to CJS syntax for projects using `@nx/jest/plugin`
- The migration only runs when `@nx/jest/plugin` is registered in
`nx.json`
- Projects with `type: module` are warned as they're incompatible with
the plugin
- Files using ESM-only features (import.meta, top-level await) are
skipped with a warning for manual conversion

## Demo

https://www.loom.com/share/8a157a0b01d144ae8d6ae48b9b0cd0e4


## Related Issue(s)
Closes NXC-3541

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 09:43:26 -05:00
Colum Ferry 8ff2768aaa feat(vite): add migration to add @nx/vitest (#33669)
## Current Behavior
We don't have a migration to migrate users to use the new @nx/vitest
package if they're currently using @nx/vite
Given that we have Vitest-related operations marked as deprecated when
used via @nx/vite, we should have a migration.

## Expected Behavior
Add a migration that:
1. Installs @nx/vitest
2. Switches @nx/vite:test executor usage to use @nx/vitest:test executor
usage
3. Splits `@nx/vite/plugin` in nx.json that sets up vitest test targets
to use `@nx/vitest` instead
2025-12-01 13:37:24 +00:00
Colum Ferry 637daf5343 fix(vite): vitest executor to return the async iterable #33588 (#33668)
## Current Behavior
The `@nx/vite:test` executor is not returning the async iterable. This
causes a destructuring issue.

## Expected Behavior
Ensure the `@nx/vite:test` executor returns the async iterable.

## Related Issue(s)

Fixes #33588
2025-12-01 10:33:58 +00:00
Jason Jean 6df1d8891a chore(repo): update nx to 22.2.0-beta.1 (#33650)
Updating Nx from 22.2.0-beta.0 to 22.2.0-beta.1

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-28 16:53:05 -05:00
Jack Hsu ba5b78e910 chore(repo): disable docker from macos nightlies since it does not work without vm-in-vm (#33659)
Disable but add a comment that we could enable it on macos intel if we
need to. For now it's covered by linux.
2025-11-28 15:06:27 -05:00
Jack Hsu f8f05b4086 fix(linter): update generators to use ESLint v9 compatible versions (#33633)
This PR updates the `workspace-rule` generator so use ESLint v9 by
default. It currently forces the unsupported ESLint v8.

In theory this is only useful if not using workspaces and you need
tsconfig paths to be mapped and resolved correctly. For workspaces, you
can easily just generate any library to be used to contain custom rules.

Closes NXC-3500

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-28 11:00:11 -05:00
Jack Hsu 7ff4f19529 docs(misc): update blog post links to new enterprise paths (#33654)
## Current Behavior
Blog posts contain broken links pointing to old `/powerpack` and
`/docs/enterprise/powerpack/*` paths that no longer exist.

## Expected Behavior
Links should point to the new enterprise documentation paths:
- `/powerpack` → `/enterprise`
- `/docs/enterprise/powerpack/*` → `/docs/enterprise/*`
- `/docs/reference/powerpack/*` → `/docs/reference/*`

## Related Issue(s)
Closes DOC-354

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 10:43:33 -05:00
James Henry f161603d37 fix(core): nx-schema default value for preserveMatchingDependencyRanges should have changed in v22 (#33587)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2025-11-28 15:42:18 +00:00
Jason Jean 191e492c05 fix(core): ensure perf logs are flushed before exit in graph command (#33621)
## Current Behavior

When running `NX_PERF_LOGGING=true nx graph --file graph.json`, many
performance logs are missing (e.g., `create-project-graph-async`,
`retrieve-project-configurations`).
  Only plugin-specific logs like `createDependencies` appear.

  ## Expected Behavior

All performance timing logs should appear, matching the output of
`NX_PERF_LOGGING=true nx show projects`.

  ## Related Issue(s)

  N/A - Internal improvement for debugging/profiling.

  ## Solution

The `graph.ts` file had `process.exit(0)` calls that terminated the
process immediately, not giving the async `PerformanceObserver` callback
time to fire.

Added `await new Promise((res) => setImmediate(res))` before
`process.exit(0)` to give the event loop one tick to process pending
callbacks. This follows the existing
  pattern in `show/projects.ts` and `show/project.ts`.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-28 15:28:08 +00:00
Jason Jean 9ffe2fd715 fix(core): prevent Nx Console prompt from blocking non-interactive commands (#33646)
## Current Behavior

The Nx Console installation prompt blocks commands when run in
non-interactive contexts such as:
- CI environments
- AI agents
- Piped commands

The prompt only checked `process.stdout.isTTY` but not
`process.stdin.isTTY`, causing it to wait indefinitely for input that
would never arrive.

## Expected Behavior

Commands should complete without prompting when run in non-interactive
environments.

## Related Issue(s)

Fixes #33552

## Solution

Updated the check to verify:
1. Both `stdin` and `stdout` are TTY (truly interactive terminal)
2. Not running in a CI environment (using existing `isCI()` utility)

This ensures the prompt only appears when the user can actually provide
input.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-28 09:53:46 -05:00
Jason Jean 3ca0e475ab fix(core): suppress git stderr output in parseGitOutput (#33645)
## Current Behavior

Since Nx 21.6.1, running `nx graph` or other commands that calculate
affected projects prints git errors to stderr when the default branch is
not fetched:

```
fatal: ambiguous argument 'main': unknown revision or path not in the working tree.
```

This causes CI pipelines with strict stderr checking to fail, even
though the nx commands succeed.

## Expected Behavior

Git error messages should not be printed to stderr. The errors are
already caught and handled gracefully - they just shouldn't be visible
to the user.

## Related Issue(s)

Fixes #33330

## Solution

Added `stdio: 'pipe'` to the `execSync` call in `parseGitOutput()`. This
suppresses stderr output while still allowing the command to throw on
failure (which is already caught by the try-catch in `graph.ts`).

This matches the pattern used in `getMergeBase()` which already uses
`stdio: 'pipe'`.
2025-11-28 14:52:46 +00:00
Jason Jean 2c1bfa30b1 fix(core): include create-nx-workspace in migration package group (#33643)
## Current Behavior

When running `nx migrate latest`, the `create-nx-workspace` package is
not updated along with other Nx packages, even though it's a core part
of the Nx ecosystem that users may have as a dependency (especially when
extending the install package pattern).

## Expected Behavior

The `create-nx-workspace` package should be updated to the same version
as `nx` and other `@nx/*` packages when running migrations.

## Related Issue(s)

Fixes #33585

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-28 14:46:13 +00:00
Jason Jean 2cfb746272 fix(nuxt): update preset test for v4 app directory structure (#33648)
## Current Behavior

The nuxt preset test was checking for `apps/${name}/src/app.vue`, but
since the generator now defaults to Nuxt v4 which uses the app directory
structure, this file is no longer created at that path.

## Expected Behavior

Tests should pass on master.

## Solution

Updated the test to check for `apps/${name}/app/app.vue` which is the
correct path for Nuxt v4's app directory structure.
2025-11-28 12:19:04 +04:00
Jack Hsu 363457c2a8 fix(nuxt): do not import base eslint config for root project (#33642)
If you generate a standalone/root project then there's no
`eslint.config.mjs` to import from base.

<img width="1269" height="355" alt="image"
src="https://github.com/user-attachments/assets/b9658f08-48ff-48e7-bab8-fcd7ff5c349a"
/>
2025-11-27 14:52:19 -05:00
Jack Hsu 49fc6d54ff chore(misc): fix e2e tests for CNW + Nuxt 2025-11-27 14:01:20 -05:00
Caleb Ukle 5071217c30 docs(nx-dev): powerpack docs cleanup/deprecations (#33635)
closes: DOC-338

---------

Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-11-27 12:10:47 -05:00
Leosvel Pérez Espinosa 21783402b7 fix(core): kill child process tree in different running tasks (#33636)
## Current Behavior

When Nx commands finish or receive termination signals (SIGINT, SIGTERM,
SIGHUP), child processes spawned by continuous tasks (such as `nx
serve`) can remain orphaned in certain scenarios. This happens because
only the direct child process is killed using `childProcess.kill()`,
leaving grandchild processes running.

## Expected Behavior

When Nx terminates, all processes in the spawned process tree should be
properly terminated and no orphaned processes should remain.

## Related Issue(s)

Fixes #32438
Fixes #33460 

## Changes

- Updated signal handlers in `RunningNodeProcess` to use `this.kill()`
instead of `this.childProcess.kill()`, leveraging the existing
`tree-kill` implementation
- Added `tree-kill` to `NodeChildProcessWithNonDirectOutput` and
`NodeChildProcessWithDirectOutput` kill methods to ensure entire process
trees are terminated
2025-11-27 11:53:47 -05:00
Jack Hsu c08e83c73d chore(repo): remove hack that enables legacy peer deps so we can catch errors (#33634)
We missed a peer dep error in the Nuxt 4 PR since CI allowed install to
go through, but in a real repo it would have failed.

We _may_ need to still have the `prefer-frozen-lockfile=false` option,
but let's let CI run with this first.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-27 09:57:55 -05:00
Benjamin Cabanes 9fecf1416a docs(nx-dev): rename "Nx Enterprise" to "Enterprise" (#33641)
Rename "Nx Enterprise" to "Enterprise" across UI Header components.
2025-11-27 09:54:19 -05:00
Colum Ferry a0581d717f feat(nuxt): support nuxt v4 (#33611)
## Current Behavior
We currently do not support Nuxt 4. We still generate Nuxt 3.

## Expected Behavior
Support Nuxt 4.
New workspaces will get Nuxt 4.
Existing Workspaces that use Nuxt 3 intentionally will continue to use
Nuxt 3.
Add a migration to update users to Nuxt 4
Handle ESLint flat config

## Related Issue(s)

Closes NXC-3525
Closes NXC-3497

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-27 09:17:29 -05:00
Colum Ferry f87e20fe75 fix(linter): base eslint config should ignore out-tsc directories (#33639)
## Current Behavior
The base `eslint` config will ignore `**/dist` but not `**/out-tsc`.
This can cause issues if lint is run after a `typecheck` which has
placed `.d.ts` files into an `out-tsc` directory.

## Expected Behavior
Base eslint config should ignore `**/out-tsc`

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-27 13:50:15 +00:00
Colum Ferry 25b8550adc feat(storybook): support storybook 10.1 (#33637)
## Current Behavior
Storybook support is not explicitly set to 10.1 which has just been
released.

## Expected Behavior
Explicitly set storybook version to 10.1 to ensure support for Angular
21

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-27 13:13:26 +00:00
Jack Hsu 3558a4cdfe docs(testing): update atomizer documentation for Vite and Vitest plugins (#33620)
## Current Behavior

The atomizer/task splitting documentation for Vite and Vitest was
incomplete:
- The @nx/vite/plugin introduction page was missing the dual
configuration example for both E2E and unit tests
- The @nx/vitest introduction page was missing all atomizer-related
sections (splitting E2E tests, ciTargetName, ciGroupName)
- The split-e2e-tasks feature page only referenced @nx/vite for Vitest,
not the dedicated @nx/vitest plugin
- The @nx/vitest docs had incorrect option name (targetName instead of
testTargetName)

## Expected Behavior

- @nx/vitest introduction page now have complete atomizer documentation
- The split-e2e-tasks page now references both @nx/vitest and @nx/vite
options for Vitest users
- Configuration examples use the correct option names matching the
actual plugin interfaces
- Users can easily find how to configure task splitting for Vitest
whether they use @nx/vite or @nx/vitest
---

Affected pages:
-
https://deploy-preview-33620--nx-docs.netlify.app/docs/features/ci-features/split-e2e-tasks#update-an-existing-project-to-use-automated-task-splitting
-
https://deploy-preview-33620--nx-docs.netlify.app/docs/technologies/build-tools/vite/introduction
-
https://deploy-preview-33620--nx-docs.netlify.app/docs/technologies/test-tools/vitest/introduction

Closes DOC-346

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-26 09:49:56 -05:00
Jack Hsu e3a4233cfe chore(repo): add Node 24 to e2e nightly matrix (#33542)
- E2E nightly tests only run on Node 20 and 22.
- E2E nightly tests now also run on Node 24, 22, and 20 for linux. For
Windows and Mac run only 24.

Did a test run from this branch, and Node 24 passes where other versions
pass, and fails where other versions fail. It shouldn't make any golden
tests fail just due to Node 24, but it's possible that things will flake
more since the matrix has expanded. We just have to make them more
robust.

<img width="920" height="1089" alt="image"
src="https://github.com/user-attachments/assets/90ee4d04-68d5-4d0d-9729-60cacfbc99db"
/>


Close NXC-3491
2025-11-26 09:43:08 -05:00
Colum Ferry 1ecbd8082c fix(nextjs): make migration to next 16 optional (#33627)
## Current Behavior
The Next 16 AI Migration Instructions are always created, regardless of
existing Next version

## Expected Behavior
Make the Next 16 Migration optional

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-26 14:22:46 +00:00
Jack Hsu b6958b3e88 docs(linter): add custom workspace eslint rules guide (#33618)
There is no documentation on how to create and use custom ESLint rules
in Nx workspaces.

Users can follow a guide to create custom ESLint rules using either:
1. Package Manager Workspaces (npm/yarn/pnpm/bun) - create a dedicated
ESLint plugin package that's symlinked via the package manager
2. `loadWorkspaceRules` utility from `@nx/eslint-plugin` - load rules
from any directory with automatic TypeScript transpilation

The guide includes:
- Comparison table for choosing the right approach
- Step-by-step instructions for both approaches
- TypeScript execution options (build first, Node.js native support,
tsx)
- Rule testing with `@typescript-eslint/rule-tester`
- Best practices and troubleshooting tips

Page:
https://deploy-preview-33618--nx-docs.netlify.app/docs/technologies/eslint/guides/custom-workspace-rules

Closes DOC-339

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-26 09:20:25 -05:00
Colum Ferry 00e4c0c69a feat(vite): add vitest 4 migration for users using @nx/vite (#33630)
## Current Behavior
Despite @nx/vite depending on @nx/vitest it only does so in the same
version that introduces the migration for Vitest 4.
This means the user does not get any migrations for Vitest 4

## Expected Behavior
Add the Vitest 4 migrations to the @nx/vite package to allow users to
migrate.
2025-11-26 14:05:19 +00:00
Jack Hsu 017ad93d35 fix(bundling): replace rollup-plugin-copy with nx copy assets plugin (#33601)
There's a problem when `@nx/rollup` is installed with yarn@1.22, and
typechecks.

This is caused by the transitive dependency chain:

```
rollup-plugin-copy@3.5.0 -> globby@10.0.1 -> @types/glob@7.2.0 -> @types/minimatch
```

When users run tsc without explicit `types` configuration, TypeScript
auto-discovers `@types/minimatch` from `node_modules` but can't properly
resolve it.

Note: This doesn't happen with NPM and PNPM, nor newer yarn versions.

Verified fix with this repro: https://github.com/jaysoo/rollup-251124

Fixes #32398

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2025-11-26 08:55:46 -05:00
Philip Fulcher 081bec53cf docs(nx-dev): add 22.1 article and changlog (#33617)
https://nx-dev-git-philip-nx22-1-article-nrwl.vercel.app/blog/nx-22-1-release
2025-11-25 18:42:57 -05:00
Jack Hsu 67059ccf10 docs(storybook): update Storybook docs for version 10 (#33619)
## Current Behavior
- Storybook generator docs banner says "Nx uses Storybook 7"
- Separate storybook-9-setup.mdoc page exists
- No documentation for migrate-10 generator

## Expected Behavior
- Update banner to "Nx uses Storybook 10"
- Consolidate storybook-9-setup into upgrading-storybook guide
- Add migrate-10-generator-examples.md with AI-assisted migration docs
- Update all references to point to new consolidated guide

---

Main content is here:
https://deploy-preview-33619--nx-docs.netlify.app/docs/technologies/test-tools/storybook/guides/upgrading-storybook

Need to follow-up on the sidebar ordering as it doesn't seem to take it
into account for technologies section.

Fixes DOC-347
2025-11-25 18:42:05 -05:00
Colum Ferry 098d3ed9c9 fix(storybook): remove upper bound of migration requires (#33613)
## Current Behavior
The upper bound of the requires is too restrictive and causing issues

## Expected Behavior
Remove the upper bound
2025-11-25 18:41:10 -05:00
Jason Jean 9eb254c964 chore(repo): update nx to 22.2.0-beta.0 (#33614)
Updating Nx from 22.1.0-rc.5 to 22.2.0-beta.0

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-25 17:11:12 -05:00
Leosvel Pérez Espinosa 7e00ec431f fix(core): propagate continuous task failures to dependent tasks (#33492)
## Current Behavior

When a continuous task depends on another continuous task and the
dependent task exits with an error, the parent task continues running
indefinitely. The task execution never terminates, leaving processes
running in the background.

For example, if task `a` (continuous) depends on task `b` (continuous),
and task `b` exits with error code 1, task `a` will continue running
even though its dependency failed.

## Expected Behavior

When a continuous task exits (with any exit code), the failure should be
propagated to dependent tasks:

1. The failed continuous task should be marked as failed
2. Dependent continuous tasks should be marked as skipped
3. All affected continuous tasks should be killed
4. Task execution should terminate with an error

---

## Changes Made

### 1. Restore Error Handling in Continuous Task Exit Handlers

- Re-added the `cleaningUp` flag that was removed in a previous
TUI-related commit
- Modified `onExit` handlers for both regular and shared continuous
tasks to:
  - Check if the task exited during normal cleanup vs. unexpectedly
  - Call `complete()` with 'failure' status for unexpected exits
  - Log error messages for debugging

### 2. Fix `cleanUpUnneededContinuousTasks()` Logic

The previous implementation always added `initializingTaskIds` to the
needed set, even when those tasks were already completed. This prevented
dependency tasks from being killed when the top-level task exited.

Fixed by:

- Only adding tasks from `initializingTaskIds` if they are still
incomplete
- Keeping dependencies of incomplete tasks alive
- This ensures continuous tasks are killed when no longer needed,
whether a dependency fails or a top-level task exits

### 3. Prevent Status Overwrites

Added a check in `onExit` handlers to only set status to `Stopped` if
the task hasn't already been completed. This prevents the async `onExit`
callback from overwriting the correct status (like 'skipped' or
'failure') with 'Stopped'.

### 4. Fix Signal Handling in `PseudoTtyProcess.kill()`

The Rust pseudo-terminal defaults to SIGINT when no signal is provided,
which does not reliably terminate child processes in PTY sessions.

Fixed by:

- Defaulting to SIGTERM in the JavaScript wrapper (rather than changing
the Rust default)
- The JS wrapper is the API boundary that should match Node.js
semantics, where `childProcess.kill(undefined)` defaults to SIGTERM
- The Rust default of SIGINT is appropriate for interactive use
(Ctrl-C), while programmatic cleanup needs SIGTERM
- This ensures child processes are properly killed when
`runningTask.kill()` is called

**File:** `packages/nx/src/tasks-runner/pseudo-terminal.ts`

## Technical Details

The fix leverages the existing task failure propagation mechanism in
`complete()` instead of using `process.exit(1)`, which:

- Allows proper cleanup through normal execution flow
- Respects the `--bail` flag configuration
- Works correctly with both TUI and non-TUI modes
- Maintains consistency with how other task failures are handled
2025-11-25 09:49:11 -05:00
MaxKless 80322f921f fix(core): use nx-mcp for older nx versions instead of nx mcp (#33553)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Older versions don't support the `nx mcp` command yet - but they CAN use
the `nx-mcp` package via npx

## Expected Behavior
We generatee the proper command into their MCP config by matching on
their version

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-25 09:47:20 -05:00
Jason Jean 71470480bb feat(core): add multiple Nx version detection to nx report (#33599)
## Current Behavior

When multiple versions of the `nx` package are installed in a workspace
(e.g., due to a third-party package incorrectly depending on nx), users
have no visibility into
  this issue through `nx report`.

  ## Expected Behavior

The `nx report` command now detects when other packages depend on a
different version of nx than the workspace version and reports this
clearly:

  ⚠️ Multiple Nx versions detected

Your workspace uses nx@20.0.0, but other packages depend on a different
version:
  - some-package → @scope/tool → nx@19.0.0

These packages should not have nx as a dependency. Please report this
issue to the package maintainers.
  Run pnpm why nx@19.0.0 for more details.

This helps users identify and report problematic packages that bundle
their own version of nx.

  ## Related Issue(s)

N/A - This is a proactive improvement to help users diagnose workspace
issues.
2025-11-25 09:41:53 -05:00
MaxKless 7e51d85b1b cleanup(gradle): fix nightly e2e test where verbose was being called (#33610)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
nightly tests fail on gradle because of gradle parsing

## Expected Behavior
nightly tests should pass
2025-11-25 09:35:30 -05:00
Colum Ferry 1eea5edb50 feat(nextjs): add migration to add AI instructions for upgrading to Next 16 (#33608)
## Current Behavior
We do not generate AI Instructions to aid with upgrading from Next 15 to
Next 16

## Expected Behavior
Add a migration generator to create a file containing instructions for
an LLM to upgrade Next 15 to Next 16

## Related Issue(s)

Closes NXC-3418

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-25 13:33:03 +00:00
Colum Ferry cac7f6c3e8 fix(node): set generatePackageJson:false for TS Solution workspaces (#33606)
## Current Behavior
In TS Solution setups, we generate webpack config with
`generatePackageJson: true`. This is confusing and unneeded.
It should be set to false in TS Solution repos.

## Expected Behavior
Set `generatePackageJson: false` in webpack config for TS Solution
Setups


Closes NXC-3521
2025-11-25 08:13:22 -05:00
Kasper Christensen 3c5e40be68 fix(nest): set moduleResolution to node to prevent TS5095 error (#33607)
When generating NestJS applications in Angular workspaces, the base
tsconfig sets moduleResolution to 'bundler' which causes TS5095 errors
because 'bundler' requires module to be 'preserve' or 'es2015+'.

NestJS applications should use Node.js module resolution instead. This
fix sets moduleResolution to 'node' for NestJS applications (except when
using TS solution setup, which uses 'nodenext').

Fixes #33589
2025-11-25 12:23:25 +00:00
Colum Ferry 6c2b3ee37d fix(release): ensure emoji is not repeated in breaking changes summary (#33605)
## Current Behavior
The ⚠️ emoji at the beginning of bc commits is duplicated in the bc
section of the changelog.
This is unneeded.

## Expected Behavior
Ensure the ⚠️ is not repeated in the bc section of the changelog

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-25 11:14:48 +00:00
Chau Tran d70c888a93 fix(graph): surface task graph client error via error toast (#33600)
Close NXC-3516

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-25 09:12:40 +01:00
Jason Jean f31bef701a fix(core): make daemon socket path unique per process to prevent race condition (#33580)
## Current Behavior

1. **Socket Race Condition**: All daemon servers listen on the same
socket path, causing a race condition where shutting down daemons remove
sockets that newly started
  daemons are listening on.

2. **Daemon Console Check Blocks**: The daemon availability check runs
synchronously and blocks the main thread.

3. **Version Mismatch Issues**: Packages using a different nx version
than what's installed in the workspace could still use the daemon,
leading to potential issues.

  ## Expected Behavior

1. Each daemon server creates a unique socket path based on its process
ID, preventing race conditions.

  2. The daemon console check runs in the background without blocking.

3. The daemon is disabled when there's a version mismatch between the
running nx and the workspace's installed version.

  ## Changes

  ### 1. Unique Daemon Socket Paths
- Include `process.pid` in the socket directory hash to make each
daemon's path unique
- Store the socket path in `server-process.json` so clients know where
to connect
  - Clients read the socket path from the file instead of calculating it

  ### 2. Backgroundable Daemon Check
- Reapplied #33491 which makes the Nx Console install check run on the
daemon in the background
- This was previously reverted due to the socket race condition (now
fixed by change 1.)
- Running in background also allows pulling the latest check logic from
npm

  ### 3. Version Mismatch Check
  - Added `isNxVersionMismatch()` check in `DaemonClient.enabled()`
- Created shared utility `is-nx-version-mismatch.ts` for version
comparison
  - Refactored server.ts to use the shared utility
- Uses `require.resolve('nx/package.json', { paths: [workspaceRoot] })`
to properly resolve the workspace's installed nx version

  ## Related Issue(s)

Fixes daemon socket path race condition and improves daemon reliability.
2025-11-24 23:45:28 +00:00
Philip Fulcher 12f42ca798 chore(nx-dev): remove november webinar (#33598) 2025-11-24 16:17:39 -05:00
Colum Ferry 70bbbe9ff6 fix(js): ensure copy-workspace-modules copies transitive workspace dependencies (#33570)
## Current Behavior
`copy-workspace-modules` executor only copies workspace dependencies 1
level deep.
If that workspace library depends on another workspace library, it is
not copied correctly.

## Expected Behavior
Copy transitive workspace modules

## Related Issue(s)

Fixes NXC-3466
2025-11-24 09:16:37 -05:00
Jack Hsu b7cfee16e2 fix(testing): remove declare global wrapper from cypress commands.ts template (#33573)
When adding Cypress to a library, the generated commands.ts causes
TS2669 error because declare global requires the file to be a module.
Changed to use declare namespace Cypress directly.

Fixes #32930
2025-11-24 08:35:51 -05:00
Juri 8fcef1e81a docs(misc): fix listing of oxlint community plugin 2025-11-24 10:46:48 +01:00
Laney Pouzet 5fd57badb9 fix(core): filter out automated release commits in getCommitsRelevantToProjects (#33482) 2025-11-23 16:19:51 +04:00
Jason Jean 626fb0873e Revert "feat(core): make console daemon check backgroundable and pull… (#33578)
## Current Behavior
PR #33491 introduced a daemon call into every command and caused
unexpected issues...

  ## Expected Behavior
the change is reverted while we investigate a proper fix

  ## Changes
This reverts commit 9471207767 from PR
#33491.

  ## Related Issue(s)
  Fixes #33472
2025-11-21 23:14:11 +00:00
Austin Fahsl 68eee382dc docs(nx-cloud): use GitHub's default ref in manual DTE workflow (#33575)
## Current Behavior

The manual DTE workflow explicitly sets the `ref` parameter to `${{
github.event.pull_request.head.sha }}` to checkout the actual branch
HEAD instead of the merge commit.

## Expected Behavior

Use GitHub's default ref behavior instead of explicitly overriding it,
as the default behavior now handles this correctly.

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-21 14:47:52 -07:00
Jack Hsu 8750521b32 fix(react): exclude tailwind from CSS modules syntax in component generator (#33574)
## Current Behavior
When generating a React component with --style=tailwind, the component
template incorrectly includes `className={styles['container']}` and
attempts to import CSS modules.

## Expected Behavior
Components generated with --style=tailwind should not include CSS
modules imports or `styles['container']` references, since Tailwind
doesn't use CSS modules.

## Related Issue(s)
Closes NXC-3511

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-21 16:18:30 -05:00
Jason Jean 9a6c7adddf feat(nx-cloud): prepend nx version to stats metadata (#33568)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Stats don't come along with versions which makes it hard to see if it
was specific changes that make a difference.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Stats are tagged with the version so we can compare stats between
versions

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-21 12:19:58 -05:00
Jack Hsu 57f28bac5e fix(storybook): remove STORYBOOK_PROJECT_ROOT when running automigrate to prevent hanging (#33567)
This PR fixes an issue where migrations can hang due to out invocation
of `storybook automigrate`. We are passing both `--config-dir` and
`STORYBOOK_PROJECT_ROOT`, the latter causes hanging with Storybook v9.

https://www.loom.com/share/39bbb350595c4a13aef86ec29f4b748f

## Current Behavior
Hangs

## Expected Behavior
Does not hang

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #32492
2025-11-21 11:34:29 -05:00
Jack Hsu 1c8796a4d7 docs(misc): update migration docs to use supported markdown syntax (#33563)
This PR cleans up the markdown files under `packages/`. We previously
had to support Next.js docs and translate it for astro docs with proper
markdown syntax. This applies to generators, executors, and migrations.

Also removes the function to do the translation in astro app since it's
no longer needed.

## Code block (migrations)
<img width="1086" height="800" alt="Screenshot 2025-11-20 at 1 23 53 PM"
src="https://github.com/user-attachments/assets/bd9acb9b-7960-4e41-9d26-22d29da6658e"
/>

## Aside (generators)
<img width="802" height="443" alt="Screenshot 2025-11-20 at 1 43 17 PM"
src="https://github.com/user-attachments/assets/e2999821-8783-46ed-a984-2193f6f8eafa"
/>
2025-11-21 09:25:34 -05:00
Craigory Coppola 1eecf46e4a fix(core): provide error when nested graph construction would occur invoked during createNodes (#33541)
## Current Behavior
During createNodes, if a file is imported and a function in said file
invokes the Nx project graph creation process, there's an infinite loop
that results in all nx commands hanging with little feedback.
Theoretically this loop would terminate at around the 10 minute mark,
but throughout the loop we would be digging deeper and deeper into
recursive territory so its possible that the node process could become
overwhelmed and hang.

## Expected Behavior
If recursive graph creation is detected, Nx terminates and logs the call
stack so it can be investigated properly.

## Related Issue(s)

Fixes #29618

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com>
2025-11-21 01:37:19 -05:00
Jack Hsu 239a4dbb2d feat(linter): add util to load eslint rules from a directory (#33543)
This PR adds the ability for users to import ESLint rules from arbitrary
location in the workspace rather than storing them in
`tools/eslint-rules`. This is useful for monorepo not using
npm/yarn/pnpm workspaces and need a mechanism to load from any custom
rules location without them being installed/symlinked.

It also handles TS files automatically.

Demo: https://www.loom.com/share/3c32af4555614eeab4f81fce8db0c955

Example:

```js
import baseConfig from "../../eslint.config.mjs";
import { loadWorkspaceRules } from "@nx/eslint-plugin";

const customRules = await loadWorkspaceRules("foo/bar/eslint-rules");

export default [
  ...baseConfig,
  {
    ignores: ["**/out-tsc"],
  },
  {
    files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
    plugins: {
      custom: { rules: customRules },
    },
    rules: {
      "custom/valid-command-object": "error",
    },
  },
];
```

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2025-11-20 17:16:03 -05:00
Craigory Coppola 9f7414e32a fix(core): daemon command should exit at end (#33547)
## Current Behavior
Daemon command hangs at end instead of exiting

## Expected Behavior
Daemon command exits

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-20 16:54:32 -05:00
Craigory Coppola 236177b8a3 chore(repo): fixup some issues with jest config (#33549)
## Current Behavior
There's some issues with the jest configs in the repo, CJS files having
`import` in them, etc.

## Expected Behavior
CJS files don't have `import`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-20 16:49:18 -05:00
Craigory Coppola 0e500dc64f fix(core): don't presume a task is long running if its marked cacheable (#33545)
## Current Behavior
`cache: true` is overridden if task name is dev

## Expected Behavior
`cache: true` has priority

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #32610

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-20 16:48:28 -05:00
MaxKless aa38b256a7 fix(graph): align exclude flag with others by using findMatchingProjects (#33550) 2025-11-19 18:18:51 -05:00
Jack Hsu 618c3344af fix(vite): generate .mts config files to force ESM (#33518)
Using .mts extension forces files to always be treated as ESM modules,
ensuring consistent behavior regardless of package.json or tsconfig
settings.

This matters for Node 24 because by default Node will strip types from
`.ts` files and then they are resolved through normal Node resolution.
In the past we can control CJS/ESM through tsconfig options, but now
only extension or `type` in `package.json` matters.

Changes:
- Updated all createOrEditViteConfig calls to pass useEsmExtension: true
- Updated normalizeViteConfigFilePathWithTree to check for .mts files
first
- Updated test files to expect .mts config files
- Updated snapshots to reflect new .mts extension

Closes NXC-3446
2025-11-19 16:49:25 -05:00
Jack Hsu 05bd3a4c16 fix(linter): handle various flat config override structures (#33548)
Flat config overrides util may fail when it isn't a plain JS object.
This PR makes the `hasOverrides` function more robust against these
cases.


Fixes #31796
2025-11-19 16:40:46 -05:00
MaxKless 3401c7ec78 cleanup(gradle): fix gradle dsl e2e test in verbose mode (#33546)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
the JSON parsing is broken because in verbose mode, the gradle plugin
returns more than just JSON.

## Expected Behavior
JSON parsing in the test should work

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-19 14:59:07 -05:00
Colum Ferry 7b9970f499 fix(release): ensure file change calculation matches nx affected #33413 (#33539)
## Current Behavior
We naively mark WholeFileChange for commits when getting the relevant
commits for projects.
There is already logic to perform better diff checking for lock files,
especially in the case of pnpm catalog usage

## Expected Behavior
Reuse existing logic to determine file changes more accurately

## Related Issue(s)

Fixes #33413
2025-11-19 17:35:09 +00:00
Craigory Coppola 219e82d4cd fix(core): default input should indeed be default (#33533)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior

If no inputs or named inputs are defined, this area of code was hit:

```
const DEFAULT_INPUTS: ReadonlyArray<InputDefinition> = [
  {
    fileset: '{projectRoot}/**/*',
  },
  {
    dependencies: true,
    input: 'default',
  },
];

export function getNamedInputs(
  nxJson: NxJsonConfiguration,
  project: ProjectGraphProjectNode
) {
  return {
    default: [{ fileset: '{projectRoot}/**/*' }],
    ...nxJson.namedInputs,
    ...project.data.namedInputs,
  };
}
```

This resulted in weird behavior when the user would define `default` in
named inputs, but it would seemingly only be applied to the project's
deps and not the project itself

## Expected Behavior
The `default` input is the default for both

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #https://github.com/nrwl/nx/issues/32924
2025-11-19 10:28:58 -05:00
Craigory Coppola f5c876b82e fix(core): avoid leaking memory due by creating an unref'd interval for each daemon connection (#33532)
## Current Behavior
Every time a daemon connection is opened, we create a new interval and
unref it. This results in the daemon checking its process termination at
an ever increasing rate, which presents as increased memory usage and
practically means the daemon is just doing a lot more work than it needs
to in this area.

## Expected Behavior
The interval is registered only on initial server startup.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #29836
2025-11-19 10:28:30 -05:00
Jack Hsu 6b56665857 docs(js): update dual format guide with correct types and hint to check arethetypeswrong tool (#33531)
This PR updates the guide here to also include type entries (which we
generate by default):
https://nx.dev/docs/technologies/typescript/guides/compile-multiple-formats

Update the content to account for the new inferred `@nx/rollup/plugin`
setup, but still mentions the executor. And also link to a tool that can
be used to check for types correctness.

Closes #33258

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: jaysoo <jaysoo@users.noreply.github.com>
2025-11-18 18:22:41 -05:00
Caleb Ukle f5915fa165 docs(nx-cloud): update private registry example script (#33528) 2025-11-18 23:14:42 +00:00
Caleb Ukle e418217dde fix(nx-dev): error out when failing to parse plugin manifests (#33498)
if there is an error parsing a schema file for generators/executors then
we should fully error out to prevent caching a "bad" build even if the
site techincally works with missing plugin info.
2025-11-18 16:19:54 -06:00
Jason Jean 3206c35fb2 chore(repo): re-enable metrics collection (#33508)
## Current Behavior

Metrics collection is currently disabled in the CI workflow via the
`NX_CLOUD_ENABLE_METRICS_COLLECTION` environment variable set to
'false'.

## Expected Behavior

Metrics collection should be enabled to gather build and performance
data from CI runs.

## Related Issue(s)

Reverts the change from #33497

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-18 13:36:49 -05:00
Rares Matei 40b99940f9 chore(repo): use recommended pnpm cache location (#33529)
This also fixes pnpm caching on the nx repo.
2025-11-18 18:07:20 +00:00
Caleb Ukle 0d84a6788f docs(webpack): update externalDependencies comment to correct reflect the defalt value (#33461)
default is not 'none' is now 'all'

https://github.com/nrwl/nx/blob/master/packages/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.ts#L53
2025-11-18 17:57:46 +00:00
Leosvel Pérez Espinosa 6b3b0c679b fix(js): sync external references to project's tsconfig.json file if it includes any files (#33524)
## Current Behavior

The `@nx/js:typescript-sync` generator never syncs external project
references to `tsconfig.json` files if a runtime tsconfig file exists.

## Expected Behavior

The `@nx/js:typescript-sync` generator should sync external project
references to `tsconfig.json` files if it includes any files or a
runtime tsconfig file doesn't exist.
2025-11-18 14:24:43 +01:00
Jason Jean 2dc4cb53ac chore(repo): update nx to 22.1.0-rc.5 (#33519)
Updating Nx from 22.1.0-rc.3 to 22.1.0-rc.5

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-17 19:49:59 -05:00
Jason Jean 41dec8ee78 fix(core): resolve all lock ordering deadlocks in metrics collector (#33513)
## Summary
This PR fixes a critical deadlock issue in the metrics collector that
occurred due to inconsistent lock acquisition order between the
collection thread and registration threads. The fix involved
restructuring lock scopes across multiple functions to maintain a
consistent lock hierarchy.

## Changes
- Fixed lock acquisition order in 4 registration functions
(register_main_cli_process, register_main_cli_subprocess,
register_task_process, register_batch)
- Restructured collect_metrics() to minimize system lock scope and
release it before acquiring other locks
- Fixed collection helper methods to read PIDs in scoped blocks without
holding system lock
- Added comprehensive trace logging for debugging lock contentions
- Added concurrent test case to verify no deadlocks occur under stress

## Testing
- All 12 metrics tests pass
- Comprehensive concurrent stress test added:
test_concurrent_group_creation_with_subprocess_updates
- Lock ordering consistency test added:
test_lock_order_consistency_across_registration_threads

## Lock Ordering Rule
Established and enforced this hierarchy across all threads:
1. Acquire system lock first
2. Release system lock
3. Then acquire registration/PID locks

This prevents circular wait conditions (A→B / B→A) that cause deadlocks.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-11-17 17:02:52 -05:00
Benjamin Cabanes 02e5c4af8e docs(nx-dev): add click event to header navigation links (#33516)
Added `sendCustomEvent` calls to track clicks on primary header and
mobile header navigation links.
2025-11-17 15:38:20 -05:00
Jack Hsu ed3ddebde5 fix(storybook): normalize version range before comparison (#33515)
When Storybook is installed with a version range like `^10.0.0` or
`~8.5.3`, the configuration generator fails with error:
```
NX   Invalid Version: ^10.0.0
TypeError: Invalid Version: ^10.0.0
```

This occurs because `gte()` from semver doesn't accept version ranges on
the left-hand side - only valid semver versions are allowed there.

The Storybook configuration generator should work with version ranges by
extracting the actual version number before comparison.

Fixes #33514
2025-11-17 14:55:30 -05:00
Jack Hsu e8576a8bb2 docs(angular): update dynamic module federation to use enhanced modules (#33512)
This updates the MF dynamic remotes docs for Angular to match new setup.

Closes DOC-327
2025-11-17 13:48:10 -05:00
Miroslav Jonaš 4bfc1e8e29 feat(core): apply parent env to atomized target (#33013)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Env variables from the parent target are not propagated to the atomized
target e.g.
`.test-ci.env` will be only applied to **no-op** `test-ci` but not to
`test-ci--path/to/test/file`.

## Expected Behavior
Running an atomized target will load from the parent's env files.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-17 17:30:07 +01:00
Nas3nmann 961e2379fe chore(core): nx plugin submission nx-oxlint 2025-11-17 17:10:10 +01:00
MaxKless de8a0205fd feat(gradle): allow specifying project and task configuration from gradle build files (#33264)
## Current Behavior 
Gradle projects in Nx workspaces can only configure metadata through
Gradle's built-in mechanisms. There's no way to specify Nx-specific
project metadata (like tags) or customize task target configurations
other than overriding with `project.json`

 ## Expected Behavior

Developers can now configure Nx-specific metadata for both projects and
tasks using a type-safe Kotlin/Groovy DSL:

 ### Project-level metadata (in build.gradle.kts):
  ```
nx {
    set("name", "my-service")
    array("tags", "scope:backend", "type:api")
    set("description", "Payment processing service")
  }
```

 ### Task-level metadata (in build.gradle.kts):
```
  tasks.named("integrationTest") {
    nx {
      set("cache", false)
      array("tags", "integration", "slow")
    }
  }
```

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: MaxKless <MaxKless@users.noreply.github.com>
2025-11-17 10:44:46 -05:00
Craigory Coppola d86fb5d244 fix(core): prevent hanging between command end and process exit (#33500)
## Current Behavior

In certain scenarios, Nx commands would hang between command completion
and process exit. This was caused by inefficient message end detection
in the
daemon socket communication, where the check for `MESSAGE_END_SEQ` could
fail when TCP packets were fragmented.

  ## Expected Behavior

With this PR, the message end detection is more robust and handles TCP
packet fragmentation correctly, preventing the hanging issue. The
changes also
add better performance tracking and logging to help diagnose similar
issues in the future.

  ## Changes Made

- **Improved message end detection**
(`consume-messages-from-socket.ts`): Added a preliminary check of the
last character's code point before checking
the full MESSAGE_END_SEQ, which prevents false negatives when TCP
packets are fragmented
- **Enhanced performance tracking** (`daemon/client/client.ts`,
`daemon-socket-messenger.ts`): Added message-type-specific performance
marks and
  measures for better debugging
- **Added server-side logging** (`daemon/server/server.ts`): Added
logging for message receipt, serialization, and response to help
diagnose
  communication issues

  ## Related Issue(s)

This fix addresses hanging issues observed in daemon communication when
commands complete but the process doesn't exit.
2025-11-17 09:57:34 -05:00
Colum Ferry b96b8e32e3 feat(docker): add skipDefaultTag option to build target (#33477) (#33506)
Add a skipDefaultTag option to the DockerTargetOptions interface that
allows users to opt out of the automatic default tag that is prepended
to build targets.

This is useful for multi-platform builds that need to push during build
(e.g., using --platform linux/amd64,linux/arm64 --push), where the
default tag causes build failures because it attempts to push a tag that
was not configured.

- Add skipDefaultTag?: boolean to DockerTargetOptions interface
- Modify buildTargetOptions to conditionally skip default tag when
skipDefaultTag is true
- Inherit skipDefaultTag from parent target in configurations
- Add comprehensive unit tests for skipDefaultTag functionality
- Add e2e test to verify skipDefaultTag works end-to-end
- Maintains backward compatibility (default behavior unchanged when
option not specified)

Fixes #33477
2025-11-17 09:55:31 -05:00
Jason Jean f54364eb67 chore(repo): update nx to 22.1.0-rc.3 (#33496)
Updating Nx from 22.1.0-rc.2 to 22.1.0-rc.3

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2025-11-15 11:29:32 -05:00
Craigory Coppola c1b942fd1c fix(core): include require paths when resolving specified plugins (#33495)
## Current Behavior
Loading local plugins that are relative paths from workspace root, that
point to a JS file, still require preliminary data from default plugins
despite being resolvable. This is because we aren't passing `paths` to
`require.resolve`, so it is trying to resolve relative to the nx package
instead of the workspace.

## Expected Behavior
The straight JS path resolves

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-14 21:27:26 -05:00
Philip Fulcher a9def426a1 docs(nx-dev): add monorepo myths article (#32944)
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-14 16:35:05 -05:00
Chau Tran a1dcd09172 chore(repo): disable metrics collection (#33497)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-14 16:09:16 -05:00
Jason Jean b3e6b03d82 chore(core): restructure metrics collector for performance and maintainability (#33483)
## Current Behavior

The metrics collector has several inefficiencies and architectural
issues:
- Complex hierarchical data structure (`ProcessTreeMetrics`) that
doesn't align with how the data is consumed
- Separate `MetadataStore` struct with unnecessary indirection
- Full metadata resent to all subscribers on every collection cycle
- Mutable parameters passed through collection functions instead of
functional return values
- Repeated allocations and clones across collection cycles
- `CollectionRunner` tightly coupled to NAPI, making it untestable in
pure Rust

## Expected Behavior

This PR restructures the metrics collector for better performance,
testability, and maintainability:

### Architectural Changes

1. **Flat Process Model**: Replaced hierarchical `ProcessTreeMetrics`
with a flat `Vec<ProcessMetrics>`, simplifying data flow

2. **Group-Based Organization**: Introduced `GroupInfo` and `GroupType`
to logically organize processes:
   - `MainCLI` - Nx CLI process and its subprocesses
   - `Daemon` - Nx daemon and its children
   - `Task` - Individual task execution processes
   - `Batch` - Batch execution with multiple tasks

3. **Incremental Metadata Updates**:
- Track which groups and processes have been sent using
`Arc<DashMap<String, GroupInfo>>` and `Arc<DashMap<String,
ProcessMetadata>>`
- Only send new metadata to subscribers instead of full state every
cycle
- New subscribers receive full metadata on first update via
`needs_full_metadata` flag
   - Automatic cleanup of dead process/group metadata

4. **Shared State with Arc**:
- Metadata maps shared between `ProcessMetricsCollector` and
`CollectionRunner` using `Arc<DashMap>`
   - Eliminated duplicate metadata storage
   - Single source of truth for all metadata

5. **Functional Programming Pattern**:
- Collection functions now return `Result<MetricsCollectionResult>`
instead of mutating parameters
   - Cleaner error handling with `inspect_err` and `map`
   - Easier to reason about data flow
   - Removed ~100 lines of code by consolidating logic

6. **Channel-Based Communication**:
   - Decoupled `CollectionRunner` from NAPI using `crossbeam_channel`
   - Collection thread sends metrics via channel to listener thread
   - Listener thread receives metrics and notifies NAPI subscribers
   - `CollectionRunner` is now NAPI-free and fully testable in pure Rust
- Non-blocking collection (subscriber callbacks don't block metrics
collection)

### Performance Optimizations

- Pre-allocated `Vec` capacity when combining metrics from different
sources
- Eliminated unnecessary `HashMap` clones during metadata updates
- Single-pass insertion into `DashMap` during string key conversion
- Reduced memory allocations in hot paths
- Collection thread never blocks on JavaScript callbacks

### Code Quality Improvements

- **Testability**: Added 7 pure Rust unit tests for `CollectionRunner`:
  - Group creation with different registration types
  - Incremental metadata updates
  - Dead group cleanup
  - All tests pass without requiring NAPI/Node.js runtime
- Clearer separation of concerns between collection and notification
- Better comments explaining incremental update strategy
- More idiomatic Rust patterns throughout
- Updated TypeScript type exports to match new structure

### Threading Model

**Before:**
```
CollectionRunner (mixed collection + NAPI notification)
```

**After:**
```
CollectionRunner (pure Rust, testable)
  └─> Channel
      └─> Listener Thread
          └─> NAPI ThreadsafeFunction
              └─> Subscribers
```

## Testing

-  241 Rust tests passing (including 7 new `CollectionRunner` tests)
-  Native module builds successfully
-  TypeScript types updated and exports verified

## Related Issue(s)

Part of ongoing metrics collector optimization work.
2025-11-14 16:56:51 +00:00
MaxKless 9471207767 feat(core): make console daemon check backgroundable and pulling from latest (#33491)
## Current Behavior
The Nx Console install check for the prompt happens in the main process,
adding some overhead to each invocation of nx.

## Expected Behavior
We want this check to happen on the daemon so that it's running in the
background. If it's still running when nx is invoked, we can just skip
the prompt since it's non-critical.
Running it in the background also allows us to pull the latest version
of the logic from npm when executing - that way we can keep the logic
older versions up-to-date even when ppl don't migrate to latest.
2025-11-14 16:14:13 +00:00
Jason Jean 7fd2cb4e3b chore(maven): bump Maven plugin version to 0.0.10 (#33485)
## Current Behavior

The Maven plugin is currently at version 0.0.9.

## Expected Behavior

This PR bumps the Maven plugin to version 0.0.10 and creates the
necessary migration for users to automatically update their pom.xml
files.

## Related Issue(s)

N/A - Routine version bump
2025-11-14 10:59:05 -05:00
MaxKless 2088eaaf22 fix(maven): skip maven plugin computation on vercel/netlify (#33486)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-14 09:28:59 -05:00
Jack Hsu 001e2ba4bb fix(misc): handle ERR_USE_AFTER_CLOSE gracefully in nx init and create-nx-workspace (#33469)
https://www.loom.com/share/560ceccdad45462e9fd3e3f185fc9fa5

Node 24 has stricter readline behavior, and enquirer is not checking for
closed state when invoking operations, resulting in an
ERR_USE_AFTER_CLOSE error when users press Ctrl+C during interactive
prompts.

This commit fixes the issue by adding uncaughtException handler to
ignore ERR_USE_AFTER_CLOSE errors.

When users press Ctrl+C, the process now exits cleanly without showing
an ugly error stack trace.

Fixes NXC-3412

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-14 09:28:50 -05:00
Nicole Oliver 1ef2614519 docs(nx-cloud): remove references to standalone powerpack (#33471)
Updates the Nx Powerpack docs and marketing page to make it clear that
Powerpack packages are included with Nx Enterprise, and cannot be
purchased separately, and remove references to the Nx Powerpack trial.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Caleb Ukle <caleb@nrwl.io>
2025-11-13 14:37:40 -08:00
Jack Hsu 54f6206f1b docs(js): clarify non-buildable libs can be in devDependencies for TS… (#33481)
The recipe for switching to TS project references states "If you
reference a local library project with its own `build` task" which
caused confusion. Users thought only buildable libraries should be
included in devDependencies, leading them to create unnecessary path
aliases for non-buildable libraries.

Closes DOC-149

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-13 17:29:34 -05:00
Jason Jean 20653ab15a chore(misc): record stat for initial invocation of create-nx-workspace (#33480)
## Current Behavior
Currently, telemetry stats are only recorded when `create-nx-workspace`
completes successfully. This doesn't capture how many times the command
is invoked vs completed.

## Expected Behavior
Record a stat when `create-nx-workspace` is first invoked (before any
prompts), enabling analysis of drop-off between initial invocation and
workspace completion.

## Changes Made

### Telemetry
- Added `recordStat()` call in `normalizeArgsMiddleware()` immediately
after welcome message and before any user prompts
- Records with command name `create-nx-workspace` and metadata
`['start']` to distinguish from completion stat
- Allows correlation of invocation and completion events for drop-off
analysis

### AI Agents Prompt
- This is being temporarily disabled because we noticed a dip in
create-nx-workspace completions that lines up when this was released.
Disabling it temporarily to see if the dip is recovered by disabling the
prompt.

### React Framework Selection
- Added early returns in `determineReactFramework()` for cases where
framework is already provided or interactive mode is disabled
- Improves performance by avoiding unnecessary prompt interactions

### Code Quality
- Reorganized imports in alphabetical order for better maintainability
- Removed unused import (`printSocialInformation`)

## Related Issue(s)
WIP - Draft for discussion
2025-11-13 20:16:58 +00:00
Louie Weng 0014ae66d8 fix(gradle): bump gradle migration version (#33479)
Ensure that we bump up Nx plugin for Gradle version to 0.1.9 when going
from 22.1.0-rc.3
2025-11-13 10:43:09 -08:00
Jack Hsu 4e3f475f63 fix(vite): support vitest v4 (#33478)
This PR ports the vitest v4 logic back to `@nx/vite` even though users
should be using `@nx/vitest`, we still support it until v23. Otherwise
running `@nx/vite:configuration --includeVitest` will always fail.

Generator working:
https://www.loom.com/share/246c401e114348818b998e0abed8754e
Suppressing warning:
https://www.loom.com/share/f769507de6684d4e9cb720cdc277e56a
2025-11-13 12:44:17 -05:00
Jason Jean 76c030a82e fix(core): capture stderr in nx add command for better error messages (#33462)
## Current Behavior

When `nx add @nx/s3-cache` fails due to incompatible peer dependencies
or other installation errors, users see only a generic error message
without the actual error details from the package manager.

## Expected Behavior

The command should display complete error messages from the package
manager (both stdout and stderr), including peer dependency conflicts
and other important diagnostic information.

## Changes

Fixed the exec callback in the `installPackage` function to:
1. Capture the `stderr` parameter (was previously ignored)
2. Log both stdout and stderr with a newline separator for clarity
3. Ensure users see all error information from package managers

## Why It Matters

Package managers write installation errors and peer dependency warnings
to stderr. By ignoring stderr, users had no visibility into what
actually failed, making it difficult to diagnose and fix issues.

Fixes issue with `nx add` not showing proper error messages.
2025-11-13 09:25:42 -05:00
Jason Jean 50cf84f758 chore(repo): update nx to 22.1.0-rc.2 (#33464)
Updating Nx from 22.1.0-beta.8 to 22.1.0-rc.2
2025-11-13 08:53:58 -05:00
Rares Matei 37cbdee1a2 docs(nx-cloud): recommend set sha action in manual dte (#33476)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-13 14:38:28 +01:00
Jason Jean 455891eaf5 fix(js): skip TS project references migration for non-TS-solution workspaces (#33467)
## Current Behavior

The `remove-redundant-ts-project-references` migration fails with an
error when run on workspaces that don't have a root `tsconfig.json`
file, such as nx-examples.

## Expected Behavior

The migration should skip workspaces that are not using TypeScript
solution setup instead of throwing an error.

## Related Issue(s)

Fixes the issue encountered when running the migration on
nrwl/nx-examples repo.

## Changes

- Added check to skip migration if workspace is not using TS solution
setup
- Updated test setup to properly configure TS solution for existing
tests
- Added new test cases to verify skip behavior

The migration now uses `isUsingTsSolutionSetup()` to detect if:
- `tsconfig.base.json` exists
- `tsconfig.json` exists and extends the base
- Package manager workspaces are configured
- Proper TS solution structure is in place

Workspaces missing any of these requirements will have the migration
skip silently.

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-12 22:58:31 +00:00
Jack Hsu 1997d950af docs(misc): replace Java cup logo with Duke mascot (#33466)
Use Duke logo rather than the cup logo. Also fix an alignment issue for
sidebar icons.

<img width="1352" height="707" alt="image"
src="https://github.com/user-attachments/assets/dff634e8-3b51-48c6-bbdb-7898e671e118"
/>

<img width="1067" height="596" alt="image"
src="https://github.com/user-attachments/assets/3c2075fd-8577-4a99-bb6b-66f901dd8f1e"
/>


Closes DOC-297

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-12 16:37:14 -05:00
Jason Jean 26df170c54 chore(js): update migration version to 22.1.0-rc.1 (#33465)
## Current Behavior

The migration for removing redundant TypeScript project references is
set to version `22.1.0-beta.8`.

## Expected Behavior

The migration should be updated to version `22.1.0-rc.1` to align with
the release candidate version.

## Related Issue(s)

N/A - Version update as requested.
2025-11-12 20:17:27 +00:00
Leosvel Pérez Espinosa 36b9f7ab32 fix(js): remove redundant typescript project references (#33438)
## Current Behavior

The `@nx/js:typescript-sync` generator adds project dependencies as
TypeScript project references to each project's `tsconfig.json` and
runtime tsconfig file (e.g., `tsconfig.app.json`, `tsconfig.lib.json`,
etc.). This is redundant since projects' `tsconfig.json` files already
reference the runtime tsconfig file, which would reference the
dependencies.

## Expected Behavior

The `@nx/js:typescript-sync` generator should add project dependencies
as TypeScript project references to each project's runtime tsconfig file
(e.g., `tsconfig.app.json`, `tsconfig.lib.json`, etc.). If the project
only has a `tsconfig.json` file, it should add them to it.

We've observed some performance improvement with this change while
running the `typecheck` tasks.
2025-11-12 17:48:26 +00:00
Jason Jean 5c565ad37f fix(core): optimize batch task scheduling to prevent redundant traversals (#33455)
## Summary

This PR combines two critical performance optimizations for batch task
scheduling and task hashing:

### 1. Batch Scheduling Fix

Fixed a correctness bug in the batch scheduling optimization where the
`visitedInBatch` tracking happened too early. Now tasks are only marked
as visited AFTER all scheduling checks pass, ensuring tasks can be added
to the batch from any valid dependency path.

**Files Modified:**
- `packages/nx/src/tasks-runner/tasks-schedule.ts`

**Impact:**
- Prevents task splitting across unnecessary batch boundaries
- Maintains correctness while optimizing performance
- All batch scheduling tests pass

### 2. Task Output Hashing Optimization

Added a DashMap-based cache to the Rust TaskHasher to prevent redundant
hashing when multiple tasks depend on the same outputs.

**Files Modified:**
- `packages/nx/src/native/tasks/task_hasher.rs` - Added
task_output_cache field
- `packages/nx/src/native/tasks/hashers/hash_task_output.rs` - Implement
cache logic

## Root Cause of Issue #33366

Large project graphs with high dependency fanout exhibit slow
`hashMultipleTasks` because:
- 100+ tasks may depend on the same 10 build tasks' outputs  
- This generates 1,000+ separate `TaskOutput` hash instructions
- Each instruction independently:
  - Lists output files from disk (filesystem I/O)
  - Builds glob patterns
  - Hashes the same files
- Result: Same files hashed 100× redundantly

## Solution: Task Output Cache

The cache key combines glob pattern and sorted output paths. When
identical outputs are hashed with the same pattern:
- First task: computes hash (~milliseconds) and stores in cache
- Remaining 99 tasks: cache hits (~nanoseconds each)

### Cache Lifetime
- `TaskHasher` instantiated once per `hashMultipleTasks` call
- Cache persists for entire hashing session
- Discarded when `hashMultipleTasks` completes
- Optimal scope for cache hit maximization

## Performance Impact

**Expected Improvements:**
- Best case (100 tasks, 10 shared deps): 100× speedup
- Typical monorepo: 10-20× speedup
- No shared deps: No regression (cache lookup negligible)

**Issue #33366 Analysis:**
- Current: `Time for 'hashMultipleTasks' 49351.488518` (49 seconds)
- Expected with optimization: ~5-10 seconds (depending on actual
dependency structure)

## Testing

-  All task scheduling tests pass (2262 passed, 0 new failures)
-  Batch mode tests pass (6/6)
-  Native build completed successfully
-  No regressions in existing functionality

## Design Notes

- Task output cache follows same pattern as `workspace_files_cache`,
`external_cache`, `runtime_cache`
- Thread-safe using DashMap with Arc for Rayon parallel processing
- Instrumented with trace-level logging for cache hits/misses
- Cache automatically cleaned up when TaskHasher is dropped
2025-11-12 12:08:18 -05:00
Leosvel Pérez Espinosa ba893a13b0 cleanup(angular): handle ng-packagr changes to browserslist (#33457)
Updates the `ng-packagr` executors to support a breaking change in v21.
This needs to be done in advance because we use the published
`@nx/angular` executors to build the `@nx/angular` source code. To
update to Angular v21, we need this change to be merged, released, and
installed in the Nx repository so that we can build the `@nx/angular`
package containing the support for Angular v21.
2025-11-12 10:44:41 -05:00
Leosvel Pérez Espinosa 19dbf55206 fix(core): remove system metrics collection and reporting (#33456)
Removes system metrics collection and reporting.
2025-11-12 09:55:09 -05:00
Jack Hsu 3d48b75202 feat(core): export TypeScript schema definitions via wildcard patterns (#33454)
Users cannot import TypeScript schema definitions or schema.json files
from Nx packages due to strict package exports introduced in Nx 21.0.0.

Users can now import both TypeScript definitions and JSON schemas from
generator/executor/builder paths using wildcard export patterns. Both
first-level (`*`) and second-level (`*/*`) patterns are supported to
handle different import depths.

Note: For old plugins that had `src/...` deep imports we keep those in
`exports`, but for newer plugins that always used `exports` we skip
`src/` in the export path. So `@nx/nuxt/generators` instead of
`@nx/nuxt/src/generators`.

Fixes #33336
2025-11-12 09:43:12 -05:00
MaxKless 26a7e4fca7 feat(core): pull nx init from latest before executing (#33446)
## Current Behavior
nx init is executed with whatever version is installed globally by npm
(might be outdated)

## Expected Behavior
we pull down the latest version from npm (if it has provenance) and run
that when executing.
Also introduced a new `NX_USE_LOCAL` env var that will be respected by
all commands that have this pulling-from-latest behaviour.
2025-11-12 12:01:37 +01:00
Benjamin Cabanes 7ca6680e03 docs(nx-dev): add Pricing link to Nx Cloud navigation menus (#33452)
Added a "Pricing" link to the Nx Cloud navigation sections.
2025-11-11 20:11:11 +00:00
Jack Hsu 5fa1c18dea chore(repo): bump to Node 24 (#33441)
Update CI to Node 24. Note that the e2e-release changes are pulled from
the original PR.

Note: There are changes to NPM 11 (Node 24) to make it run slower than
NPM 10 (Node 20/22) for publish. (https://github.com/nrwl/nx/pull/31934)

e.g. https://github.com/npm/cli/releases/tag/v11.0.0-pre.1 (`Upon
publishing, in order to apply a default "latest" dist tag, the command
now retrieves all prior versions of the package.` which incurs more
network cost)
2025-11-11 15:10:09 -05:00
Jason Jean 647d75116b chore(repo): update nx to 22.1.0-beta.8 (#33451)
Updating Nx from 22.1.0-beta.7 to 22.1.0-beta.8
2025-11-11 14:26:09 -05:00
Jason Jean 12422ae3ea fix(graph): add nx:build-native dependency to typecheck target (#33428)
## Current Behavior

The typecheck target in graph/client/project.json only depends on
^typecheck targets from other projects.

## Expected Behavior

The typecheck target now includes nx:build-native as a dependency to
ensure native dependencies are built before type checking.

## Related Issue(s)

This fix resolves typecheck failures caused by missing native
dependencies.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: FrozenPandaz <FrozenPandaz@users.noreply.github.com>
2025-11-11 13:38:11 -05:00
Philip Fulcher db09e106e9 docs(nx-dev): add video link to task analytics article (#33450) 2025-11-11 12:20:24 -06:00
MaxKless ab7db78b04 feat(maven): add option to prefix all maven targets (#33420)
## Current Behavior
there is no way to generally influence how maven goals/phases are
represented as targets in nx. This could be useful though for organizing
targets in nx, for example through nx.json `targetDefaults`

## Expected Behavior
There's a `targetNamePrefix` plugin option that can be passed.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: MaxKless <MaxKless@users.noreply.github.com>
2025-11-11 13:16:01 -05:00
Jason Jean 6121a12368 chore(repo): update nx to 22.1.0-beta.7 (#33431)
Updating Nx from 22.1.0-beta.6 to 22.1.0-beta.7
2025-11-11 17:07:01 +00:00
Leosvel Pérez Espinosa 8f3b0b22a7 fix(core): resolve lockfile cache regression with keyMap state (#33448)
After PR #33256 split lockfile parsing into separate node and dependency
caches, a regression occurred where dependencies could be regenerated
without nodes, leaving a shared module-level variable (`keyMap`) empty
and causing incorrect dependency resolution.

Changes:
- Serialize `keyMap` with nodes cache to maintain state between phases
- Remove module-level shared state from pnpm, npm, and yarn parsers
- Move `keyMap` creation inside `getNodes` functions for better
encapsulation
- Update `readCachedExternalNodes` to deserialize `keyMap` internally
2025-11-11 16:52:05 +00:00
Jack Hsu 3c85af93af chore(misc): upgrade macOS GitHub Actions runners (#33444)
Update from the macos-13 is in brownout and will be gone soon.

- macos-15-intel for x86_64-apple-darwin (Intel) builds
- macos-latest for aarch64-apple-darwin (ARM64) builds

Closes NXC-3444
2025-11-11 11:51:49 -05:00
Colum Ferry 00a247be3f feat(vitest): support vitest 4 (#33424)
## Current Behavior
We currently only generate vitest projects using Vitest 3

## Expected Behavior
Use Vitest 4 when generating new projects

## Related Issue(s)

Closes NXC-3343
Closes NXC-3379

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-11 10:20:14 -05:00
Leosvel Pérez Espinosa 6d0523e326 fix(core): clean up dead processes from metrics (#33437)
Fixes a regression where dead processes were not being cleaned up from
the metrics reporting.
2025-11-11 09:53:37 -05:00
James Henry 3439ff10e7 feat(release): add resolveVersionPlans option to changelog CLI and API (#33435) 2025-11-11 18:53:14 +04:00
Nicole Oliver 806e9a83af docs(nx-cloud): clarify Github integration details (#33433)
Clarifies some details of the Nx Cloud GitHub integration, such as which
features are available when you use the base integration vs a GitHub
powered organization.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->
2025-11-11 09:33:43 -05:00
Colum Ferry 4509d95b3b fix(release): changelog renderer should render commit title with breaking changes (#33439)
## Current Behavior
We do not render the commit title in the BC section of generated
changelogs.

## Expected Behavior
We should render the commit title in the BC section of generated
changelogs along with the Remote Release Client reference to the commit.

## Related Issue(s)

Closes NXC-3290
2025-11-11 13:20:46 +00:00
Colum Ferry 9513a1f89c fix(vitest): do not fail when cleanedAngularVersion is of incorrect type (#33436)
## Current Behavior
There may be a scenario when `cleanedAngularVersion` is of type `object`
rather than `string` which proceeds to error when passed to
`semver.major()`.

## Expected Behavior
If `cleanedAngularVersion` is not `string`, assume the latest version
will be installed. Similar to how no found angular version is handled.

## Related Issue(s)

Fixes #33347
2025-11-11 11:25:33 +00:00
Leosvel Pérez Espinosa 843c041396 fix(js): improve typescript plugin performance (#33425)
- Fix for a bug with the external project references cache
- Add more caching for repeated operations
- Skip tsconfig files processing based on which targets should be
inferred

Fixes #33076
2025-11-11 10:04:43 +01:00
Jason Jean 93e0b21d97 fix(js): update vitest generator import in library generator (#33430)
## Current Behavior
The library generator has an unused import and incorrect import pattern
for the vitest generator.

## Expected Behavior
Clean imports with the correct way to access the configurationGenerator
from @nx/vitest.

## Changes
- Removed unused imports (logger, readJson)
- Updated vitest generator import to use direct require instead of
ensurePackage pattern for accessing the generator

Fixes #
2025-11-10 22:31:21 +00:00
Jack Hsu 98b2ab42e6 chore(repo): force storybook@9 so types resolve (#33429)
Master has v9 in lockfile, but it's not a guarantee. This forces v9
until we have a better solution to resolve v10 types.
2025-11-10 16:47:16 -05:00
Colum Ferry 6b54d6acf6 fix(storybook): remove optional nature of migration (#33427)
## Current Behavior
The Storybook 10 migration was originally intended to be optional.

## Expected Behavior
Make Storybook 10 migration add the migration generator to
migrations.json always. Users can remove it from here if they do not
want it, or they can use the Migrate UI from Nx Console to choose not to
run it.
2025-11-10 20:11:43 +00:00
Jason Jean 73ecb30491 chore(repo): update nx to 22.1.0-beta.6 (#33423)
Updating Nx from 22.1.0-beta.5 to 22.1.0-beta.6
2025-11-10 19:11:25 +00:00
Colum Ferry e581c3c437 feat(vitest): split entrypoint into plugin, generators, executors (#33426)
Split entry point of `@nx/vitest` into `index.ts` for the Inference
Plugin, `generators.ts` for Generators, `executors.ts` for the
Executors.
Ensure the `README.md` is copied to the correct output directory

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-10 18:29:37 +00:00
Colum Ferry 685e497c4f feat(vitest): split vitest into @nx/vitest plugin (#33311)
Split `vitest` out of `@nx/vite` and create a new `@nx/vitest`.

This allows for each plugin to have a single responsibility. One for
bundling, one for testing.

It should allow for lighter setups where Vite for Bundling is not
required, but users still want to use vitest for testing.

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
2025-11-10 16:22:47 +00:00
Jason Jean 7a3179241e chore(repo): update storybook (#33422)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Storybook was accidentally downgraded to 9.1.9

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Storybook is upgraded back to 10.0

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-10 10:51:17 -05:00
Leosvel Pérez Espinosa 22618b6be9 feat(testing): support cypress v15 (#33393)
## Current Behavior

Cypress v15 is not supported.

## Expected Behavior

Cypress v15 should be supported.

## Related Issue(s)

Fixes #33304

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: leosvelperez <leosvelperez@users.noreply.github.com>
2025-11-10 10:50:50 -05:00
Jack Hsu 60089cc998 chore(expo): run export before e2e to mitigate timeout (#33414)
CI and nightlies can flake out during expo test if cypress or playwright
times out waiting for webserver. This makes is to the `export` that
powers `static-serve` is run before running e2e.

This is not usually a problem in new workspaces with inference, but this
legacy test uses executors so continuous task dependency isn't set up.
2025-11-10 10:19:57 -05:00
Louie Weng a0a3289112 chore(gradle): bump plugin for gradle version to 0.1.9 (#33419)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Nx plugin for Gradle is at version 0.1.8

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Nx plugin for Gradle is at version 0.1.9

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-10 09:53:48 -05:00
Leosvel Pérez Espinosa 373066a379 feat(core): track system metrics and link plugins to workers when possible (#33411)
- Track relevant CPU and memory system metrics.
- Link plugins to workers when possible.
- Refactor collector code by splitting it into two separate structs.
2025-11-07 23:29:36 +00:00
Caleb Ukle 7458b52b4e docs(nx-cloud): document new flaky tasks analytics (#33253)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-07 16:10:30 -05:00
Jack Hsu 4170c2f82b docs(js): update node compat matrix (#33415)
Update it for v22.
2025-11-07 16:10:03 -05:00
Caleb Ukle 2182cea451 cleanup(repo): use mise for agent toolchain installs (#33299)
also dedupe agent launch templates with yaml anchors for better
readability
2025-11-07 14:01:48 -06:00
Philip Fulcher 777217618e docs(nx-dev): add task analytics article (#33407)
https://nx-dev-git-philip-task-analytics-article-nrwl.vercel.app/blog/nx-cloud-release-introducing-enterprise-task-analytics
2025-11-07 13:37:39 -06:00
Jason Jean 746b89a901 feat(maven): bump version from 0.0.8 to 0.0.9 (#33405)
## Current Behavior

Maven plugin is currently at version 0.0.8.

## Expected Behavior

Maven plugin should be bumped to version 0.0.9 with a corresponding
migration for users.

## Changes Made

- Updated parent POM version to 0.0.9
- Updated package.json version to 0.0.9  
- Updated mavenPluginVersion constant to 0.0.9
- Added new migration (0-0-9) to update user pom.xml files from 0.0.8 to
0.0.9
- Scheduled migration for Nx v22.1.0-beta.6

## Testing

-  Maven package tests pass
-  Build succeeds
-  Linting passes
2025-11-07 13:07:36 -05:00
MaxKless b395cec4cd feat(maven): add ci-workflow generator (#33346)
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2025-11-07 16:21:15 +00:00
James Henry a6948665e6 fix(core): correctly identify local workspace dependencies on windows (#33408) 2025-11-07 15:08:45 +04:00
Philip Fulcher 790358af91 docs(nx-dev): add november 2025 webinar (#33403)
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: philipjfulcher <philipjfulcher@users.noreply.github.com>
2025-11-06 14:13:29 -06:00
MaxKless e9146c7862 fix(core): prevent args from being split by spaces when executing through nx wrapper (#33362)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Because `./nx` is passing args with `$@`, args are being split by
spaces. Reference for this behaviour:
https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html#Special-Parameters-1

This results in this set of process args when running `./nx start-ci-run
--distribute-on="3 linux-medium-jvm"`

```
[
  "<user path>/.nvm/versions/node/v22.19.0/bin/node",
  "<user path>/Projects/OTW/mm-test/.nx/nxw.js",
  "start-ci-run",
  "--distribute-on=3",
  "linux-medium-jvm",
]
```

## Expected Behavior
the arg with whitespace should not be split before being passed to nx:
```
[
  "<user path>/.nvm/versions/node/v22.19.0/bin/node",
  "<user path>/.nx/nxw.js",
  "start-ci-run",
  "--distribute-on=3 linux-medium-jvm",
]
```
2025-11-06 13:42:07 -05:00
Jack Hsu 62d0ad7f25 chore(repo): rename jest.config.ts to jest.config.cts to be compat with Node 24 strip types (#33401)
This PR is just for the repo itself to use `.cts` to explicitly use CJS
for jest config. Node 24 strip types so having `.ts` files with ESM
syntax even though we're previously transpiling them to CJS is a
problem.
2025-11-06 13:36:44 -05:00
Leosvel Pérez Espinosa e470b2c64a feat(core): disable interactivity by default for run-one task outputs in tui (#33358)
Make run-one task terminal outputs in the TUI non-interactive by
default. Most tasks don't need interactivity, and it causes TUI to
ignore all its key bindings because it forwards them to the underlying
program. If interactivity is needed, users can press `i` to enable it.
2025-11-06 13:25:07 -05:00
Louie Weng 28e778a1f9 feat(gradle): use gitignore to determine dependant task output files (#33402)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Currently we detect if inputs are found in the build directory to
determine if they are considered dependent task output files. We can use
a simpler heuristic instead.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

If an input is gitignored (and therefore not hashed by Nx), then we
consider it a dependant task output file. This gitignore classifier will
be a mirror of the class used within the Maven plugin. There will be
another PR to move this classifier into a shared kotlin project that can
be used between both projects.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-06 13:20:06 -05:00
Jason Jean 61442118cf fix(maven): forward parameters through target dependencies (#33365)
## Current Behavior

Maven target dependencies are defined as simple strings that reference
other targets. Currently, parameters are not forwarded through these
dependencies when Maven goals are executed.

## Expected Behavior

Target dependencies in Maven should forward parameters (args) to their
dependency targets, enabling better parameter propagation through the
build pipeline.

## Changes Made

Modified `NxTargetFactory.kt` to transform simple string dependency
references into structured dependency objects with explicit parameter
forwarding:

- Install dependencies now forward parameters
- Phase dependencies now forward parameters  
- Test dependencies now forward parameters
- CI target dependencies now forward parameters

This ensures that when a Maven goal executes, any parameters passed to
it are properly forwarded to all transitive target dependencies.

## Related Issue(s)

This change enables parameter passing through Maven target dependencies
via the new dependency object format with `"params": "forward"`.
2025-11-06 11:56:14 -05:00
Jack Hsu 9b5768e7fe fix(testing): use .cts config files for Jest 30+ to fix __dirname issues (#33349)
When using Jest 30 with SWC, users are seeing an error where `__dirname`
is not defined for ESM modules. This is because the `.ts` extension is
type-stripped by Node 22.17/24+ via checking for
[`process.features.typescript`](https://github.com/jestjs/jest/blob/fe7f28c9d1941f5c2726831cd9d9e479b401610e/packages/jest-config/src/readConfigFileAndSetRootDir.ts#L46).

This means that instead of using the `commonjs` we set for `ts-node`,
normal Node resolution kicks in, and is now treating `jest.config.ts` as
ESM.

This PR fixes this issue by using an explicit `.cts` extension, which
forces CommonJS that we assume for Jest configs.

Note: For Jest 29 or earlier we need to keep `jest.config.ts` since the
`.cts` extension is not supported prior to Jest 30.

There's also a fix for an existing issue where using `module.exports` of
anything else from `@types/node` will error out if `tsconfig.json` has a
`types` field but does not include `node`. See:
https://www.loom.com/share/7ebe3c90a70e4ec7bfa53cbcccaaea7d

Fixes #32236

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-06 10:25:39 -05:00
MaxKless cde5ee8c83 docs(misc): add information about nx console debug logging (#33398) 2025-11-06 15:42:01 +01:00
Colum Ferry f2072f01f2 feat(storybook): generate ai instructions for converting from CJS to ESM after migration (#33395)
## Current Behavior
Storybook 10 Changelog states that CJS is no longer supported.
The migration does not do this automatically.

https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#the-storybookmain-file-and-other-presets-must-be-valid-esm

## Expected Behavior
Generate instructions for an AI Agent to find and convert CJS Storybook
Config files to ESM.

## Related Issue(s)

Fixes NXC-3409
Fixes NXC-3336
2025-11-06 14:28:18 +00:00
Juri 2e5844c61b docs(module-federation): change terminal output to shell frame 2025-11-06 14:52:17 +01:00
Juri 58cbbf20bd docs(nx-dev): link nx 22 release video 2025-11-06 14:51:56 +01:00
Jack Hsu 603e7c0bb6 docs(misc): fix ToC overflow and height stretching issues (#33384)
This PR fixes the ToC so it does not overflow to the footer. It adjusts
the height calculation such that it takes up the entire height of the
main frame.

The extra top margin is removed from the footer to remove the extra gap
between main frame and footer.

BEFORE: 

<img width="1387" height="915" alt="image"
src="https://github.com/user-attachments/assets/e7f4d31c-a206-48ab-81e6-9fddfee11b18"
/>


AFTER:

<img width="1385" height="916" alt="image"
src="https://github.com/user-attachments/assets/cf6e2662-3c3d-4d37-9769-235b901cc188"
/>

<img width="1382" height="918" alt="image"
src="https://github.com/user-attachments/assets/9e142edf-259b-482a-b676-9333857ed776"
/>



Fixes DOC-224

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-06 08:43:56 -05:00
Jack Hsu f5d97e3047 fix(nx-dev): fix GitHub star button styling in mobile view (#33385)
This PR fixes the GitHub star widget in the left sidebar such that it
only shows in smaller screens (e.g. mobile). For desktop we have it in
the ToC.

Also styles it to be consistent with the login and sign up buttons.

Large screen, don't show:

<img width="1483" height="881" alt="image"
src="https://github.com/user-attachments/assets/d3c88d87-4905-4c3f-85c4-b7b4c14546d4"
/>


Smaller screen, show:

<img width="1136" height="811" alt="image"
src="https://github.com/user-attachments/assets/22aa652f-c523-493f-a01e-87e55934e1c9"
/>

Mobile view, show:

<img width="511" height="880" alt="image"
src="https://github.com/user-attachments/assets/283ffca2-4e4e-4706-811f-ce27b02e607b"
/>


Fixes DOC-325
2025-11-06 08:43:26 -05:00
Juri a032099138 docs(dotnet): add paragraph about adding a .net app 2025-11-06 14:40:40 +01:00
Colum Ferry f549ef290f feat(vite): add vitest 4 to peerDep range to prevent conflicts (#33394)
## Current Behavior
`@nx/vite` has a peerDep range of only `1 | 2 | 3` for `vitest`.
This will cause peer dep conflicts for using wishing to use Vitest 4.

## Expected Behavior
Add Vitest 4 to the peerDep range of `@nx/vite` to prevent conflicts.
2025-11-06 10:36:10 +00:00
MaxKless a020954987 fix(core): handle various directories when importing prettier (#33383)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
when trying to format with prettier while outside of the workspace (for
example in a `tmp` nx installation like is created during
`configure-ai-agents`), resolving prettier could fail even though it's
present in the actual workspace.

## Expected Behavior
resolving prettier works if it's available in either the proper
workspace or the tmp one by specifying `paths` in `require.resolve`
2025-11-05 17:02:32 -05:00
Jason Jean cfcf109450 chore(repo): enable NX_CLOUD_ENABLE_METRICS_COLLECTION in CI (#33387)
Enables NX_CLOUD_ENABLE_METRICS_COLLECTION in the CI workflow.
2025-11-05 16:48:03 -05:00
Jason Jean ba6ca6c5ae chore(repo): update nx to 22.1.0-beta.5 (#33386)
Updating Nx from 22.1.0-beta.4 to 22.1.0-beta.5
2025-11-05 15:40:45 -05:00
Leosvel Pérez Espinosa a98b524f06 feat(core): collect resource usage (#32946)
Adds resource usage collection while running tasks.
2025-11-05 18:56:12 +00:00
Colum Ferry f6bc122c0b feat(nextjs): add support for next 16 (#33296)
## Current Behavior
We currently support Next 14 and 15.

## Expected Behavior
Add support for Next 16, bringing support to 14, 15, 16.
Existing workspaces will continue to use the version they are on.
New workspaces will use Next 16.

Refer to Next 16 Migration Guide for migrating from Next 15 to 16

## Related Issue(s)

Fixes #33207

---------

Co-authored-by: Eric Büttner <eric.buettner@tuffz.com>
2025-11-05 17:31:31 +00:00
Craigory Coppola b97f666a4e chore(repo): remove --fix-tasks config that exists to exclude removed task (#33371)
This pull request makes a minor update to the CI workflow configuration.
The change simplifies the `Start CI Run` step by removing the
`--fix-tasks="!*check-commit*"` option from the `npx nx-cloud@next
start-ci-run` command.
2025-11-05 10:46:31 -05:00
Colum Ferry 1b7d0955a2 fix(module-federation): update @module-federation packages to fix Koa vulnerability (#33285) (#33380)
Updates @module-federation packages from 0.18.0 to 0.21.2 and
@module-federation/node from 2.7.11 to 2.7.21 to address Koa Open
Redirect vulnerability (CVE: GHSA-g8mr-fgfg-5qpc).

The vulnerability was in transitive dependencies:
@nx/react → @nx/module-federation → @module-federation/enhanced →
@module-federation/dts-plugin → koa@3.0.1-3.0.2

Changes:
- Updated package.json dependencies in @nx/module-federation and
@nx/rspack
- Updated version constants in Angular and React utils/versions.ts
- Added 22.2.0 migrations to all affected packages

Fixes #33285
2025-11-05 10:41:28 -05:00
Jack Hsu bc47ab8ce9 docs(react): update SVGR documentation for Nx 22 (#33370)
This PR clarifies that Nx 22 removed SVGR support from Next.js and React
(Webpack/Rspack).

<img width="942" height="1185" alt="image"
src="https://github.com/user-attachments/assets/6ea8393f-b037-489f-804b-eb06d8d07e4c"
/>

Previously we had this option `svgr: true` but was configurable and
didn't align with current best practices like `import Logo from
'./logo.svg?react'`. We removed it from Nx 22, provided a migration, but
users will be confused by the docs.

Fixes DOC-326
2025-11-05 10:21:50 -05:00
Juri Strumpflohner 26aca9e5ec docs(nx-dev): fix broken URL to monorepo tools (#33381)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-05 09:32:30 -05:00
Juri Strumpflohner 18557f8af4 docs(misc): various updates embedding videos in docs pages 2025-11-04 21:54:36 +01:00
Leosvel Pérez Espinosa c933660b88 cleanup(core): remove unused mouse event listeners from tui (#33368)
Cleans up unused mouse event listeners from the TUI.
2025-11-04 13:21:10 -05:00
MaxKless c2fba1f6fc cleanup(core): update the nx orb version used in circle ci generators (#33364) 2025-11-04 14:47:56 +00:00
Colum Ferry 83051c5c62 fix(vite): ensure createVitest looks only from projectRoot (#33361)
## Current Behavior
`createVitest` is looking at the full workspace every time. It should
only look at the directory with the config file.

## Expected Behavior
Pass the root as the projectRoot of the config file found.
2025-11-04 09:11:45 -05:00
Jason Jean 2d78f571b4 chore(repo): update nx to 22.1.0-beta.4 (#33350)
Updating Nx from 22.1.0-beta.3 to 22.1.0-beta.4
2025-11-03 17:56:26 -05:00
Jason Jean 4017b61ede feat(core): add OSC 9;4 progress indicator support to TUI (#33325)
## Current Behavior

The Nx TUI doesn't provide any visual feedback about task progress
outside of the terminal window itself. Users need to keep the terminal
visible to see task completion status.

## Expected Behavior

With this PR, the TUI now displays real-time task completion progress in
the terminal window chrome (tabs, title bars, dock icons) using the OSC
9;4 escape sequence. This provides at-a-glance progress feedback even
when the terminal is minimized or in the background.

## Related Issue(s)

N/A - This is a new feature enhancement

## Implementation Details

### What is OSC 9;4?
OSC 9;4 is a terminal escape sequence for displaying progress
indicators, originally from ConEmu and now supported by multiple modern
terminals.

### Key Changes
- Added `update_ghostty_progress()` method to calculate and display task
completion percentage
- Added `clear_ghostty_progress()` method to hide progress when done
- Integrated progress updates into task lifecycle (start, status update,
exit)
- Uses ST terminator (`\x1b\\`) for maximum terminal compatibility
- Writes to stderr to avoid conflicts with TUI rendering on stdout

### Supported Terminals
- **Ghostty** - Full support
- **Windows Terminal** (v1.6+) - Full support
- **VTE-based terminals** (GNOME Terminal, Ptyxis) - Full support
- **Other terminals** - Gracefully ignore sequences (no errors)

### Terminal Compatibility Note
The implementation uses the ST (String Terminator) escape sequence
rather than BEL, as this is preferred by Ghostty and required by
VTE-based terminals, while remaining compatible with Windows Terminal.

## Testing

Tested with:
- Building the native module successfully
- Rust formatting and linting passes
- Running nx commands with the TUI active

The progress indicator updates in real-time as tasks complete and clears
automatically when the TUI exits.
2025-11-03 13:27:18 -05:00
Jason Jean 0acc8b0988 feat(core): batch hash tasks without custom hashers (#33327)
## Current Behavior

When processing scheduled batches, tasks are hashed one at a time even
though the hasher has a `hashTasks` method for batch hashing.

Results from a batch with 109 tasks.
```
hash batch: 8.297s
```

## Expected Behavior

Tasks without custom hashers should be batch-hashed using the hasher's
`hashTasks` method for better performance.

Results from a batch with 109 tasks.
```
hash batch: 991.725ms
```

## Related Issue(s)

This is a performance optimization for task hashing.

---

**Changes:**

- Added a new `hashTasks` function that intelligently separates tasks
with custom hashers from those without
- Tasks with custom hashers are hashed individually using `Promise.all`
- Tasks without custom hashers are batch-hashed using the hasher's
`hashTasks` method
- The function automatically filters out tasks that already have a hash
- Updated `processScheduledBatch` in task-orchestrator to use this new
function
2025-11-03 13:27:06 -05:00
Colum Ferry a084f205f9 fix(vite): ensure atomizer does not consider projects outside the project root (#33344)
## Current Behavior
Vitest's `createVitest` can be over-eager and include other projects in
the workspace when finding relevant test specifications.
This leads atomizer to look at relative paths outside the project root.

## Expected Behavior
Ensure that the plugin does not look at projects outside the project
root.
2025-11-03 16:46:57 +00:00
Jason Jean 8cc052f351 chore(repo): update nx to 22.1.0-beta.3 (#33341)
Updating Nx from 22.1.0-beta.2 to 22.1.0-beta.3
2025-11-03 11:30:25 -05:00
Jason Jean d64f45879b fix(maven): set migration version to 22.1.0-beta.4 (#33345)
## Current Behavior

The Maven migration version was incorrectly set to `0.0.8-beta.0` in the
migrations.json file.

## Expected Behavior

The migration version should be set to `22.1.0-beta.4` to align with the
Nx release version.

## Related Issue(s)

Fixes the migration version discrepancy in the Maven plugin.
2025-11-03 11:30:12 -05:00
Juri Strumpflohner 8f7c635894 docs(nx-cloud): embed self-healing ci videos (#33338)
Embeds videos about self-healing CI into the corresponding feature doc

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-11-03 11:25:03 -05:00
Jason Jean 7e0f66dbf3 feat(maven): upgrade to version 0.0.8 with automated migration (#33315)
## Current Behavior

The Maven plugin is at version 0.0.7 with no automated migration path
for users to upgrade their pom.xml files.

## Expected Behavior

Users can upgrade to Maven plugin 0.0.8 and have their pom.xml files
automatically updated via the Nx migration system.

## Changes Made

- Updated Maven plugin version from 0.0.7 to 0.0.8 in:
  - `packages/maven/package.json`
  - `packages/maven/src/utils/versions.ts`
  - `packages/maven/maven-plugin/pom.xml`

- Created `updateNxMavenPluginVersion()` utility function with:
  - Proper XML parsing using `@xmldom/xmldom` DOM API
  - Targeted updates only for `dev.nx.maven:nx-maven-plugin` elements
- Safe handling of all other version elements (dependencies, parent,
project, etc.)
  - Comprehensive error handling

- Added migration `0-0-8/update-pom-xml-version.ts` that:
  - Automatically runs when users upgrade to 0.0.8
  - Updates root pom.xml files via the utility function
  - Logs status of migrations performed

- Registered migration in `migrations.json`

- Added comprehensive unit tests (9 test cases):
  - Updates only the nx-maven-plugin version
  - Does not update other plugin versions
  - Handles missing files gracefully
  - Preserves XML formatting and structure
  - Handles multiple plugin references
  - Handles whitespace correctly
  - Only updates plugins, not parent/project versions
  - All tests passing (27/27)

## Test Plan

- [x] Unit tests pass (27 passing tests)
- [x] XML parsing correctly identifies and updates only
`dev.nx.maven:nx-maven-plugin`
- [x] Other version elements remain untouched
- [x] Migration registration validated
2025-11-03 10:49:18 -05:00
Craigory Coppola b401e6e348 feat(core): enable tui by default on windows (#33314)
## Current Behavior:

Tui is working, but only able to be enabled on windows via env vars or
explicit command line config

## Expected Behavior:

Tui is default on
2025-11-03 09:56:26 -05:00
Craigory Coppola a5d34fd9f9 chore(repo): add .NET format check + codeowners and unify native target handling (#33323)
## Current Behavior
Maven and .NET use a bespoke script to handle skipping an optional
native target in case a system is not setup on a dev's machine.

.NET isn't in codeowners

## Expected Behavior
This pull request introduces improvements to the build and formatting
workflows for the `.NET` and Maven plugins, streamlining the execution
of native targets and updating code ownership assignments. The changes
focus on refactoring build scripts to use a unified runner, adding new
formatting capabilities for .NET projects, and updating the CODEOWNERS
file for clearer team responsibilities.

**Build and Format Workflow Improvements**

* Refactored the `.NET` analyzer build command in
`packages/dotnet/project.json` to use the new `run-native-target.js`
script, replacing the previous direct script invocation.
[[1]](diffhunk://#diff-036c1a7f2e7d98f5a3207441f2ff1cb25b5b5a03343672ce473f4ff0189a5946L25-R25)
[[2]](diffhunk://#diff-42d990ddcbf8d3585553503097ee8b8d1fff8cb6e25e0cd545a87e11d64c03a8L1-L7)
* Added new `format-native` and `_format-native` targets to
`packages/dotnet/project.json`, enabling verification and fixing of code
formatting for the .NET analyzer using `dotnet format`.

**Unified Native Target Runner**

* Introduced the `scripts/run-native-target.js` script to standardize
running native build and install targets, controlled by environment
variables for skipping builds.

**Maven Plugin Build Refactor**

* Updated the Maven plugin's install workflow in
`packages/maven/maven-plugin/project.json` to use the new native target
runner, and removed the obsolete `scripts/build-maven-analyzer.js`
script.
[[1]](diffhunk://#diff-2763fe8a7c2989643f53370a14a08c06616e85c29340fd5bcfa1a67d0deaee7aL11-R11)
[[2]](diffhunk://#diff-972edab06956ad35145cbc20b8e250e7067fbb288b1f99c92661c24f64d3e69dL1-L7)

**Ownership Updates**

* Updated the `CODEOWNERS` file to assign `.NET`-related directories to
`@FrozenPandaz` and `@AgentEnder`, clarifying team responsibilities.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-11-01 13:30:41 -04:00
Colum Ferry 4507b5a03b feat(storybook): add support for storybook 10 (#33277)
## Current Behavior
We support Storybook 8 and 9


## Expected Behavior
Add support for Storybook 10, bringing Storybook support to 8, 9 and 10

## Related Issue(s)

Fixes #33141
2025-10-31 17:11:22 +00:00
Colum Ferry d7c8f6e772 chore(repo): add vitest scope (#33317) 2025-10-31 17:05:10 +04:00
Jason Jean 4fcdc9542e fix(maven): resolve maven dependencies from project roots (#33313)
## Current Behavior

Maven dependencies were not being resolved correctly from project roots,
which affected the dependency analysis in monorepos with Maven projects.

## Expected Behavior

Maven dependencies should be properly resolved from each project's root,
allowing Nx to correctly understand the project graph for Maven-based
projects.

## Changes Made

- Updated Maven plugin Kotlin code to properly resolve dependencies from
project roots
- Fixed devkit internal utilities to properly handle Maven dependency
resolution
- Updated TypeScript dependencies plugin to align with the new
resolution logic

## Files Changed

-
`packages/maven/maven-plugin/src/main/kotlin/dev/nx/maven/NxProjectAnalyzer.kt`
-
`packages/maven/maven-plugin/src/main/kotlin/dev/nx/maven/NxProjectAnalyzerMojo.kt`
- `packages/maven/src/plugins/dependencies.ts`
- `packages/dotnet/src/plugins/create-dependencies.ts`
- `packages/devkit/internal.ts`
- `packages/nx/src/devkit-internals.ts`

Fixes #XXXXX

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-10-30 18:17:48 -04:00
Craigory Coppola 29a61429a5 chore(repo): enable codeql for csharp code (#33301)
## Current Behavior
CodeQL is not enabled for C#, but C# is in the nx repo

## Expected Behavior
CodeQL is enabled on C#

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-30 17:33:30 -04:00
Jack Hsu b28366395f fix(vite): prevent race-condition when importing @vitejs/plugin-vue (#33307)
This PR primes the cache for `@vitejs/plugin-vue`, similar to how we
already do for `esbuild`. When `vite.config.ts` is compiled into CJS,
then doing `require('@vitejs/plugin-vue')` may error with a race
condition if an `import` of the same module is in progress.

Fixes #NXC-3289

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-10-30 12:33:47 -04:00
Colum Ferry 4ec3a99544 chore(node): do not have assertions around killPorts (#33294) 2025-10-30 10:35:33 -04:00
Jack Hsu 9c326bb8e9 chore(repo): use vitest.config.mts to force ESM (#33310)
If it is resolved as CJS it may run into issues?
2025-10-30 10:34:26 -04:00
MaxKless 0347e67334 feat(misc): remove CI investigation recommendations from agent rules (#33309)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
there are recommendations for using the CIPE fixing tools but they are
being removed

## Expected Behavior
removed tools should not be mentioned anymore.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-30 10:33:14 -04:00
Copilot ad0b44f05f docs(maven): add nx show projects, update command example to nx verify, and simplify configuration (#33302)
Completed Maven documentation updates:

- [x] Add `nx show projects` command to display Maven projects after
initialization
- [x] Change example from `nx build` to `nx verify` 
- [x] Simplify configuration section to use `plugins: ["@nx/maven"]`
with defaults
- [x] Update configuration description to accurately explain how targets
are created

## Summary

Successfully updated the Maven plugin documentation:

1. **Added `nx show projects` command** - Shows users how to list
discovered Maven projects after running `nx init`
2. **Changed example to `nx verify`** - Uses a more appropriate Maven
lifecycle phase that includes tests and verification
3. **Simplified configuration** - Updated the configuration section to
show the simpler string array syntax `plugins: ["@nx/maven"]`
4. **Corrected target creation description** - Updated the text to
accurately explain that `@nx/maven` automatically retrieves information
about projects from Maven and creates targets for each phase, goal, and
some additional targets for CI

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Expand this section
https://nx.dev/docs/technologies/java/maven/introduction#add-nx-to-a-maven-workspace
> 
> With instructions to run the following
> 
> nx show projects
> 
> To see a list of Maven projects
> 
> And change nx build Maven project to nx verify Maven project
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: FrozenPandaz <8104246+FrozenPandaz@users.noreply.github.com>
2025-10-30 10:05:00 -04:00
MaxKless ac8b58191a chore(repo): refactor dev container setup to work with mise (#33291)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
devcontainer wasn't working reliably

## Expected Behavior
devcontainer should work reliably and reuse the configuration setup we
have for all these different tools that are needed
2025-10-30 09:45:13 -04:00
MaxKless 56633a7b1b fix(core): also look in .nx installation when reading nx.json extends (#33306)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
in a `.nx` installation, `require.resolve` won't find the `extends`
preset nx.json file because there are no root `node_modules`

## Expected Behavior
in a `.nx` installation, the nested `.nx/installation/node_modules` are
also used to try and resolve the preset.
2025-10-30 09:10:50 -04:00
Eric Büttner 2f3b7d09b5 fix(nextjs): ensure eslint-config-next matches Next.js 14 and 15 versions (#30259)
This PR builds on the previous fix that ensured `eslint-config-next` was
correctly installed when using Next.js 15. #30258

Now, the logic has been further refined to dynamically determine the
installed Next.js version and install the corresponding
`eslint-config-next` version accordingly.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

### Current Behavior

- `next@~15.1.4` is installed
- `eslint-config-next@14.2.16` is installed (incorrect for Next.js 15)

### Expected Behavior

If Next.js 15 is detected -> eslint-config-next@15.1.4 is installed
If Next.js 14 is detected -> eslint-config-next@14.2.16 is installed

### GitHub Repo

https://github.com/tuffz/new-nx-with-preset-nextjs

### Steps to Reproduce

1. Run the following command from the official documentation:
`npx create-nx-workspace@latest --preset=next`
3. Open `package.json` and check the installed dependencies

- `next@~15.1.4` is installed
- `eslint-config-next@14.2.16` is installed

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #30257 (& #30258)
2025-10-29 22:53:04 +00:00
Copilot 4a07faf15c docs(nx-dev): add GitHub star widget back to documentation sidebar (#33289)
Adds the "Give us a star" CTA back to the Astro documentation in both
the left navigation sidebar and right table of contents sidebar.

## Implementation

- **Middleware** (`github-stars.middleware.ts`): Fetches star count from
`nrwl/nx` via GitHub GraphQL API with 1-hour cache. Exports
`DEFAULT_STAR_COUNT` (23k) for fallback when `GITHUB_TOKEN` unavailable.

- **Components**: Integrated existing `GitHubStarWidget` React component
into `Sidebar.astro` (bottom of nav) and `TableOfContents.astro` (above
"On this page") using `client:load` hydration.

- **Configuration**: Added middleware to `astro.config.mjs` route
middleware chain.

## Screenshot

![GitHub star widget in
documentation](https://github.com/user-attachments/assets/3d746408-d05b-429d-98ec-1fc8c886646d)

Widget appears in both sidebars showing star count and linking to
https://github.com/nrwl/nx with analytics tracking.

Fixes https://linear.app/nxdev/issue/DOC-268/add-give-us-a-star-cta-back

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `api.npmjs.org`
> - `repo.gradle.org`
> - `staging.nx.app`
> - `telemetry.astro.build`
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/nrwl/nx/settings/copilot/coding_agent)
(admins only)
>
> </details>

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> Issue Title: Add "Give us a star" CTA Back
> Issue Description: e.g.
`nx-dev/ui-common/src/lib/github-star-widget.tsx`
> 
> This goes in the sidebar, but we can also see if we want to put it
elsewhere in the new docs.
> Fixes
https://linear.app/nxdev/issue/DOC-268/add-give-us-a-star-cta-back
> 
> 
> Comment by User 5261ea6c-c70c-4295-a64f-a792be93af22:
> [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> 📋 I wasn't able to determine which GitHub repository to work in.
> 
> I think it's one of these, but can you tell me which one is right?
> 
> Comment by User d484ef82-7f7d-4a95-be09-9d82ca3905dc:
> Waiting for https://linear.app/nxdev/profiles/james to link their
GitHub account. [Click to authorize
→](https://linear.business.githubcopilot.com/linear/auth)
> 
> Comment by User :
> This thread is for an agent session with githubcopilot.
> 
> 


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/nrwl/nx/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JamesHenry <900523+JamesHenry@users.noreply.github.com>
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2025-10-29 14:50:12 -04:00
Caleb Ukle 84b0debba8 docs(nx-cloud): re-split out vcs guides to prevent header overlap in ToC (#33282)
guides couldn't be merged into one page w/ tabs and keep consistent
headers. so we're back to splitting them out. but all under a
source-control-integration parent route. so we don't need to do any
redirects and such as the index route will contain the links to each one
2025-10-29 13:15:19 -05:00
Philip Fulcher b876ced24f docs(nx-dev): revise Nx 22 release article (#33287)
---------

Co-authored-by: Juri <juri.strumpflohner@gmail.com>
2025-10-29 11:59:59 -04:00
Philip Fulcher f52d58675a docs(nx-dev): remove webinar notifier for October webinar (#33295) 2025-10-29 10:06:29 -05:00
Ajit Panigrahi e56abcf517 docs(core): remove duplicate install instructions (#33278)
Removed duplicate information about installing Nx globally.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Duplicate line.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Removed duplicate line.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-29 08:37:31 -05:00
Juri 6b95de3ede docs(nx-dev): add article about Storybook and watching buildable libs 2025-10-29 14:30:34 +01:00
Craigory Coppola 3e6e0681d0 chore(repo): remove files accidentally committed while investigating socket issues (#33284)
Some investigation files were accidentally included in a merge
2025-10-28 18:40:27 -04:00
Jason Jean e97b3fa0e3 chore(repo): update nx to 22.1.0-beta.2 (#33283)
Updating Nx from 22.1.0-beta.1 to 22.1.0-beta.2
2025-10-28 18:24:29 -04:00
Caleb Ukle 221ad580d8 docs(nx-cloud): document missing env vars (#33281)
- add `NX_CLOUD_API` (and nxCloudUrl for nx.json)
- add `NX_NO_CLOUD`

https://6900e6fdb1379200085c29ca--nx-docs.netlify.app/docs/reference/environment-variables#nx-cloud-environment-variables
2025-10-28 15:56:49 -04:00
MaxKless eb4281d7dd fix(core): make sure that gemini contextFileName is string before trying to resolve (#33280)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
the implementation is brittle and will fail if `contextFileName` is not
a string

## Expected Behavior
we should just not handle other things that folks are putting in there.
but not fail

---------

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-10-28 19:34:07 +00:00
Leosvel Pérez Espinosa f76f1ce3df chore(repo): dogfood pnpm catalogs (#33232)
Dogfoods the Pnpm Catalogs feature in the Nx repo. This is the first
step to move all dependencies to Pnpm Catalogs definitions. More work
will be done incrementally later as we consolidate package versions
across the repository.

The initial list of dependencies moved to Pnpm Catalogs is:

- Angular packages
- React packages
- TypeScript packages
- Jest packages
- Rspack packages
- Some common utilities
2025-10-28 19:09:07 +00:00
Jason Jean 54a4eb4da7 chore(repo): update nx to 22.1.0-beta.1 (#33271)
Updating Nx from 22.1.0-beta.0 to 22.1.0-beta.1

---------

Co-authored-by: Craigory Coppola <craigorycoppola@gmail.com>
2025-10-28 14:04:53 -04:00
Craigory Coppola d1653eca05 fix(core): turn v8 serializer off by default but fallback to it if json serialization fails (#33274)
## Current Behavior
We have tried to enable v8 serialization again... but it still seems
problematic. We don't want to revert again... so we evaluated some
options:

1. Disable by default
2. Disable for the single client method we think may be problematic
3. Fall back to JSON if v8 fails
4. Disable by default and still fall back if JSON fails

## Expected Behavior
We decided to update Nx such that the default behavior will be a
combination of #4, and #2. So by default we use JSON, if that
serialization fails we'll try v8... but there's an exception so the
method we know to be an issue will never try v8.

If you opt in to v8 by default, the combo changes to #3 + #2. So, by
default we'd use v8... if it fails try json... never try v8 for
processInBackground

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-28 14:03:58 -04:00
Juri Strumpflohner 160b4cce34 feat(nx-dev): add downloadable resources page and React book blog post 2025-10-28 16:12:39 +01:00
Emilio Heinzmann 1089ffc41b fix(docker): guard commitSha null in plugin interpolation (#33275)
## Current Behavior
Docker plugin assumed `commitSha` was always non-null; when `null`,
`shortCommitSha.slice` caused a runtime error during target
interpolation.

## Expected Behavior
Plugin should succeed even if latest commit SHA cannot be resolved,
simply omitting shortCommitSha-based substitutions.

## Changes
- Added null guard: `shortCommitSha` now set to `commitSha ?
commitSha.slice(0,7) : null`.
- Added test "should not throw when commitSha is null" verifying node /
target creation succeeds.
- No breaking changes; only broadens safe input surface.

## Additional notes
Logic only executes when `commitSha` was previously null (error case);
normal paths unchanged. If consumers interpolate `{shortCommitSha}`,
they should handle possible null (unchanged if interpolation is already
optional).
2025-10-28 13:43:06 +00:00
James Henry f2649cbaa6 feat(vite): add atomizer support for vitest (#33265) 2025-10-28 15:52:34 +04:00
Juri 43a5e163ce docs(nx-cloud): self-healing CI classification customization 2025-10-27 21:44:12 +01:00
Jack Hsu 39df8c9b76 chore(nx-dev): remove link checker from build so it is only checked during CI not deploy (#33272)
This PR removes the need to check links during deploy and instead
enforces it in CI. This removes the need to build astro-docs when
building next.js app.

Reduces Vercel build from 10-11 mins to 6.5 mins.

<img width="1231" height="94" alt="image"
src="https://github.com/user-attachments/assets/ad5d4459-f917-4609-8c00-151f61dc29d6"
/>
2025-10-27 15:58:15 -04:00
Louie Weng 29467dac05 docs(nx-cloud): edit release notes for 2025.07.3 (#33270)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Update release notes entry tor 2025.07.3 - short link support for DTE
summary

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-27 17:08:15 +00:00
Rares Matei 18b3c52a3c chore(repo): run workspace create and rollup tests serially (#33252)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

You can see the issue here:
https://staging.nx.app/cipes/68fba96042d3126ee8ec0d19/analysis?runGroup=18785923031-1-linux

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes BAC-1387
2025-10-27 16:35:43 +00:00
Jack Hsu f36c61f530 fix(webpack): prevent errors when importing @nx/webpack before typescript is installed (#33251)
This PR wraps one of the exports of `@nx/webpack` within a dynamic
function that ultimately requires `tsquery`. This causes an issue in
yarn v1 where `typescript` cannot be resolved thus causing an error when
`@nx/webpack` is imported.

The errors happens on every new workspace that starts from empty:

```
npx create-nx-workspace --preset=ts --pm=yarn
nx add @nx/web
nx g @nx/web:app apps/demo --bundler=webpack
```

Results in:

```

 NX   Cannot find module 'typescript'

Require stack:
- /private/var/folders/p4/6tvkdn_11xlc_2j999ybhbkr0000gn/T/tmp-59809-4kedkj5a1XsO/node_modules/@phenomnomnominal/tsquery/dist/src/ast.js
- /private/var/folders/p4/6tvkdn_11xlc_2j999ybhbkr0000gn/T/tmp-59809-4kedkj5a1XsO/node_modules/@phenomnomnominal/tsquery/dist/src/index.js
- /private/var/folders/p4/6tvkdn_11xlc_2j999ybhbkr0000gn/T/tmp-59809-4kedkj5a1XsO/node_modules/@nx/webpack/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js
- /private/var/folders/p4/6tvkdn_11xlc_2j999ybhbkr0000gn/T/tmp-59809-4kedkj5a1XsO/node_modules/@nx/webpack/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js
- /private/var/folders/p4/6tvkdn_11xlc_2j999ybhbkr0000gn/T/tmp-59809-4kedkj5a1XsO/node_modules/@nx/webpack/index.js
- /private/tmp/web4/node_modules/@nx/devkit/src/utils/package-json.js
- /private/tmp/web4/node_modules/@nx/devkit/src/generators/to-js.js
- /private/tmp/web4/node_modules/@nx/devkit/public-api.js
- /private/tmp/web4/node_modules/@nx/devkit/index.js
- /private/tmp/web4/node_modules/@nx/web/src/generators/application/application.js
- /private/tmp/web4/node_modules/nx/src/config/schema-utils.js
- /private/tmp/web4/node_modules/nx/src/command-line/run/executor-utils.js
- /private/tmp/web4/node_modules/nx/src/project-graph/utils/project-configuration-utils.js
- /private/tmp/web4/node_modules/nx/src/utils/package-json.js
- /private/tmp/web4/node_modules/nx/bin/nx.js
Pass --verbose to see the stacktrace.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Note: Other generators like React/Vue are fine since they have
dependency on tsquery, which installs typescript.

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-10-27 12:31:56 -04:00
Craigory Coppola 98e510b47e fix(core): split lockfile cache and other performance improvements (#33256)
## Summary
This PR includes three performance and correctness improvements:

1. **Split lockfile cache into separate node and dependency caches** -
Previously, both createNodes and createDependencies would read/write the
entire cache. Now each manages its own cache independently:
   - `parsed-lock-file.nodes.json` for external nodes
   - `parsed-lock-file.dependencies.json` for dependencies

2. **Prevent duplicate plugin resolution calls with promise cache** -
Added a promise cache to prevent concurrent duplicate calls to
`retrieveProjectConfigurationsWithoutPluginInference` when multiple
plugins fail to resolve simultaneously

3. **Normalize targets in separate loop after validation** - Moved
target normalization out of the validation loop to ensure proper
sequencing

## Test plan
- [ ] Tests pass (currently failing in CI - needs investigation)
- [ ] Build succeeds
- [ ] Lint passes

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 10:33:18 -04:00
Jack Hsu 514005a7c9 fix(core): prevent undefined importer crash in pnpm lockfile parsing (#33223)
When stringifying a pnpm v9 lockfile with workspace packages, Nx crashes
with: "Cannot destructure property 'specifiers' of 'projectSnapshot' as
it is undefined."

This occurs when:
- The lockfile has a root importer with `link:` references to workspace
packages
- But the lockfile is missing the workspace package importer entries
- The code tries to access `importers[importerPath]` which returns
undefined
- This undefined value gets added to the output lockfile
- During serialization, it crashes when trying to destructure undefined

Workspace packages with missing importers are now silently skipped
during lockfile serialization. This prevents the crash and allows Nx to
continue operating with out-of-sync lockfiles.

The fix adds a null check before adding workspace dependency importers
to the output lockfile.

Closes NXC-3244
2025-10-27 10:27:38 -04:00
Craigory Coppola a52e7b0f6e Reapply "fix(core): add option to use v8 for daemon message serialization (#33192)
This reverts commit 54db861b72.

## Current Behavior
Daemon messaging is all done over JSON messages

## Expected Behavior
Daemon messages use v8 serialization to avoid string length issues

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 10:11:54 -04:00
Sander Boelhouwers 3f7119a821 fix(core): add accept header to http remote cache get (#33093)
With the Accept header in place during the retrieval of cache, the
client always expects an octet-stream from the server.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
When the `Accept` header is missing, you might not get the correct data
depending on the underlying implementation of a self hosted cache
solution. We use AWS API Gateway which has a hard requirement for
`Accept` to determine how it should convert the data.


Fixes #33092
2025-10-26 20:52:04 -04:00
Juri a082693838 docs(misc): add webinar banner to astro docs 2025-10-25 19:06:57 +02:00
Caleb Ukle 630d227a5f docs(gradle): update gradle links and improve graph comps (#33255)
- **docs(gradle): make sure gradle refs point to /java/gradle now**
- **docs(gradle): add syntax highlighting for diff codeblock**
- **fix(nx-dev): improve graph loading behavior to prevent pop-in
flash**
2025-10-24 19:48:48 -04:00
Jack Hsu 66a437a42a docs(misc): add nx-cloud start-agent command to CLI reference (#33250)
This PR adds the `nx-cloud start-agent` command used for manual DTEs to
the reference page.

Also update table code elements such that they don't wrap.

<img width="872" height="584" alt="image"
src="https://github.com/user-attachments/assets/b73a038d-e0de-421a-b430-2d76c0ec4345"
/>


Closes DOC-273, DOC-310

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-24 16:08:49 -05:00
Philip Fulcher 7712d2a656 docs(nx-dev): update Nx 22 release article (#33245) 2025-10-24 13:35:31 -04:00
Louie Weng 215876c398 feat(gradle): add custom installation path to options (#33187)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

We search for the gradle wrapper of a project by first looking at the
project root, then traversing upwards to the workspace root. If a
workspace has a separate gradle project defined that does not contain a
wrapper, then Nx will error.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Add a field to the gradle plugin that will allow users to specify a
custom gradle installation within their workspace. Nx will check for a
gradle wrapper that the specified location when executing gradle tasks.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes NXC-3147
2025-10-24 17:14:33 +00:00
Craigory Coppola 7021056fae fix(core): ensure daemon writes project graph cache to disk consistently (#33217)
## Current Behavior

When the Nx daemon returns a cached project graph from memory (without
recomputing), it does not write the graph to disk. This creates a
cache/daemon mismatch scenario:

1. Daemon has valid project graph in memory
2. A non-daemon process (fallback when daemon fails) encounters errors
and writes cache to disk with those errors
3. Parent process gets clean graph from daemon
4. Forked executor processes read from disk cache which contains errors
5. The errors cause `readProjectGraphCache()` to return `null` (when no
`minimumComputedAt` is provided)
6. This triggers a misleading "No cached ProjectGraph is available"
error instead of surfacing the actual errors

This issue manifests intermittently in CI environments, especially when:
- Daemon connection timeouts occur
- Multiple concurrent processes are running (DTE scenarios)
- File system latency is high

## Expected Behavior

The daemon should always write its current project graph to disk
whenever it returns it, ensuring the disk cache stays synchronized with
the daemon's in-memory cache. This prevents stale or errored caches from
persisting when the daemon has a valid graph.

## Related Issue(s)

Fixes NXC-3030

## Implementation Details

Modified `getCachedSerializedProjectGraphPromise()` in
`packages/nx/src/daemon/server/project-graph-incremental-recomputation.ts`
to write the project graph cache to disk after retrieving the result,
even when reusing the in-memory cached graph.

The fix ensures that:
- Any errored cache written by a non-daemon process gets overwritten by
the daemon's valid graph
- Forked executor processes always read a consistent cache that matches
what the daemon served to the parent process
- Real errors are properly surfaced instead of being hidden by a generic
"no cache available" message

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-24 16:56:40 +00:00
Jack Hsu 442f745b23 fix(vite): nxViteTsPaths supports local path aliases (#33241)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Local `tsconfig.app.json` is never picked up due to wrong resolved path.

## Expected Behavior
Local `tsconfig.app.json` is picked up and the path aliases are added to
Vite.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #33231
2025-10-24 12:53:57 -04:00
Benjamin Cabanes 7c978ed8c9 docs(nx-dev): sunset Explain with AI for Self-Healing CI (#33243)
Removed "Explain with AI" feature documentation and redirected all URLs
to Self-Healing CI. Added sunset notice to blog posts, updated
configuration files, and preserved historical content for reference.

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-10-24 12:45:27 -04:00
Colum Ferry e57c8a71b2 fix(docker): handle dockerfile at project root tag (#33236)
## Current Behavior
When `Dockerfile` is at project root, we attempt to append `--tag .`
which is invalid for docker.

## Expected Behavior
Ensure that if `Dockerfile` is at project root, we use `workspaceRoot`
to determine the `--tag`.
Note, this tag is primarily used as a deterministic method for Nx to
find the correct docker image when calling `docker run` and `nx release`
2025-10-24 17:36:49 +01:00
Hugo Burton 4a4b780685 fix(core): stream without prefixes showing tui (#33194)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
When using `--output-style=stream-without-prefixes` nx incorrectly shows
the TUI instead of streaming

## Expected Behavior
When using `--output-style=stream-without-prefixes`, nx should stream
with no prefixes just like it does with `--output-style=stream`

## Related Issue(s)


Fixes #32535

Co-authored-by: Hugo Burton <hugo.burton@westpac.com.au>
2025-10-24 12:31:31 -04:00
Jason Jean 1cf2c6665f chore(core): improvements to native build and error handling (#33238)
## Current Behavior

`node_modules` are being copied during copy-local-native

## Expected Behavior

`node_modules` are not being copied during `copy-local-native`
2025-10-24 12:13:18 -04:00
Jason Jean 2f1712f894 chore(repo): update nx to 22.1.0-beta.0 (#33244)
Updating Nx from 22.0.0-rc.0 to 22.1.0-beta.0
2025-10-24 12:11:44 -04:00
Jason Jean 81fd8b4170 chore(maven): only run nx-maven-plugin:install for maven e2e tests (#33242)
## Current Behavior

Maven is installed as a global dependency for all e2e targets
(`e2e-local`, `e2e-ci--**/**`, and `e2e-macos-ci--**/*`), even when only
the Maven e2e tests need it.

## Expected Behavior

Maven should only be installed as a dependency for the Maven e2e tests
that actually use it, avoiding unnecessary installations for other e2e
test projects.

## Changes Made

- Removed `nx-maven-plugin:install` from the global e2e target defaults
in `nx.json`
- Added `nx-maven-plugin:install` as a specific dependency to the Maven
e2e project targets in `e2e/maven/project.json`

This optimization ensures Maven is only installed when needed, reducing
unnecessary build overhead for other e2e tests.
2025-10-24 11:39:20 -04:00
Colum Ferry 3047fbda9e fix(core): should find dockerfiles to suggest installing docker plugin (#33234)
## Current Behavior
`nx init` does not search for `Dockerfile` patterns to suggest adding
the `@nx/docker` plugin.

## Expected Behavior
`nx init` finds and suggests `@nx/docker` plugin

Fixes NXC-3319
2025-10-24 11:23:50 -04:00
Colum Ferry 09fb0b693a chore(repo): update codeowners for docker (#33240) 2025-10-24 15:45:13 +01:00
Leosvel Pérez Espinosa 6788fccbd6 fix(core): fix swapped arguments when resolving catalog references from the filesystem (#33237)
Fixes the order of the arguments in invocations to
`resolveCatalogReference` when resolving catalog references from the
filesystem (not using a `Tree`).
2025-10-24 13:52:58 +00:00
Leosvel Pérez Espinosa f1fe6c0e24 fix(misc): handle null exit codes from crashed child processes (#33163)
## Current Behavior

In some scenarios, when some processes terminate unexpectedly (e.g.
crashed due to OOM), the task runner will incorrectly determine their
exit code to be 0. This results in Nx storing the task results as a
success, which can cause cache hits with false positive successes.

## Expected Behavior

When processes terminate unexpectedly (e.g. crashed due to OOM), the
task runner should correctly determine their exit code from the signal,
and it should never be 0. The stored task result should not be marked as
successful.

## Related Issue(s)

Fixes #29204
2025-10-24 09:26:34 -04:00
Colum Ferry 54bd3c498f fix(docker): handle undefined options when creating graph (#33235)
## Current Behavior
When `@nx/docker` is registered via string only (`nxJson.plugins:
["@nx/docker"]`, project graph creation fails because we try to access
`options.buildTarget`.

## Expected Behavior
Handle undefined `options` gracefully, and still create the default
target.

## Related Issue(s)

Fixes NXC-3320
2025-10-24 09:13:08 -04:00
Craigory Coppola fa45d79e55 chore(repo): remove check commit (#33227)
check-commit is superceded by the pr title target
2025-10-23 22:51:23 +00:00
Jason Jean b1a33ee608 feat(core): update rust (#33220)
## Current Behavior
Dependencies are outdated and Rust tooling needs to be updated.

## Expected Behavior
Rust dependencies are updated to their latest compatible versions.

## Changes
- Updated Rust dependencies
- Rebased with latest `origin/master`
- Updated pnpm lock file

## Related Issue(s)
None
2025-10-23 18:45:00 -04:00
Craigory Coppola b9af6a74b8 docs(dotnet): add migration guide from @nx-dotnet/core (#33206)
## Current Behavior
No docs describing migration path

## Expected Behavior
Docs describing migration path

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Caleb Ukle <caleb@nrwl.io>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-23 18:20:14 -04:00
Craigory Coppola c4f1f53b70 chore(repo): mark dotnet e2e as parallel 1 (#33226)
## Current Behavior
.NET sometimes bails on a failed mutex in e2e

## Expected Behavior
it runs only 1 at a time

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-23 17:27:22 -04:00
Craigory Coppola a4d9ad9c66 chore(gradle): format files (#33225) 2025-10-23 21:10:47 +00:00
Jack Hsu d3058a726f docs(core): update search filter on createnodes compat page (#33216)
This PR updates one filter from `Reference` to `References` to keep
consistency with our other pages.

Before (Both Reference and References show up):

<img width="137" height="206" alt="image"
src="https://github.com/user-attachments/assets/729379b6-0315-4b99-af90-fd96b3e96830"
/>


After (Just References, and every filter is plural):

<img width="736" height="535" alt="image"
src="https://github.com/user-attachments/assets/9c2ecbcd-67c4-4923-9d05-e2081b0e9dba"
/>

Closes DOC-309
2025-10-23 16:47:53 -04:00
Jack Hsu 97d38f75ee fix(nx-dev): add copy-docs back as a dep of serve (#33215)
It was removed when the scripts were cleaned up during next.js->astro
migration. Adding this back since blog posts need to be synced first
before serving.
2025-10-23 16:47:46 -04:00
Craigory Coppola d717414ec2 fix(core): prevent error message containing [object Object] for invalid {workspaceRoot} placement (#33203)
## Current Behavior

When project configuration errors occur due to invalid token usage
(e.g., `{workspaceRoot}` in the middle of a path), error messages don't
provide sufficient context about where the error occurred.

## Expected Behavior

Error messages should include:
- For project-level errors: the project and target context (e.g.,
"libs/my-app:build")
- For nx.json targetDefaults errors: the nx.json context (e.g.,
"nx.json[targetDefaults]:test")

This makes it much easier for users to locate and fix the configuration
issue.

## Changes

This PR adds comprehensive integration tests to verify the improved
error messaging:
- Test for project-level invalid token usage showing project:target
context
- Test for nx.json targetDefaults invalid token usage showing nx.json
context

Tests use mock plugins to simulate realistic scenarios where invalid
`{workspaceRoot}` token usage would occur, ensuring the error messages
contain the expected context information.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2025-10-23 20:41:38 +00:00
Chau Tran b59fb033b9 docs(nx-cloud): add SCIM section for SAML Okta (#33222)
- [x] add SCIM for SAML okta
- [x] break up SAML Auth into Azure SAML Auth and Okta SAML Auth

---
Azure SAML Auth and Okta SAML Auth as cards under Single Tenant
<img width="777" height="649" alt="image"
src="https://github.com/user-attachments/assets/3353e804-ea03-468b-82e5-acf28a76bddd"
/>

---
Azure SAML Auth and Okta SAML Auth on sidebar
<img width="242" height="286" alt="image"
src="https://github.com/user-attachments/assets/27365e7f-82ba-4335-9f8d-45b4d61aa3a4"
/>

---
Okta SCIM docs ToC
<img width="1023" height="872" alt="image"
src="https://github.com/user-attachments/assets/9221b31f-004b-4026-9430-9ed12fa7d0dc"
/>
2025-10-23 15:27:45 -05:00
Caleb Ukle 4073537270 fix(nx-dev): update docs code blocks usage (#32998)
by default code blocks will get text as the lang if not set or the lang
is not supported
but we should be so I don't have to look at the warnings in the terminal
output 😅
also remove the frame=none since the team preferred to have the terminal
frame

Example of invalid codeblock messages

![wm_2025-10-15T11-26-05@2x](https://github.com/user-attachments/assets/33161287-3fa3-4897-a5dd-0de3a47b37fe)

Also added conformance rule for validating image pages for public and
src/assets/ directory

examples of incorrect absolute path ref from "public" folder and
incorrect absolute path:


![wm_2025-10-15T10-23-41@2x](https://github.com/user-attachments/assets/354800a4-6628-4236-87d9-2590cb56fe54)



fixes DOC-242
fixes DOC-259
2025-10-23 16:22:20 -04:00
Philip Fulcher 59cf495fe1 docs(nx-dev): add nx 22 release article (#33219) 2025-10-23 19:09:10 +00:00
Colum Ferry 0a8272d7e7 feat(docker): support inferring additional args for targets with interpolation support (#32892)
## Current Behavior
Currently, when configuring the `@nx/docker` plugin, we only set the
target name and a basic command.
The intention was that targetDefaults might be able to be used to
configure additional args, but this falls short in some places.


## Expected Behavior
Allow setting additional args when configuring the `@nx/docker` plugin
that supports interpolated values, similar to `versionSchemes`.

This will allow additional flexibility when setting up the docker build
command such as:

```json
{
  "plugin": "@nx/docker",
  "options": {
     "buildTarget": {
       "name": "docker:build",
       "args": ["-t {projectName}"]
     }
  }
}
```

This means that we can use `nx run-many -t docker:build` and it will
successfully add the name of the projects into the tag.

This is one example, other examples include being able to set individual
Docker Layer Caching where each registry needs a unique name.
2025-10-23 14:48:47 -04:00
Jason Jean 500a4c92ee fix(maven): use File.isAbsolute for cross-platform path detection (#33195)
## Current Behavior

The Maven plugin currently checks if a path is absolute by using
`outputFile.startsWith("/")`. This only works on Unix-like systems and
fails on Windows where absolute paths start with a drive letter (e.g.,
`C:\`).

## Expected Behavior

The Maven plugin should correctly identify absolute paths on all
platforms (Windows, macOS, Linux) using the platform-agnostic
`File.isAbsolute()` method.

## Related Issue(s)

<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

N/A - This is a proactive bug fix for cross-platform compatibility.

---

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-23 14:04:48 -04:00
Emilio Heinzmann b2ba8c2770 feat(release): support {versionActionsVersion} in docker version scheme (#33178) 2025-10-23 21:00:47 +04:00
Colum Ferry 87c8d49b7e fix(core): continue execution when cloud client is unavailable (#33214)
## Current Behavior
When Nx Cloud is used, but the Nx Cloud client is unavailable, an error
is thrown and commands are not run.

## Expected Behavior
When Nx Cloud is used, but the client is unavailable, continue execution
without Nx Cloud.

## Related Issue(s)

Fixes NXC-3175
2025-10-23 17:48:47 +01:00
Rares Matei 516db5c43d chore(repo): fix task flakiness (#33109)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Tests either cause agents to run out of memory: 
<img width="956" height="358" alt="image"
src="https://github.com/user-attachments/assets/e55bae05-7757-46e7-88ed-158f72411195"
/>
<img width="1278" height="336" alt="image"
src="https://github.com/user-attachments/assets/40dc8dd6-4409-461e-b75a-5c1c36551da5"
/>

Or setup tasks fail due to network flakiness:
https://staging.nx.app/runs/J1qWVZA7K5



## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

A fully affected, cache busted task graph should run without any
failures.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-23 12:32:07 -04:00
MaxKless 44187bde41 fix(misc): add explanatory footer to ai agents prompts (#33182) 2025-10-23 18:08:39 +02:00
Craigory Coppola a8d6b0ad65 docs(dotnet): improve dotnet docs around option types (#33210)
This pull request updates the documentation for configuring .NET target
types in the `nx.json` file to provide clearer instructions and
examples. The changes make it easier to understand how to customize
target names and configurations for the `@nx/dotnet` plugin.

Improvements to configuration documentation:

* Added a section describing how each target type can be configured,
including renaming targets, customizing options, disabling targets, and
specifying additional properties.
* Updated the example configuration to show how to rename targets (e.g.,
"build" to "compile"), add configurations (e.g., production
optimization), set dependencies between targets, and disable targets
(e.g., disabling "pack").
* Clarified that targets are created with the configuration specified in
the `nx.json` `plugins` array, rather than just with custom names.
2025-10-23 11:55:59 -04:00
Colum Ferry 1002ad5198 fix(node): migrate to koa 3.0.3 (#33208)
Update `koa` to `3.0.3`
2025-10-23 16:10:45 +01:00
Jack Hsu b3c3e40490 docs(misc): update nx release documentation for v22 changes (#33189)
Changes:
- Update all Nx Release guides to show the config for v22 and prior
verisons
- Update `nx.json` reference page to show `releaseTag` property and what
they are prior to v22
- Add example showing all releaseTag options in v22 and < v22 (pattern,
requireSemver, strictPreid, preferDockerVersion, checkAllBranchesWhen)
- Update asides to use "Nx 22 Changes" instead of "Breaking Changes"
(properties deprecated, not breaking until v23)
- Fix `version.generatorOptions.updateDependents` →
`version.updateDependents` reference

Closes DOC-261

<img width="781" height="513" alt="image"
src="https://github.com/user-attachments/assets/3b8a13c4-e863-40da-87cb-ae5a6264bb9e"
/>

<img width="866" height="626" alt="image"
src="https://github.com/user-attachments/assets/e02fd179-80d7-42ea-993c-5da0ed793eaa"
/>

<img width="796" height="408" alt="image"
src="https://github.com/user-attachments/assets/14bb5c54-089c-4ed3-8774-731cbdaa37a5"
/>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-23 10:30:29 -04:00
James Henry ab82c7b1be docs(nx-dev): add guides for Release Groups and Update Dependents (#33200)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
2025-10-23 09:08:57 -04:00
James Henry 7c2f3511e2 docs(nx-dev): add dedicated guide for nx release programmatic API (#33198)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The first-class programmatic API of nx release is only documented within
the manage releases introduction and is incomplete (`ReleaseClient` is
not covered at all).

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The programmatic API has its own in depth guide, which is then
cross-referenced from the manage releases guide. `ReleaseClient` is now
documented including its new Nx 22 features.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-23 08:47:17 -04:00
Colum Ferry 2402ecb576 docs(release): update docs to use correct releaseTag object notation (#33202)
Update docs to match new API

---------

Co-authored-by: James Henry <james@henry.sc>
2025-10-23 13:37:49 +01:00
James Henry 3847528d44 chore(repo): remove unused typedoc-theme (#33196)
Deletes the unused typedoc-theme project from the root of the workspace
2025-10-23 08:15:29 -04:00
James Henry b92df85b97 chore(repo): clean up images (#33197) 2025-10-23 15:55:12 +04:00
Craigory Coppola 083b97255a docs(dotnet): refresh docs after adding run / watch config (#33190)
## Current Behavior
`run`/`watch` are not mentioned in docs

## Expected Behavior
`run`/`watch` docs are accurate

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-10-22 18:29:37 -04:00
Jason Jean b9a0f36d5f fix(maven): add support for unbound goals in plugin targets (#33191)
## Current Behavior

Maven plugin targets are only created for goals explicitly bound to
executions in the POM. Goals defined in a plugin but not bound to any
execution are not available as Nx targets.

## Expected Behavior

All available Maven goals should be accessible as Nx targets, including:
- Goals bound to executions (existing behavior)
- Unbound goals defined in the plugin (new behavior)

## Changes Made

1. **Added unbound goal support**: The `NxTargetFactory` now creates
targets for goals defined in a plugin but not bound to any execution.
These targets are created with the format `goalPrefix:goalName` without
an execution ID.

2. **Added continuous build tracking**: 
- Added `continuous` property to `NxTarget` data class to track whether
a goal supports continuous builds
- Updated `MojoAnalyzer` to detect continuous goals from the cache
configuration
   - All targets now properly propagate continuous mode information

3. **Code improvements**:
   - Improved formatting and indentation for consistency
- Made `execution` parameter optional in `createSimpleGoalTarget` to
support both bound and unbound goals
   - Updated command generation to work with or without execution IDs

## Related Issue(s)

This change enables better Maven goal discovery and execution in Nx
monorepos.
2025-10-22 18:16:50 -04:00
Zachary DeRose 4fcd1d22b2 fix(core): adding output error reason (#33159)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

When an invalid output exists we report:

```
 NX   The following outputs are invalid: 

 - foo.txt

Run `nx repair` to fix this.
```

Without specifying the reason, we tell to run `nx repair`.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

More feedback provided to the user as to the error with their output:

```
 NX   The following outputs are invalid: 

 - foo.txt
   ** Reason: Outputs must start with either "{workspaceRoot}/" or "{projectRoot}/".

Run `nx repair` to fix this.
```

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2025-10-22 16:04:37 -04:00
Jack Hsu 681825e6be docs(dotnet): add experimental warning for @nx/dotnet (#33188)
Closes DOC-308
2025-10-22 14:36:17 -04:00
Jack Hsu 1c3434fc32 docs(misc): update GitLab project ID location in integration guide (#33186)
This PR updates the GitLab integration guide to reflect where `Copy
Project ID` is in the updated GitLab UI.
<img width="758" height="572" alt="image"
src="https://github.com/user-attachments/assets/ea400064-f3d4-4cd8-b5ba-a6b0bc884e81"
/>

## Related Issue(s)
Closes DOC-269
2025-10-22 12:32:45 -04:00
Jack Hsu ce2586aed8 docs(misc): fix bad line higlighting in docs (#33185)
This PR fixes some pages that don't use the proper markdoc syntax for
line lighting in code blocks. The `{% meta %}` tag is needed and it is
missing in some places.

Closes DOC-2790
2025-10-22 12:32:37 -04:00
James Henry 420091d9df fix(release): breaking change contents extraction (#33184) 2025-10-22 15:11:45 +00:00
Jason Jean cddb2ef2d0 fix(core): store reason when marking daemon as disabled (#33172)
## Current Behavior

When the daemon is disabled due to an error, the reason isn't captured,
making it harder to debug why the daemon was disabled.

## Expected Behavior

The error message/reason is now stored when marking the daemon as
disabled, allowing better visibility into what caused the daemon to be
disabled.

## Related Issue(s)
2025-10-22 10:40:36 -04:00
Andrew Ovens 28e681b99c fix(js): ensure node execute completes before exit (#32629)
Node tool executions (non-watch) were exiting before completing. This
change ensures they complete before exit.

closes #32385

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Node tool executions are not completing since #32356 

## Expected Behavior
Node tool executions complete before exit

## Related Issue(s)
#32385 

Fixes #32385
2025-10-22 15:01:23 +01:00
Colum Ferry c9d20c78f1 chore(repo): update daily canary releases schedule to 1 hour earlier (#33181)
Update canary release schedule to 1 hour earlier
2025-10-22 09:22:49 -04:00
Colum Ferry da88c80a7f fix(angular-rspack): bubble errors correctly (#33183)
## Current Behavior
When errors happen in earlier stages of compilation process, such as
processing global styles, these errors are not printed and the rspack
build process hangs at the Sealing phase.

## Expected Behavior
Ensure that errors that have occurred that would cause the process to
hang are printed and process exits correctly.

Part of this happens because the usual printing of errors happens in the
`afterDone` hook, which is never reached when the above occurs.

## Related Issue(s)

Fixes NXC-3268
2025-10-22 13:14:43 +01:00
Philip Fulcher 585a8ef1a9 docs(nx-dev): fixes for blog and webinar banner (#33179)
- **docs(nx-dev): update copy on webinar banner**
- **fix(nx-dev): handle missing profile links for blog authors**
2025-10-22 07:42:57 -04:00
MaxKless 03cde99faa chore(repo): drop unused and outdated nx-mcp hard dependency in package.json (#33180) 2025-10-22 13:04:23 +02:00
James Henry 8819dccb94 fix(release)!: better respect version plan file contents for changelog entries (#33166)
BREAKING CHANGE: config.conventionalCommitsConfig for `DefaultChangelogRenderer` is no longer nullable.
2025-10-22 09:27:35 +00:00
Jason Jean bbfd0a3c12 chore(repo): prevent readme templates from being published (#33177)
## Current Behavior
Readme template files are being published to npm with inconsistent
naming conventions.

## Expected Behavior
Readme template files should be excluded from npm publication and
consistently named as `readme-template.md`.

## Changes
- Renamed all readme template files to `readme-template.md` across
angular-rspack-compiler, angular-rspack, dotnet, and maven packages
- Updated .npmignore files to exclude readme-template.md from npm
publication
- Updated package.json build commands to reference the new
readme-template.md paths
- Removed `!README.md__tpl__` exceptions from package.json files array
entries
2025-10-21 23:11:24 -04:00
Caleb Ukle 3d8658cbcd docs(devkit): document the createNodes compat for Nx versions (#33102)
add new page for the createNodes api compat
add callouts to extending project graph and tooling plugin page

fixes DOC-255

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-10-21 19:08:34 -05:00
Caleb Ukle 8dacb26ea1 docs(core): correctly parse alias args with single dash (#33176)
@alberturria fixed this issue for the old docs as we migrated to astro,
so applied their change to the astro part of the docs as well. Original
PR: https://github.com/nrwl/nx/pull/33085
made sure to co-author alberturria as well

Thanks! 

![wm_2025-10-21T16-07-56@2x](https://github.com/user-attachments/assets/8bfb8a8c-d8eb-4892-8642-06c3c882e958)

Fixes #32723

Co-authored-by: alberturria <albertoherreravargas@gmail.com>
2025-10-21 23:32:09 +00:00
Colum Ferry 042915418c chore(repo): remove unused @rspack/plugin-minify from root (#33161)
Remove unused @rspack/plugin-minify from root package.json
2025-10-21 18:06:26 -04:00
Leosvel Pérez Espinosa c4b063d403 chore(repo): fix the pnpm caching in the main-macos job (#33162)
Fixes the pnpm caching setup for the `main-macos` job. It can currently
fail when the pnpm cache directory doesn't exist. We need to handle the
pnpm cache conditionally and separately from the node setup.
2025-10-21 21:21:55 +00:00
Jason Jean 10c64c804d chore(repo): update nx to 22.0.0-rc.0 (#33165)
Updating Nx from 22.0.0-beta.8 to 22.0.0-rc.0
2025-10-21 16:43:46 -04:00
Craigory Coppola 6934445fd9 fix(dotnet): fixup various issues + missing functionality (#33132)
…as testing projects<!-- Please make sure you have read the submission
guidelines before posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
- Microsoft.Testing.Platform projects are not detected as having a test
target
- `serve` does not have an equivalent

## Expected Behavior
- Test projects are properly detected
- `serve` has been split into 2 targets:
  -  `watch`
  - `run`
  
The split of `serve` mirrors the`dotnet` cli in the same way that we
mirrored `vite` when adding `preview` and `dev` targets when we moved
with project crystal. `watch` can be used for a variety of cases, but
provides hot reload + run a 'la `dev` / `serve`. `run` is more of a fire
and forget target that starts up the app. Both targets would only really
be used in local dev.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
…as testing projects

---------

Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-21 16:31:55 -04:00
3267 changed files with 142199 additions and 52309 deletions
+11
View File
@@ -30,5 +30,16 @@
"enableAllProjectMcpServers": true,
"env": {
"BASH_MAX_TIMEOUT_MS": "1800000"
},
"extraKnownMarketplaces": {
"nx-claude-plugins": {
"source": {
"source": "github",
"repo": "nrwl/nx-ai-agents-config"
}
}
},
"enabledPlugins": {
"nx@nx-claude-plugins": true
}
}
+87
View File
@@ -0,0 +1,87 @@
---
name: run-nx-generator
description: Run Nx generators with prioritization for workspace-plugin generators. Use this when generating code, scaffolding new features, or automating repetitive tasks in the monorepo.
allowed-tools: Bash, Read, Glob, Grep, mcp__nx-mcp__nx_generators, mcp__nx-mcp__nx_generator_schema
---
# Run Nx Generator
This skill helps you execute Nx generators efficiently, with special focus on workspace-plugin generators from your internal tooling.
## Generator Priority List
Use the `mcp__nx-mcp__nx_generator_schema` tool to get more information about how to use the generator
Choose which generators to run in this priority order:
### 🔥 Workspace-Plugin Generators (High Priority)
These are your custom internal tools in `tools/workspace-plugin/`
### 📦 Core Nx Generators (Standard)
Only use these if workspace-plugin generators don't fit:
- `nx generate @nx/devkit:...` - DevKit utilities
- `nx generate @nx/node:...` - Node.js libraries
- `nx generate @nx/react:...` - React components and apps
- Framework-specific generators
## How to Run Generators
1. **List available generators**:
2. **Get generator schema** (to see available options):
Use the `mcp__nx-mcp__nx_generator_schema` tool to get more information about how to use the generator
3. **Run the generator**:
```bash
nx generate [generator-path] [options]
```
4. **Verify the changes**:
- Review generated files
- Run tests: `nx affected -t test`
- Format code: `npx prettier --write [files]`
## Best Practices
- ✅ Always check workspace-plugin first - it has your custom solutions
- ✅ Use `--dry-run` flag to preview changes before applying
- ✅ Format generated code immediately with Prettier
- ✅ Test affected projects after generation
- ✅ Commit generator changes separately from manual edits
## Examples
### Bumping Maven Version
When updating the Maven plugin version, use the workspace-plugin generator:
```bash
nx generate @nx/workspace-plugin:bump-maven-version \
--newVersion 0.0.10 \
--nxVersion 22.1.0-beta.7
```
This automates all the version bumping instead of manual file edits.
### Creating a New Plugin
For creating a new create-nodes plugin:
```bash
nx generate @nx/workspace-plugin:create-nodes-plugin \
--name my-custom-plugin
```
## When to Use This Skill
Use this skill when you need to:
- Generate new code or projects
- Scaffold new features or libraries
- Automate repetitive setup tasks
- Update internal tools and configurations
- Create migrations or version updates
+480
View File
@@ -0,0 +1,480 @@
---
name: ci-watcher
description: Polls Nx Cloud CI pipeline and self-healing status. Returns structured state when actionable. Spawned by /nx-cloud-ci-monitor command to monitor CI Attempt status.
model: fast
---
# CI Watcher Subagent
You are a CI monitoring subagent responsible for polling Nx Cloud CI Attempt status and self-healing state. You report status back to the main agent - you do NOT make apply/reject decisions.
## Your Responsibilities
1. Poll CI status using the `ci_information` MCP tool
2. Implement exponential backoff between polls
3. Return structured state when an actionable condition is reached
4. Track iteration count and elapsed time
5. Output status updates based on verbosity level
## Input Parameters (from Main Agent)
The main agent may provide these optional parameters in the prompt:
| Parameter | Description |
| ------------------- | -------------------------------------------------------- |
| `branch` | Branch to monitor (auto-detected if not provided) |
| `expectedCommitSha` | Commit SHA that should trigger a new CI Attempt |
| `previousCipeUrl` | CI Attempt URL before the action (to detect change) |
| `subagentTimeout` | Polling timeout in minutes (default: 60) |
| `verbosity` | Output level: minimal, medium, verbose (default: medium) |
When `expectedCommitSha` or `previousCipeUrl` is provided, you must detect whether a new CI Attempt has spawned.
## MCP Tool Reference
### `ci_information`
**Input:**
```json
{
"branch": "string (optional, defaults to current git branch)",
"select": "string (optional, comma-separated field names)",
"pageToken": "number (optional, 0-based pagination for long strings)"
}
```
**Output:**
```json
{
"cipeStatus": "NOT_STARTED | IN_PROGRESS | SUCCEEDED | FAILED | CANCELED | TIMED_OUT",
"cipeUrl": "string",
"branch": "string",
"commitSha": "string | null",
"failedTaskIds": "string[]",
"verifiedTaskIds": "string[]",
"selfHealingEnabled": "boolean",
"selfHealingStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"verificationStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"userAction": "NONE | APPLIED | REJECTED | APPLIED_LOCALLY | APPLIED_AUTOMATICALLY | null",
"failureClassification": "string | null",
"taskOutputSummary": "string | null",
"suggestedFixReasoning": "string | null",
"suggestedFixDescription": "string | null",
"suggestedFix": "string | null",
"shortLink": "string | null",
"couldAutoApplyTasks": "boolean | null",
"confidence": "number | null",
"confidenceReasoning": "string | null"
}
```
**Select Parameter:**
| Usage | Returns |
| --------------- | ----------------------------------------------------------- |
| No `select` | Formatted overview (truncated, not recommended for polling) |
| Single field | Raw value with pagination for long strings |
| Multiple fields | Object with requested field values |
**Field Sets for Efficient Polling:**
```yaml
WAIT_FIELDS:
'cipeUrl,commitSha,cipeStatus'
# Minimal fields for detecting new CI Attempt
LIGHT_FIELDS:
'cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning'
# Status fields for determining actionable state
HEAVY_FIELDS:
'taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription'
# Large content fields - fetch only when returning to main agent
```
## Initial Wait
Before first poll, wait based on context:
- **Fresh start (no expected CIPE):** Wait 60 seconds to allow CI to start
- **Expecting new CIPE:** Wait 30 seconds (action already triggered)
**IMPORTANT:** Always run sleep in foreground, NOT as background command.
```bash
sleep 60 # or 30 if expecting new CIPE (FOREGROUND, not background)
```
## Two-Phase Operation
The subagent operates in one of two modes depending on input:
### Mode 1: Fresh Start (no `expectedCommitSha` or `previousCipeUrl`)
Normal polling - process whatever CIPE is returned by `ci_information`.
### Mode 2: Wait-for-New-CIPE (when `expectedCommitSha` or `previousCipeUrl` provided)
**CRITICAL**: When expecting a new CIPE, the subagent must **completely ignore** the old/stale CIPE. Do NOT process its status, do NOT return actionable states based on it.
#### Phase A: Wait Mode
1. Start a **new-CIPE timeout** timer (default: 30 minutes)
2. On each poll of `ci_information`:
- Check if CIPE is NEW:
- `cipeUrl` differs from `previousCipeUrl`**new CIPE detected**
- `commitSha` matches `expectedCommitSha`**correct CIPE detected**
- If still OLD CIPE: **ignore all status fields**, just wait and poll again
- Do NOT return `fix_available`, `ci_success`, etc. based on old CIPE!
3. Output wait status (see below)
4. If timeout (30 min) reached → return `no_new_cipe`
#### Phase B: Normal Polling (after new CIPE detected)
Once new CIPE is detected:
1. Clear the new-CIPE timeout
2. Switch to normal polling mode
3. Process the NEW CIPE's status normally
4. Return when actionable state reached
### Wait Mode Output
While in wait mode, output clearly that you're waiting (not processing):
```
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] WAIT MODE - Expecting new CI Attempt
[CI Monitor] Expected SHA: <expectedCommitSha>
[CI Monitor] Previous CI Attempt: <previousCipeUrl>
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] Polling... (elapsed: 0m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 1m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 2m 30s)
[CI Monitor] ✓ New CI Attempt detected! URL: <newCipeUrl>, SHA: <newCommitSha>
[CI Monitor] Switching to normal polling mode...
```
### Why This Matters (Context Preservation)
**The problem**: Stale CIPE data can be very large:
- `taskOutputSummary`: potentially thousands of characters of build/test output
- `suggestedFix`: entire patch files
- `suggestedFixReasoning`: detailed explanation
If subagent returns stale CIPE data to main agent, it **pollutes main agent's context** with useless information (we already processed that CIPE). This wastes valuable context window.
**Without wait mode:**
1. Poll `ci_information` → get old CIPE with huge data
2. Return to main agent with all that stale data
3. Main agent's context gets polluted with useless info
4. Main agent has to process/ignore it anyway
**With wait mode:**
1. Poll `ci_information` → get old CIPE → **ignore it, don't return**
2. Keep waiting internally (stale data stays in subagent)
3. New CIPE appears → switch to normal mode
4. Return to main agent with only the NEW, relevant CIPE data
## Polling Loop
### Subagent State Management
Maintain internal accumulated state across polls:
```
accumulated_state = {}
```
### Call `ci_information` MCP Tool
**Wait Mode (expecting new CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeUrl,commitSha,cipeStatus"
})
```
Only fetch minimal fields needed to detect CI Attempt change. Do NOT fetch heavy fields - stale data wastes context.
**Normal Mode (processing CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning"
})
```
Merge response into `accumulated_state` after each poll.
### Analyze Response
**If in Wait Mode** (expecting new CIPE):
1. Check if CIPE is new (see Two-Phase Operation above)
2. If old CIPE → **ignore status**, output wait message, poll again
3. If new CIPE → switch to normal mode, continue below
**If in Normal Mode**:
Based on the response, decide whether to **keep polling** or **return to main agent**.
### Keep Polling When
Continue polling (with backoff) if ANY of these conditions are true:
| Condition | Reason |
| --------------------------------------- | ---------------------------------------- |
| `cipeStatus == 'IN_PROGRESS'` | CI still running |
| `cipeStatus == 'NOT_STARTED'` | CI hasn't started yet |
| `selfHealingStatus == 'IN_PROGRESS'` | Self-healing agent working |
| `selfHealingStatus == 'NOT_STARTED'` | Self-healing not started yet |
| `failureClassification == 'FLAKY_TASK'` | Auto-rerun in progress |
| `userAction == 'APPLIED_AUTOMATICALLY'` | New CI Attempt spawning after auto-apply |
When `couldAutoApplyTasks == true`:
- `verificationStatus` = `NOT_STARTED`, `IN_PROGRESS` → keep polling (verification still in progress)
- `verificationStatus` = `COMPLETED` → return `fix_auto_applying` (auto-apply will happen, main agent spawns wait mode subagent)
- `verificationStatus` = `FAILED`, `NOT_EXECUTABLE` → return `fix_available` (auto-apply won't happen, needs manual action)
### Exponential Backoff
Between polls, wait with exponential backoff:
| Poll Attempt | Wait Time |
| ------------ | ----------------- |
| 1st | 60 seconds |
| 2nd | 90 seconds |
| 3rd+ | 120 seconds (cap) |
Reset to 60 seconds when state changes significantly.
**IMPORTANT:** Run sleep in foreground (NOT as background command). Background sleep causes "What should Claude do?" prompts when completed.
```bash
# Example backoff - run in FOREGROUND
sleep 60 # First wait
sleep 90 # Second wait
sleep 120 # Third and subsequent waits (capped)
```
### Fetch Heavy Fields on Actionable State
Before returning to main agent, fetch heavy fields if the status requires them:
| Status | Heavy Fields Needed |
| ------------------- | ------------------------------------------------------------------------------ |
| `ci_success` | None |
| `fix_auto_applying` | None |
| `fix_available` | `taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription` |
| `fix_failed` | `taskOutputSummary` |
| `no_fix` | `taskOutputSummary` |
| `environment_issue` | None |
| `no_new_cipe` | None |
| `polling_timeout` | None |
| `cipe_canceled` | None |
| `cipe_timed_out` | None |
```
# Example: fetching heavy fields for fix_available
ci_information({
branch: "<branch_name>",
select: "taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription"
})
```
Merge response into `accumulated_state`, then return merged state to main agent.
**Pagination:** Heavy string fields return first page only. If `hasMore` indicated, include in return format so main agent knows more content available.
### Return to Main Agent When
Return immediately with structured state if ANY of these conditions are true:
| Status | Condition |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | `cipeStatus == 'SUCCEEDED'` |
| `fix_auto_applying` | `selfHealingStatus == 'COMPLETED'` AND `couldAutoApplyTasks == true` AND `verificationStatus == 'COMPLETED'` |
| `fix_available` | `selfHealingStatus == 'COMPLETED'` AND `suggestedFix != null` AND (`couldAutoApplyTasks != true` OR `verificationStatus` in (`FAILED`, `NOT_EXECUTABLE`)) |
| `fix_failed` | `selfHealingStatus == 'FAILED'` |
| `environment_issue` | `failureClassification == 'ENVIRONMENT_STATE'` |
| `no_fix` | `cipeStatus == 'FAILED'` AND (`selfHealingEnabled == false` OR `selfHealingStatus == 'NOT_EXECUTABLE'`) |
| `no_new_cipe` | `expectedCommitSha` or `previousCipeUrl` provided, but no new CI Attempt detected after 30 min |
| `polling_timeout` | Subagent has been polling for > configured timeout (default 60 min) |
| `cipe_canceled` | `cipeStatus == 'CANCELED'` |
| `cipe_timed_out` | `cipeStatus == 'TIMED_OUT'` |
## Subagent Timeout
Track elapsed time. If you have been polling for more than **60 minutes** (configurable via main agent), return with `status: polling_timeout`.
## Return Format
When returning to the main agent, provide a structured response with accumulated state:
```
## CI Monitor Result
**Status:** <status>
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### CI Attempt Details
- **Status:** <cipeStatus>
- **URL:** <cipeUrl>
- **Branch:** <branch>
- **Commit:** <commitSha>
- **Failed Tasks:** <failedTaskIds>
- **Verified Tasks:** <verifiedTaskIds>
### Self-Healing Details
- **Enabled:** <selfHealingEnabled>
- **Status:** <selfHealingStatus>
- **Verification:** <verificationStatus>
- **User Action:** <userAction>
- **Classification:** <failureClassification>
- **Confidence:** <confidence>
- **Confidence Reasoning:** <confidenceReasoning>
### Fix Information (if available)
- **Short Link:** <shortLink>
- **Description:** <suggestedFixDescription>
- **Reasoning:** <suggestedFixReasoning>
### Task Output Summary (first page)
<taskOutputSummary>
[MORE_CONTENT_AVAILABLE: taskOutputSummary, pageToken: 1]
### Suggested Fix (first page)
<suggestedFix>
[MORE_CONTENT_AVAILABLE: suggestedFix, pageToken: 1]
```
### Pagination Indicators
When a heavy field has more content available, append indicator:
```
[MORE_CONTENT_AVAILABLE: <fieldName>, pageToken: <nextPage>]
```
Main agent can fetch additional pages if needed using:
```
ci_information({ select: "<fieldName>", pageToken: <nextPage> })
```
Fields that may have pagination:
- `taskOutputSummary` (reverse pagination - page 0 = most recent)
- `suggestedFix` (forward pagination - page 0 = start)
- `suggestedFixReasoning`
### Return Format for `no_new_cipe`
When returning with `status: no_new_cipe`, include additional context:
```
## CI Monitor Result
**Status:** no_new_cipe
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### Expected CI Attempt Not Found
- **Expected Commit SHA:** <expectedCommitSha>
- **Previous CI Attempt URL:** <previousCipeUrl>
- **Last Seen CI Attempt URL:** <cipeUrl>
- **Last Seen Commit SHA:** <commitSha>
- **New CI Attempt Timeout:** 30 minutes (exceeded)
### Likely Cause
CI workflow failed before Nx tasks could run (e.g., install step, checkout, auth).
Check your CI provider logs for the commit <expectedCommitSha>.
### Last Known CI Attempt State
- **Status:** <cipeStatus>
- **Branch:** <branch>
```
## Status Reporting (Verbosity-Controlled)
Output is controlled by the `verbosity` parameter from the main agent:
| Level | What to Output |
| --------- | ----------------------------------------------------------------- |
| `minimal` | No intermediate output. Only return final result when actionable. |
| `medium` | Output only on significant state changes (not every poll). |
| `verbose` | Output detailed phase information after every poll. |
### Minimal Verbosity
No output during polling. Poll silently and return when done.
### Medium Verbosity (Default)
Output **only when state changes significantly** to save context tokens:
- `cipeStatus` changes (e.g., IN_PROGRESS → FAILED)
- `selfHealingStatus` changes (e.g., IN_PROGRESS → COMPLETED)
- New CI Attempt detected (in wait mode)
Format: single line, no decorators:
```
[CI Monitor] CI: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 4m
```
### Verbose Verbosity
Output detailed phase box after every poll:
```
[CI Monitor] ─────────────────────────────────────────────────────
[CI Monitor] Iteration <N> | Elapsed: <X>m <Y>s
[CI Monitor]
[CI Monitor] CI Status: <cipeStatus>
[CI Monitor] Self-Healing: <selfHealingStatus>
[CI Monitor] Verification: <verificationStatus>
[CI Monitor] Classification: <failureClassification>
[CI Monitor]
[CI Monitor] → <human-readable phase description>
[CI Monitor] ─────────────────────────────────────────────────────
```
### Phase Descriptions (for verbose output)
| Status Combo | Description |
| ----------------------------------------------------------------------------------------- | ------------------------------------------- |
| `cipeStatus: IN_PROGRESS` | "CI running..." |
| `cipeStatus: NOT_STARTED` | "Waiting for CI to start..." |
| `cipeStatus: FAILED` + `selfHealingStatus: NOT_STARTED` | "CI failed. Self-healing starting..." |
| `cipeStatus: FAILED` + `selfHealingStatus: IN_PROGRESS` | "CI failed. Self-healing generating fix..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: IN_PROGRESS` | "Fix generated! Verification running..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: COMPLETED` | "Fix ready! Verified successfully." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: FAILED` | "Fix generated but verification failed." |
| `cipeStatus: FAILED` + `selfHealingStatus: FAILED` | "Self-healing could not generate a fix." |
| `cipeStatus: SUCCEEDED` | "CI passed!" |
## Important Notes
- You do NOT make apply/reject decisions - that's the main agent's job
- You do NOT perform git operations
- You only poll and report state
- Respect the `verbosity` parameter for output (default: medium)
- If `ci_information` returns an error, wait and retry (count as failed poll)
- Track consecutive failures - if 5 consecutive failures, return with `status: error`
- When expecting new CI Attempt, track the 30-minute new-CI-Attempt timeout separately from the main polling timeout
+428
View File
@@ -0,0 +1,428 @@
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+437
View File
@@ -0,0 +1,437 @@
---
name: ci-monitor
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
$ARGUMENTS
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `$ARGUMENTS` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+228
View File
@@ -0,0 +1,228 @@
---
name: nx-generate
description: Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.
---
# Run Nx Generator
Nx generators are powerful tools that scaffold projects, make automated code migrations or automate repetitive tasks in a monorepo. They ensure consistency across the codebase and reduce boilerplate work.
This skill applies when the user wants to:
- Create new projects like libraries or applications
- Scaffold features or boilerplate code
- Run workspace-specific or custom generators
- Do anything else that an nx generator exists for
## Generator Discovery Flow
### Step 1: List Available Generators
Use the Nx CLI to discover available generators:
- List all generators for a plugin: `npx nx list @nx/react`
- View available plugins: `npx nx list`
This includes:
- Plugin generators (e.g., `@nx/react:library`, `@nx/js:library`)
- Local workspace generators (defined in the repo's own plugins)
### Step 2: Match Generator to User Request
Based on the user's request, identify which generator(s) could fulfill their needs. Consider:
- What artifact type they want to create (library, application, etc.)
- Which framework or technology stack is relevant
- Whether they mentioned specific generator names
**IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns and conventions.
It's possible that the user request is something that no Nx generator exists for whatsoever. In this case, you can stop using this skill and try to help the user another way. HOWEVER, the burden of proof for this is high. Before aborting, carefully consider each and every generator that's available. Look into details for any that could be related in any way before making this decision.
## Pre-Execution Checklist
Before running any generator, complete these steps:
### 1. Fetch Generator Schema
Use the `--help` flag to understand all available options:
```bash
npx nx g @nx/react:library --help
```
Pay attention to:
- Required options that must be provided
- Optional options that may be relevant to the user's request
- Default values that might need to be overridden
### 2. Read Generator Source Code
Understanding what the generator actually does helps you:
- Know what files will be created/modified
- Understand any side effects (updating configs, installing deps, etc.)
- Identify options that might not be obvious from the schema
To find generator source code:
- For plugin generators: Use `node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));"` to find the generators.json, then locate the source from there
- If that fails, read directly from `node_modules/<plugin>/generators.json`
- For local generators: They are typically in `tools/generators/` or a local plugin directory. You can search the repo for the generator name to find it.
### 2.5 Reevaluate if the generator is right
Once you have built up an understanding of what the selected generator does, reconsider: Is this the right generator to service the user request?
If not, it's okay to go back to the Generator Discovery Flow and select a different generator before proceeding. If you do, make sure to go through the entire pre-execution checklist once more.
### 3. Understand Repo Context
Before generating, examine the target area of the codebase:
- Look at similar existing artifacts (other libraries, applications, etc.)
- Identify patterns and conventions used in the repo
- Note naming conventions, file structures, and configuration patterns
- Try to match these patterns when configuring the generator
For example, if similar libraries are using a specific test runner, build tool or linter, try to match that if possible.
If projects or other artifacts are organized with a specific naming convention, try to match it.
### 4. Validate Required Options
Ensure all required options have values:
- Map the user's request to generator options
- Infer values from context where possible
- Ask the user for any critical missing information
## Execution
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally.
Many generators will behave differently based on where they are executed. For example, first-party nx library generators use the cwd to determine the directory that the library should be placed in. This is highly important.
### Consider Dry-Run (Optional)
Running with `--dry-run` first is strongly encouraged but not mandatory. Use your judgment:
- For complex generators or unfamiliar territory: do a dry-run first
- For simple, well-understood generators: may proceed directly
- Dry-run shows file names and created/deleted/modified markers, but not content
- There are cases where a generator does not support dry-run (for example if it had to install an npm package) - in that case --dry-run might fail. Don't be discouraged but simply move on to running the generator for real and iterating from there.
### Running the Generator
Execute the generator with:
```bash
nx generate <generator-name> <options> --no-interactive
```
**CRITICAL**: Always include `--no-interactive` to prevent prompts that would hang the execution.
Example:
```bash
nx generate @nx/react:library --name=my-utils --no-interactive
```
### Handling Generator Failures
If the generator fails:
1. **Diagnose the error** - Read the error message carefully
2. **Identify the cause** - Missing options, invalid values, conflicts, etc.
3. **Attempt automatic fix** - Adjust options or resolve conflicts
4. **Retry** - Run the generator again with corrected options
Common failure reasons:
- Missing required options
- Invalid option values
- Conflicting with existing files
- Missing dependencies
- Generator doesn't support certain flag combinations
## Post-Generation
### 1. Modify Generated Code (If Needed)
Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:
- Add or modify functionality as requested
- Adjust imports, exports, or configurations
- Integrate with existing code patterns in the repo
### 2. Format Code
Run formatting on all generated/modified files:
```bash
nx format --fix
```
Languages other than javascript/typescript might need other formatting invocations too.
### 3. Run Verification
Verify that the generated code works correctly. What this looks like will vary depending on the type of generator and the targets available.
If the generator created a new project, run its targets directly
Use your best judgement to determine what needs to be verified.
Example:
```bash
nx lint <new-project>
nx test <new-project>
nx build <new-project>
```
### 4. Handle Verification Failures
When verification fails:
**If scope is manageable** (a few lint errors, minor type issues):
- Fix the issues
- Re-run verification to confirm
**If issues are extensive** (many errors, complex problems):
- Attempt simple, obvious fixes first
- If still failing, escalate to the user with:
- Description of what was generated
- What verification is failing
- What you've attempted to fix
- Remaining issues that need user input
## Error Handling
### Generator Failures
- Check the error message for specific causes
- Verify all required options are provided
- Check for conflicts with existing files
- Ensure the generator name and options are correct
### Missing Options
- Consult the generator schema for required fields
- Infer values from context when reasonable
- Ask the user for values that cannot be inferred
## Key Principles
1. **Local generators first** - Always prefer workspace/local generators over external plugin generators when both could work
2. **Understand before running** - Read both the schema AND the source code to fully understand what will happen
3. **No prompts** - Always use `--no-interactive` to prevent hanging
4. **Generators are starting points** - Modify the output as needed to fully satisfy the user's requirements
5. **Verify changes work** - Don't just generate; ensure the code builds, lints, and tests pass
6. **Be proactive about fixes** - Don't just report errors; attempt to resolve them automatically when possible
7. **Match repo patterns** - Study existing similar code in the repo and match its conventions
+9
View File
@@ -0,0 +1,9 @@
---
name: nx-plugins
description: Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.
---
## Finding and Installing new plugins
- List plugins: `pnpm nx list`
- Install plugins `pnpm nx add <plugin>`. Example: `pnpm nx add @nx/react`.
+58
View File
@@ -0,0 +1,58 @@
---
name: nx-run-tasks
description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
---
You can run tasks with Nx in the following way.
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Look at the package.json or lockfile to determine which package manager is in use.
For more details on any command, run it with `--help` (e.g. `nx run-many --help`, `nx affected --help`).
## Understand which tasks can be run
You can check those via `nx show project <projectname> --json`, for example `nx show project myapp --json`. It contains a `targets` section which has information about targets that can be run. You can also just look at the `package.json` scripts or `project.json` targets, but you might miss out on inferred tasks by Nx plugins.
## Run a single task
```
nx run <project>:<task>
```
where `project` is the project name defined in `package.json` or `project.json` (if present).
## Run multiple tasks
```
nx run-many -t build test lint typecheck
```
You can pass a `-p` flag to filter to specific projects, otherwise it runs on all projects. You can also use `--exclude` to exclude projects, and `--parallel` to control the number of parallel processes (default is 3).
Examples:
- `nx run-many -t test -p proj1 proj2` — test specific projects
- `nx run-many -t test --projects=*-app --exclude=excluded-app` — test projects matching a pattern
- `nx run-many -t test --projects=tag:api-*` — test projects by tag
## Run tasks for affected projects
Use `nx affected` to only run tasks on projects that have been changed and projects that depend on changed projects. This is especially useful in CI and for large workspaces.
```
nx affected -t build test lint
```
By default it compares against the base branch. You can customize this:
- `nx affected -t test --base=main --head=HEAD` — compare against a specific base and head
- `nx affected -t test --files=libs/mylib/src/index.ts` — specify changed files directly
## Useful flags
These flags work with `run`, `run-many`, and `affected`:
- `--skipNxCache` — rerun tasks even when results are cached
- `--verbose` — print additional information such as stack traces
- `--nxBail` — stop execution after the first failed task
- `--configuration=<name>` — use a specific configuration (e.g. `production`)
+186
View File
@@ -0,0 +1,186 @@
---
name: nx-workspace
description: "Explore and understand Nx workspaces. USE WHEN answering any questions about the nx workspace, the projects in it or tasks to run. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What targets can I run?', 'What's affected by my changes?', 'Which projects depend on library Y?', or any questions about Nx workspace structure, project configuration, or available tasks."
---
# Nx Workspace Exploration
This skill provides read-only exploration of Nx workspaces. Use it to understand workspace structure, project configuration, available targets, and dependencies.
Keep in mind that you might have to prefix commands with `npx`/`pnpx`/`yarn` if nx isn't installed globally. Check the lockfile to determine the package manager in use.
## Listing Projects
Use `nx show projects` to list projects in the workspace.
```bash
# List all projects
nx show projects
# Filter by pattern (glob)
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# Filter by project type
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# Filter by target (projects that have a specific target)
nx show projects --withTarget build
nx show projects --withTarget e2e
# Find affected projects (changed since base branch)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# Combine filters
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# Output as JSON
nx show projects --json
```
## Project Configuration
Use `nx show project <name> --json` to get the full resolved configuration for a project.
**Important**: Do NOT read `project.json` directly - it only contains partial configuration. The `nx show project` command returns the full resolved config including inferred targets from plugins.
You can read the full project schema at `node_modules/nx/schemas/project-schema.json` to understand nx project configuration options.
```bash
# Get full project configuration
nx show project my-app --json
# Extract specific parts from the JSON
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# Check project metadata
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
```
## Target Information
Targets define what tasks can be run on a project.
```bash
# List all targets for a project
nx show project my-app --json | jq '.targets | keys'
# Get full target configuration
nx show project my-app --json | jq '.targets.build'
# Check target executor/command
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# View target options
nx show project my-app --json | jq '.targets.build.options'
# Check target inputs/outputs (for caching)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# Find projects with a specific target
nx show projects --withTarget serve
nx show projects --withTarget e2e
```
## Workspace Configuration
Read `nx.json` directly for workspace-level configuration.
You can read the full project schema at `node_modules/nx/schemas/nx-schema.json` to understand nx project configuration options.
```bash
# Read the full nx.json
cat nx.json
# Or use jq for specific sections
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
```
Key nx.json sections:
- `targetDefaults` - Default configuration applied to all targets of a given name
- `namedInputs` - Reusable input definitions for caching
- `plugins` - Nx plugins and their configuration
- ...and much more, read the schema or nx.json for details
## Affected Projects
Find projects affected by changes in the current branch.
```bash
# Affected since base branch (auto-detected)
nx show projects --affected
# Affected with explicit base
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# Affected between two commits
nx show projects --affected --base=abc123 --head=def456
# Affected apps only
nx show projects --affected --type app
# Affected excluding e2e projects
nx show projects --affected --exclude="*-e2e"
# Affected by uncommitted changes
nx show projects --affected --uncommitted
# Affected by untracked files
nx show projects --affected --untracked
```
## Common Exploration Patterns
### "What's in this workspace?"
```bash
nx show projects
nx show projects --type app
nx show projects --type lib
```
### "How do I build/test/lint project X?"
```bash
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
```
### "What depends on library Y?"
```bash
# Find projects that may depend on Y by searching for imports
# (Nx doesn't have a direct "dependents" command via CLI)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
```
### "What configuration options are available?"
```bash
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
```
### "Why is project X affected?"
```bash
# Check what files changed
git diff --name-only main
# See which project owns those files
nx show project X --json | jq '.root'
```
+4 -4
View File
@@ -8,11 +8,11 @@
// Try a more recent distribution, if your are having build issues related to GLIBC version
// Here we use 'bookworm', which is based on `Debian-12`, which comes with `GLIBC v2.36`
// (Nx tools currenlty requires `GLIBC v2.33` or higher)
"image": "mcr.microsoft.com/devcontainers/typescript-node:20-bookworm",
// Note: Using base debian image instead of typescript-node since mise will manage all tools
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"ghcr.io/devcontainers/features/rust:1": {}
},
// All tools (Node, Java, Rust, Dotnet) are managed by mise via mise.toml
"features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// 4211 = nx graph port
+23 -5
View File
@@ -1,12 +1,30 @@
#!/bin/sh
#!/bin/bash
# Update the underlying (Debian) OS, to make sure we have the latest security patches and libraries like 'GLIBC'
# Update the underlying (Debian) OS, to make sure we have the latest security patches and libraries like 'GLIBC'
echo "⚙️ Updating the underlying OS..."
sudo apt-get update && sudo apt-get -y upgrade
# Uninstall globally installed PNPM (required version will be reinstalled through corepack)
echo "❌ Uninstalling globally installed PNPM..."
npm uninstall -g pnpm
# Install mise for managing development tools (Node, Java, Rust, Dotnet)
echo "⚙️ Installing mise..."
curl https://mise.run | sh
# Add mise to PATH
export PATH="$HOME/.local/bin:$PATH"
# Trust the mise.toml configuration file
echo "⚙️ Trusting mise.toml configuration..."
mise trust
# Install all tools from mise.toml (node, java, rust, dotnet)
echo "⚙️ Installing tools via mise (node, java, rust, dotnet)..."
mise install
# Activate mise to make tools available in current shell
eval "$(mise activate bash)"
# Add mise activation to bashrc for future shell sessions
echo "⚙️ Configuring mise activation in shell..."
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
# Prevent corepack from prompting user before downloading PNPM
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
+438
View File
@@ -0,0 +1,438 @@
description = "Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting."
prompt = """
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
{{args}}
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `{{args}}` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \\| Elapsed: Xm \\| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```"""
+437
View File
@@ -0,0 +1,437 @@
---
name: ci-monitor
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
$ARGUMENTS
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `$ARGUMENTS` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+228
View File
@@ -0,0 +1,228 @@
---
name: nx-generate
description: Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.
---
# Run Nx Generator
Nx generators are powerful tools that scaffold projects, make automated code migrations or automate repetitive tasks in a monorepo. They ensure consistency across the codebase and reduce boilerplate work.
This skill applies when the user wants to:
- Create new projects like libraries or applications
- Scaffold features or boilerplate code
- Run workspace-specific or custom generators
- Do anything else that an nx generator exists for
## Generator Discovery Flow
### Step 1: List Available Generators
Use the Nx CLI to discover available generators:
- List all generators for a plugin: `npx nx list @nx/react`
- View available plugins: `npx nx list`
This includes:
- Plugin generators (e.g., `@nx/react:library`, `@nx/js:library`)
- Local workspace generators (defined in the repo's own plugins)
### Step 2: Match Generator to User Request
Based on the user's request, identify which generator(s) could fulfill their needs. Consider:
- What artifact type they want to create (library, application, etc.)
- Which framework or technology stack is relevant
- Whether they mentioned specific generator names
**IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns and conventions.
It's possible that the user request is something that no Nx generator exists for whatsoever. In this case, you can stop using this skill and try to help the user another way. HOWEVER, the burden of proof for this is high. Before aborting, carefully consider each and every generator that's available. Look into details for any that could be related in any way before making this decision.
## Pre-Execution Checklist
Before running any generator, complete these steps:
### 1. Fetch Generator Schema
Use the `--help` flag to understand all available options:
```bash
npx nx g @nx/react:library --help
```
Pay attention to:
- Required options that must be provided
- Optional options that may be relevant to the user's request
- Default values that might need to be overridden
### 2. Read Generator Source Code
Understanding what the generator actually does helps you:
- Know what files will be created/modified
- Understand any side effects (updating configs, installing deps, etc.)
- Identify options that might not be obvious from the schema
To find generator source code:
- For plugin generators: Use `node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));"` to find the generators.json, then locate the source from there
- If that fails, read directly from `node_modules/<plugin>/generators.json`
- For local generators: They are typically in `tools/generators/` or a local plugin directory. You can search the repo for the generator name to find it.
### 2.5 Reevaluate if the generator is right
Once you have built up an understanding of what the selected generator does, reconsider: Is this the right generator to service the user request?
If not, it's okay to go back to the Generator Discovery Flow and select a different generator before proceeding. If you do, make sure to go through the entire pre-execution checklist once more.
### 3. Understand Repo Context
Before generating, examine the target area of the codebase:
- Look at similar existing artifacts (other libraries, applications, etc.)
- Identify patterns and conventions used in the repo
- Note naming conventions, file structures, and configuration patterns
- Try to match these patterns when configuring the generator
For example, if similar libraries are using a specific test runner, build tool or linter, try to match that if possible.
If projects or other artifacts are organized with a specific naming convention, try to match it.
### 4. Validate Required Options
Ensure all required options have values:
- Map the user's request to generator options
- Infer values from context where possible
- Ask the user for any critical missing information
## Execution
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally.
Many generators will behave differently based on where they are executed. For example, first-party nx library generators use the cwd to determine the directory that the library should be placed in. This is highly important.
### Consider Dry-Run (Optional)
Running with `--dry-run` first is strongly encouraged but not mandatory. Use your judgment:
- For complex generators or unfamiliar territory: do a dry-run first
- For simple, well-understood generators: may proceed directly
- Dry-run shows file names and created/deleted/modified markers, but not content
- There are cases where a generator does not support dry-run (for example if it had to install an npm package) - in that case --dry-run might fail. Don't be discouraged but simply move on to running the generator for real and iterating from there.
### Running the Generator
Execute the generator with:
```bash
nx generate <generator-name> <options> --no-interactive
```
**CRITICAL**: Always include `--no-interactive` to prevent prompts that would hang the execution.
Example:
```bash
nx generate @nx/react:library --name=my-utils --no-interactive
```
### Handling Generator Failures
If the generator fails:
1. **Diagnose the error** - Read the error message carefully
2. **Identify the cause** - Missing options, invalid values, conflicts, etc.
3. **Attempt automatic fix** - Adjust options or resolve conflicts
4. **Retry** - Run the generator again with corrected options
Common failure reasons:
- Missing required options
- Invalid option values
- Conflicting with existing files
- Missing dependencies
- Generator doesn't support certain flag combinations
## Post-Generation
### 1. Modify Generated Code (If Needed)
Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:
- Add or modify functionality as requested
- Adjust imports, exports, or configurations
- Integrate with existing code patterns in the repo
### 2. Format Code
Run formatting on all generated/modified files:
```bash
nx format --fix
```
Languages other than javascript/typescript might need other formatting invocations too.
### 3. Run Verification
Verify that the generated code works correctly. What this looks like will vary depending on the type of generator and the targets available.
If the generator created a new project, run its targets directly
Use your best judgement to determine what needs to be verified.
Example:
```bash
nx lint <new-project>
nx test <new-project>
nx build <new-project>
```
### 4. Handle Verification Failures
When verification fails:
**If scope is manageable** (a few lint errors, minor type issues):
- Fix the issues
- Re-run verification to confirm
**If issues are extensive** (many errors, complex problems):
- Attempt simple, obvious fixes first
- If still failing, escalate to the user with:
- Description of what was generated
- What verification is failing
- What you've attempted to fix
- Remaining issues that need user input
## Error Handling
### Generator Failures
- Check the error message for specific causes
- Verify all required options are provided
- Check for conflicts with existing files
- Ensure the generator name and options are correct
### Missing Options
- Consult the generator schema for required fields
- Infer values from context when reasonable
- Ask the user for values that cannot be inferred
## Key Principles
1. **Local generators first** - Always prefer workspace/local generators over external plugin generators when both could work
2. **Understand before running** - Read both the schema AND the source code to fully understand what will happen
3. **No prompts** - Always use `--no-interactive` to prevent hanging
4. **Generators are starting points** - Modify the output as needed to fully satisfy the user's requirements
5. **Verify changes work** - Don't just generate; ensure the code builds, lints, and tests pass
6. **Be proactive about fixes** - Don't just report errors; attempt to resolve them automatically when possible
7. **Match repo patterns** - Study existing similar code in the repo and match its conventions
+9
View File
@@ -0,0 +1,9 @@
---
name: nx-plugins
description: Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.
---
## Finding and Installing new plugins
- List plugins: `pnpm nx list`
- Install plugins `pnpm nx add <plugin>`. Example: `pnpm nx add @nx/react`.
+58
View File
@@ -0,0 +1,58 @@
---
name: nx-run-tasks
description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
---
You can run tasks with Nx in the following way.
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Look at the package.json or lockfile to determine which package manager is in use.
For more details on any command, run it with `--help` (e.g. `nx run-many --help`, `nx affected --help`).
## Understand which tasks can be run
You can check those via `nx show project <projectname> --json`, for example `nx show project myapp --json`. It contains a `targets` section which has information about targets that can be run. You can also just look at the `package.json` scripts or `project.json` targets, but you might miss out on inferred tasks by Nx plugins.
## Run a single task
```
nx run <project>:<task>
```
where `project` is the project name defined in `package.json` or `project.json` (if present).
## Run multiple tasks
```
nx run-many -t build test lint typecheck
```
You can pass a `-p` flag to filter to specific projects, otherwise it runs on all projects. You can also use `--exclude` to exclude projects, and `--parallel` to control the number of parallel processes (default is 3).
Examples:
- `nx run-many -t test -p proj1 proj2` — test specific projects
- `nx run-many -t test --projects=*-app --exclude=excluded-app` — test projects matching a pattern
- `nx run-many -t test --projects=tag:api-*` — test projects by tag
## Run tasks for affected projects
Use `nx affected` to only run tasks on projects that have been changed and projects that depend on changed projects. This is especially useful in CI and for large workspaces.
```
nx affected -t build test lint
```
By default it compares against the base branch. You can customize this:
- `nx affected -t test --base=main --head=HEAD` — compare against a specific base and head
- `nx affected -t test --files=libs/mylib/src/index.ts` — specify changed files directly
## Useful flags
These flags work with `run`, `run-many`, and `affected`:
- `--skipNxCache` — rerun tasks even when results are cached
- `--verbose` — print additional information such as stack traces
- `--nxBail` — stop execution after the first failed task
- `--configuration=<name>` — use a specific configuration (e.g. `production`)
+186
View File
@@ -0,0 +1,186 @@
---
name: nx-workspace
description: "Explore and understand Nx workspaces. USE WHEN answering any questions about the nx workspace, the projects in it or tasks to run. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What targets can I run?', 'What's affected by my changes?', 'Which projects depend on library Y?', or any questions about Nx workspace structure, project configuration, or available tasks."
---
# Nx Workspace Exploration
This skill provides read-only exploration of Nx workspaces. Use it to understand workspace structure, project configuration, available targets, and dependencies.
Keep in mind that you might have to prefix commands with `npx`/`pnpx`/`yarn` if nx isn't installed globally. Check the lockfile to determine the package manager in use.
## Listing Projects
Use `nx show projects` to list projects in the workspace.
```bash
# List all projects
nx show projects
# Filter by pattern (glob)
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# Filter by project type
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# Filter by target (projects that have a specific target)
nx show projects --withTarget build
nx show projects --withTarget e2e
# Find affected projects (changed since base branch)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# Combine filters
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# Output as JSON
nx show projects --json
```
## Project Configuration
Use `nx show project <name> --json` to get the full resolved configuration for a project.
**Important**: Do NOT read `project.json` directly - it only contains partial configuration. The `nx show project` command returns the full resolved config including inferred targets from plugins.
You can read the full project schema at `node_modules/nx/schemas/project-schema.json` to understand nx project configuration options.
```bash
# Get full project configuration
nx show project my-app --json
# Extract specific parts from the JSON
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# Check project metadata
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
```
## Target Information
Targets define what tasks can be run on a project.
```bash
# List all targets for a project
nx show project my-app --json | jq '.targets | keys'
# Get full target configuration
nx show project my-app --json | jq '.targets.build'
# Check target executor/command
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# View target options
nx show project my-app --json | jq '.targets.build.options'
# Check target inputs/outputs (for caching)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# Find projects with a specific target
nx show projects --withTarget serve
nx show projects --withTarget e2e
```
## Workspace Configuration
Read `nx.json` directly for workspace-level configuration.
You can read the full project schema at `node_modules/nx/schemas/nx-schema.json` to understand nx project configuration options.
```bash
# Read the full nx.json
cat nx.json
# Or use jq for specific sections
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
```
Key nx.json sections:
- `targetDefaults` - Default configuration applied to all targets of a given name
- `namedInputs` - Reusable input definitions for caching
- `plugins` - Nx plugins and their configuration
- ...and much more, read the schema or nx.json for details
## Affected Projects
Find projects affected by changes in the current branch.
```bash
# Affected since base branch (auto-detected)
nx show projects --affected
# Affected with explicit base
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# Affected between two commits
nx show projects --affected --base=abc123 --head=def456
# Affected apps only
nx show projects --affected --type app
# Affected excluding e2e projects
nx show projects --affected --exclude="*-e2e"
# Affected by uncommitted changes
nx show projects --affected --uncommitted
# Affected by untracked files
nx show projects --affected --untracked
```
## Common Exploration Patterns
### "What's in this workspace?"
```bash
nx show projects
nx show projects --type app
nx show projects --type lib
```
### "How do I build/test/lint project X?"
```bash
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
```
### "What depends on library Y?"
```bash
# Find projects that may depend on Y by searching for imports
# (Nx doesn't have a direct "dependents" command via CLI)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
```
### "What configuration options are available?"
```bash
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
```
### "Why is project X affected?"
```bash
# Check what files changed
git diff --name-only main
# See which project owns those files
nx show project X --json | jq '.root'
```
+478
View File
@@ -0,0 +1,478 @@
---
description: Polls Nx Cloud CI pipeline and self-healing status. Returns structured state when actionable. Spawned by /nx-cloud-ci-monitor command to monitor CI Attempt status.
---
# CI Watcher Subagent
You are a CI monitoring subagent responsible for polling Nx Cloud CI Attempt status and self-healing state. You report status back to the main agent - you do NOT make apply/reject decisions.
## Your Responsibilities
1. Poll CI status using the `ci_information` MCP tool
2. Implement exponential backoff between polls
3. Return structured state when an actionable condition is reached
4. Track iteration count and elapsed time
5. Output status updates based on verbosity level
## Input Parameters (from Main Agent)
The main agent may provide these optional parameters in the prompt:
| Parameter | Description |
| ------------------- | -------------------------------------------------------- |
| `branch` | Branch to monitor (auto-detected if not provided) |
| `expectedCommitSha` | Commit SHA that should trigger a new CI Attempt |
| `previousCipeUrl` | CI Attempt URL before the action (to detect change) |
| `subagentTimeout` | Polling timeout in minutes (default: 60) |
| `verbosity` | Output level: minimal, medium, verbose (default: medium) |
When `expectedCommitSha` or `previousCipeUrl` is provided, you must detect whether a new CI Attempt has spawned.
## MCP Tool Reference
### `ci_information`
**Input:**
```json
{
"branch": "string (optional, defaults to current git branch)",
"select": "string (optional, comma-separated field names)",
"pageToken": "number (optional, 0-based pagination for long strings)"
}
```
**Output:**
```json
{
"cipeStatus": "NOT_STARTED | IN_PROGRESS | SUCCEEDED | FAILED | CANCELED | TIMED_OUT",
"cipeUrl": "string",
"branch": "string",
"commitSha": "string | null",
"failedTaskIds": "string[]",
"verifiedTaskIds": "string[]",
"selfHealingEnabled": "boolean",
"selfHealingStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"verificationStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"userAction": "NONE | APPLIED | REJECTED | APPLIED_LOCALLY | APPLIED_AUTOMATICALLY | null",
"failureClassification": "string | null",
"taskOutputSummary": "string | null",
"suggestedFixReasoning": "string | null",
"suggestedFixDescription": "string | null",
"suggestedFix": "string | null",
"shortLink": "string | null",
"couldAutoApplyTasks": "boolean | null",
"confidence": "number | null",
"confidenceReasoning": "string | null"
}
```
**Select Parameter:**
| Usage | Returns |
| --------------- | ----------------------------------------------------------- |
| No `select` | Formatted overview (truncated, not recommended for polling) |
| Single field | Raw value with pagination for long strings |
| Multiple fields | Object with requested field values |
**Field Sets for Efficient Polling:**
```yaml
WAIT_FIELDS:
'cipeUrl,commitSha,cipeStatus'
# Minimal fields for detecting new CI Attempt
LIGHT_FIELDS:
'cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning'
# Status fields for determining actionable state
HEAVY_FIELDS:
'taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription'
# Large content fields - fetch only when returning to main agent
```
## Initial Wait
Before first poll, wait based on context:
- **Fresh start (no expected CIPE):** Wait 60 seconds to allow CI to start
- **Expecting new CIPE:** Wait 30 seconds (action already triggered)
**IMPORTANT:** Always run sleep in foreground, NOT as background command.
```bash
sleep 60 # or 30 if expecting new CIPE (FOREGROUND, not background)
```
## Two-Phase Operation
The subagent operates in one of two modes depending on input:
### Mode 1: Fresh Start (no `expectedCommitSha` or `previousCipeUrl`)
Normal polling - process whatever CIPE is returned by `ci_information`.
### Mode 2: Wait-for-New-CIPE (when `expectedCommitSha` or `previousCipeUrl` provided)
**CRITICAL**: When expecting a new CIPE, the subagent must **completely ignore** the old/stale CIPE. Do NOT process its status, do NOT return actionable states based on it.
#### Phase A: Wait Mode
1. Start a **new-CIPE timeout** timer (default: 30 minutes)
2. On each poll of `ci_information`:
- Check if CIPE is NEW:
- `cipeUrl` differs from `previousCipeUrl`**new CIPE detected**
- `commitSha` matches `expectedCommitSha`**correct CIPE detected**
- If still OLD CIPE: **ignore all status fields**, just wait and poll again
- Do NOT return `fix_available`, `ci_success`, etc. based on old CIPE!
3. Output wait status (see below)
4. If timeout (30 min) reached → return `no_new_cipe`
#### Phase B: Normal Polling (after new CIPE detected)
Once new CIPE is detected:
1. Clear the new-CIPE timeout
2. Switch to normal polling mode
3. Process the NEW CIPE's status normally
4. Return when actionable state reached
### Wait Mode Output
While in wait mode, output clearly that you're waiting (not processing):
```
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] WAIT MODE - Expecting new CI Attempt
[CI Monitor] Expected SHA: <expectedCommitSha>
[CI Monitor] Previous CI Attempt: <previousCipeUrl>
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] Polling... (elapsed: 0m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 1m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 2m 30s)
[CI Monitor] ✓ New CI Attempt detected! URL: <newCipeUrl>, SHA: <newCommitSha>
[CI Monitor] Switching to normal polling mode...
```
### Why This Matters (Context Preservation)
**The problem**: Stale CIPE data can be very large:
- `taskOutputSummary`: potentially thousands of characters of build/test output
- `suggestedFix`: entire patch files
- `suggestedFixReasoning`: detailed explanation
If subagent returns stale CIPE data to main agent, it **pollutes main agent's context** with useless information (we already processed that CIPE). This wastes valuable context window.
**Without wait mode:**
1. Poll `ci_information` → get old CIPE with huge data
2. Return to main agent with all that stale data
3. Main agent's context gets polluted with useless info
4. Main agent has to process/ignore it anyway
**With wait mode:**
1. Poll `ci_information` → get old CIPE → **ignore it, don't return**
2. Keep waiting internally (stale data stays in subagent)
3. New CIPE appears → switch to normal mode
4. Return to main agent with only the NEW, relevant CIPE data
## Polling Loop
### Subagent State Management
Maintain internal accumulated state across polls:
```
accumulated_state = {}
```
### Call `ci_information` MCP Tool
**Wait Mode (expecting new CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeUrl,commitSha,cipeStatus"
})
```
Only fetch minimal fields needed to detect CI Attempt change. Do NOT fetch heavy fields - stale data wastes context.
**Normal Mode (processing CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning"
})
```
Merge response into `accumulated_state` after each poll.
### Analyze Response
**If in Wait Mode** (expecting new CIPE):
1. Check if CIPE is new (see Two-Phase Operation above)
2. If old CIPE → **ignore status**, output wait message, poll again
3. If new CIPE → switch to normal mode, continue below
**If in Normal Mode**:
Based on the response, decide whether to **keep polling** or **return to main agent**.
### Keep Polling When
Continue polling (with backoff) if ANY of these conditions are true:
| Condition | Reason |
| --------------------------------------- | ---------------------------------------- |
| `cipeStatus == 'IN_PROGRESS'` | CI still running |
| `cipeStatus == 'NOT_STARTED'` | CI hasn't started yet |
| `selfHealingStatus == 'IN_PROGRESS'` | Self-healing agent working |
| `selfHealingStatus == 'NOT_STARTED'` | Self-healing not started yet |
| `failureClassification == 'FLAKY_TASK'` | Auto-rerun in progress |
| `userAction == 'APPLIED_AUTOMATICALLY'` | New CI Attempt spawning after auto-apply |
When `couldAutoApplyTasks == true`:
- `verificationStatus` = `NOT_STARTED`, `IN_PROGRESS` → keep polling (verification still in progress)
- `verificationStatus` = `COMPLETED` → return `fix_auto_applying` (auto-apply will happen, main agent spawns wait mode subagent)
- `verificationStatus` = `FAILED`, `NOT_EXECUTABLE` → return `fix_available` (auto-apply won't happen, needs manual action)
### Exponential Backoff
Between polls, wait with exponential backoff:
| Poll Attempt | Wait Time |
| ------------ | ----------------- |
| 1st | 60 seconds |
| 2nd | 90 seconds |
| 3rd+ | 120 seconds (cap) |
Reset to 60 seconds when state changes significantly.
**IMPORTANT:** Run sleep in foreground (NOT as background command). Background sleep causes "What should Claude do?" prompts when completed.
```bash
# Example backoff - run in FOREGROUND
sleep 60 # First wait
sleep 90 # Second wait
sleep 120 # Third and subsequent waits (capped)
```
### Fetch Heavy Fields on Actionable State
Before returning to main agent, fetch heavy fields if the status requires them:
| Status | Heavy Fields Needed |
| ------------------- | ------------------------------------------------------------------------------ |
| `ci_success` | None |
| `fix_auto_applying` | None |
| `fix_available` | `taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription` |
| `fix_failed` | `taskOutputSummary` |
| `no_fix` | `taskOutputSummary` |
| `environment_issue` | None |
| `no_new_cipe` | None |
| `polling_timeout` | None |
| `cipe_canceled` | None |
| `cipe_timed_out` | None |
```
# Example: fetching heavy fields for fix_available
ci_information({
branch: "<branch_name>",
select: "taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription"
})
```
Merge response into `accumulated_state`, then return merged state to main agent.
**Pagination:** Heavy string fields return first page only. If `hasMore` indicated, include in return format so main agent knows more content available.
### Return to Main Agent When
Return immediately with structured state if ANY of these conditions are true:
| Status | Condition |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | `cipeStatus == 'SUCCEEDED'` |
| `fix_auto_applying` | `selfHealingStatus == 'COMPLETED'` AND `couldAutoApplyTasks == true` AND `verificationStatus == 'COMPLETED'` |
| `fix_available` | `selfHealingStatus == 'COMPLETED'` AND `suggestedFix != null` AND (`couldAutoApplyTasks != true` OR `verificationStatus` in (`FAILED`, `NOT_EXECUTABLE`)) |
| `fix_failed` | `selfHealingStatus == 'FAILED'` |
| `environment_issue` | `failureClassification == 'ENVIRONMENT_STATE'` |
| `no_fix` | `cipeStatus == 'FAILED'` AND (`selfHealingEnabled == false` OR `selfHealingStatus == 'NOT_EXECUTABLE'`) |
| `no_new_cipe` | `expectedCommitSha` or `previousCipeUrl` provided, but no new CI Attempt detected after 30 min |
| `polling_timeout` | Subagent has been polling for > configured timeout (default 60 min) |
| `cipe_canceled` | `cipeStatus == 'CANCELED'` |
| `cipe_timed_out` | `cipeStatus == 'TIMED_OUT'` |
## Subagent Timeout
Track elapsed time. If you have been polling for more than **60 minutes** (configurable via main agent), return with `status: polling_timeout`.
## Return Format
When returning to the main agent, provide a structured response with accumulated state:
```
## CI Monitor Result
**Status:** <status>
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### CI Attempt Details
- **Status:** <cipeStatus>
- **URL:** <cipeUrl>
- **Branch:** <branch>
- **Commit:** <commitSha>
- **Failed Tasks:** <failedTaskIds>
- **Verified Tasks:** <verifiedTaskIds>
### Self-Healing Details
- **Enabled:** <selfHealingEnabled>
- **Status:** <selfHealingStatus>
- **Verification:** <verificationStatus>
- **User Action:** <userAction>
- **Classification:** <failureClassification>
- **Confidence:** <confidence>
- **Confidence Reasoning:** <confidenceReasoning>
### Fix Information (if available)
- **Short Link:** <shortLink>
- **Description:** <suggestedFixDescription>
- **Reasoning:** <suggestedFixReasoning>
### Task Output Summary (first page)
<taskOutputSummary>
[MORE_CONTENT_AVAILABLE: taskOutputSummary, pageToken: 1]
### Suggested Fix (first page)
<suggestedFix>
[MORE_CONTENT_AVAILABLE: suggestedFix, pageToken: 1]
```
### Pagination Indicators
When a heavy field has more content available, append indicator:
```
[MORE_CONTENT_AVAILABLE: <fieldName>, pageToken: <nextPage>]
```
Main agent can fetch additional pages if needed using:
```
ci_information({ select: "<fieldName>", pageToken: <nextPage> })
```
Fields that may have pagination:
- `taskOutputSummary` (reverse pagination - page 0 = most recent)
- `suggestedFix` (forward pagination - page 0 = start)
- `suggestedFixReasoning`
### Return Format for `no_new_cipe`
When returning with `status: no_new_cipe`, include additional context:
```
## CI Monitor Result
**Status:** no_new_cipe
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### Expected CI Attempt Not Found
- **Expected Commit SHA:** <expectedCommitSha>
- **Previous CI Attempt URL:** <previousCipeUrl>
- **Last Seen CI Attempt URL:** <cipeUrl>
- **Last Seen Commit SHA:** <commitSha>
- **New CI Attempt Timeout:** 30 minutes (exceeded)
### Likely Cause
CI workflow failed before Nx tasks could run (e.g., install step, checkout, auth).
Check your CI provider logs for the commit <expectedCommitSha>.
### Last Known CI Attempt State
- **Status:** <cipeStatus>
- **Branch:** <branch>
```
## Status Reporting (Verbosity-Controlled)
Output is controlled by the `verbosity` parameter from the main agent:
| Level | What to Output |
| --------- | ----------------------------------------------------------------- |
| `minimal` | No intermediate output. Only return final result when actionable. |
| `medium` | Output only on significant state changes (not every poll). |
| `verbose` | Output detailed phase information after every poll. |
### Minimal Verbosity
No output during polling. Poll silently and return when done.
### Medium Verbosity (Default)
Output **only when state changes significantly** to save context tokens:
- `cipeStatus` changes (e.g., IN_PROGRESS → FAILED)
- `selfHealingStatus` changes (e.g., IN_PROGRESS → COMPLETED)
- New CI Attempt detected (in wait mode)
Format: single line, no decorators:
```
[CI Monitor] CI: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 4m
```
### Verbose Verbosity
Output detailed phase box after every poll:
```
[CI Monitor] ─────────────────────────────────────────────────────
[CI Monitor] Iteration <N> | Elapsed: <X>m <Y>s
[CI Monitor]
[CI Monitor] CI Status: <cipeStatus>
[CI Monitor] Self-Healing: <selfHealingStatus>
[CI Monitor] Verification: <verificationStatus>
[CI Monitor] Classification: <failureClassification>
[CI Monitor]
[CI Monitor] → <human-readable phase description>
[CI Monitor] ─────────────────────────────────────────────────────
```
### Phase Descriptions (for verbose output)
| Status Combo | Description |
| ----------------------------------------------------------------------------------------- | ------------------------------------------- |
| `cipeStatus: IN_PROGRESS` | "CI running..." |
| `cipeStatus: NOT_STARTED` | "Waiting for CI to start..." |
| `cipeStatus: FAILED` + `selfHealingStatus: NOT_STARTED` | "CI failed. Self-healing starting..." |
| `cipeStatus: FAILED` + `selfHealingStatus: IN_PROGRESS` | "CI failed. Self-healing generating fix..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: IN_PROGRESS` | "Fix generated! Verification running..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: COMPLETED` | "Fix ready! Verified successfully." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: FAILED` | "Fix generated but verification failed." |
| `cipeStatus: FAILED` + `selfHealingStatus: FAILED` | "Self-healing could not generate a fix." |
| `cipeStatus: SUCCEEDED` | "CI passed!" |
## Important Notes
- You do NOT make apply/reject decisions - that's the main agent's job
- You do NOT perform git operations
- You only poll and report state
- Respect the `verbosity` parameter for output (default: medium)
- If `ci_information` returns an error, wait and retry (count as failed poll)
- Track consecutive failures - if 5 consecutive failures, return with `status: error`
- When expecting new CI Attempt, track the 30-minute new-CI-Attempt timeout separately from the main polling timeout
+18
View File
@@ -0,0 +1,18 @@
# This configuration is here to prevent false positive alerts for __fixtures__.
# We are intentionally disabling the PR opening feature.
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 0
exclude-paths:
- '**/__fixtures__/**'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
open-pull-requests-limit: 0
+437
View File
@@ -0,0 +1,437 @@
---
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
argument-hint: '[instructions] [--max-cycles N] [--timeout MINUTES] [--verbosity minimal|medium|verbose] [--branch BRANCH] [--fresh] [--auto-fix-workflow] [--new-cipe-timeout MINUTES]'
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
${input:args}
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `${input:args}` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+437
View File
@@ -0,0 +1,437 @@
---
name: ci-monitor
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
$ARGUMENTS
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `$ARGUMENTS` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+228
View File
@@ -0,0 +1,228 @@
---
name: nx-generate
description: Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.
---
# Run Nx Generator
Nx generators are powerful tools that scaffold projects, make automated code migrations or automate repetitive tasks in a monorepo. They ensure consistency across the codebase and reduce boilerplate work.
This skill applies when the user wants to:
- Create new projects like libraries or applications
- Scaffold features or boilerplate code
- Run workspace-specific or custom generators
- Do anything else that an nx generator exists for
## Generator Discovery Flow
### Step 1: List Available Generators
Use the Nx CLI to discover available generators:
- List all generators for a plugin: `npx nx list @nx/react`
- View available plugins: `npx nx list`
This includes:
- Plugin generators (e.g., `@nx/react:library`, `@nx/js:library`)
- Local workspace generators (defined in the repo's own plugins)
### Step 2: Match Generator to User Request
Based on the user's request, identify which generator(s) could fulfill their needs. Consider:
- What artifact type they want to create (library, application, etc.)
- Which framework or technology stack is relevant
- Whether they mentioned specific generator names
**IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns and conventions.
It's possible that the user request is something that no Nx generator exists for whatsoever. In this case, you can stop using this skill and try to help the user another way. HOWEVER, the burden of proof for this is high. Before aborting, carefully consider each and every generator that's available. Look into details for any that could be related in any way before making this decision.
## Pre-Execution Checklist
Before running any generator, complete these steps:
### 1. Fetch Generator Schema
Use the `--help` flag to understand all available options:
```bash
npx nx g @nx/react:library --help
```
Pay attention to:
- Required options that must be provided
- Optional options that may be relevant to the user's request
- Default values that might need to be overridden
### 2. Read Generator Source Code
Understanding what the generator actually does helps you:
- Know what files will be created/modified
- Understand any side effects (updating configs, installing deps, etc.)
- Identify options that might not be obvious from the schema
To find generator source code:
- For plugin generators: Use `node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));"` to find the generators.json, then locate the source from there
- If that fails, read directly from `node_modules/<plugin>/generators.json`
- For local generators: They are typically in `tools/generators/` or a local plugin directory. You can search the repo for the generator name to find it.
### 2.5 Reevaluate if the generator is right
Once you have built up an understanding of what the selected generator does, reconsider: Is this the right generator to service the user request?
If not, it's okay to go back to the Generator Discovery Flow and select a different generator before proceeding. If you do, make sure to go through the entire pre-execution checklist once more.
### 3. Understand Repo Context
Before generating, examine the target area of the codebase:
- Look at similar existing artifacts (other libraries, applications, etc.)
- Identify patterns and conventions used in the repo
- Note naming conventions, file structures, and configuration patterns
- Try to match these patterns when configuring the generator
For example, if similar libraries are using a specific test runner, build tool or linter, try to match that if possible.
If projects or other artifacts are organized with a specific naming convention, try to match it.
### 4. Validate Required Options
Ensure all required options have values:
- Map the user's request to generator options
- Infer values from context where possible
- Ask the user for any critical missing information
## Execution
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally.
Many generators will behave differently based on where they are executed. For example, first-party nx library generators use the cwd to determine the directory that the library should be placed in. This is highly important.
### Consider Dry-Run (Optional)
Running with `--dry-run` first is strongly encouraged but not mandatory. Use your judgment:
- For complex generators or unfamiliar territory: do a dry-run first
- For simple, well-understood generators: may proceed directly
- Dry-run shows file names and created/deleted/modified markers, but not content
- There are cases where a generator does not support dry-run (for example if it had to install an npm package) - in that case --dry-run might fail. Don't be discouraged but simply move on to running the generator for real and iterating from there.
### Running the Generator
Execute the generator with:
```bash
nx generate <generator-name> <options> --no-interactive
```
**CRITICAL**: Always include `--no-interactive` to prevent prompts that would hang the execution.
Example:
```bash
nx generate @nx/react:library --name=my-utils --no-interactive
```
### Handling Generator Failures
If the generator fails:
1. **Diagnose the error** - Read the error message carefully
2. **Identify the cause** - Missing options, invalid values, conflicts, etc.
3. **Attempt automatic fix** - Adjust options or resolve conflicts
4. **Retry** - Run the generator again with corrected options
Common failure reasons:
- Missing required options
- Invalid option values
- Conflicting with existing files
- Missing dependencies
- Generator doesn't support certain flag combinations
## Post-Generation
### 1. Modify Generated Code (If Needed)
Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:
- Add or modify functionality as requested
- Adjust imports, exports, or configurations
- Integrate with existing code patterns in the repo
### 2. Format Code
Run formatting on all generated/modified files:
```bash
nx format --fix
```
Languages other than javascript/typescript might need other formatting invocations too.
### 3. Run Verification
Verify that the generated code works correctly. What this looks like will vary depending on the type of generator and the targets available.
If the generator created a new project, run its targets directly
Use your best judgement to determine what needs to be verified.
Example:
```bash
nx lint <new-project>
nx test <new-project>
nx build <new-project>
```
### 4. Handle Verification Failures
When verification fails:
**If scope is manageable** (a few lint errors, minor type issues):
- Fix the issues
- Re-run verification to confirm
**If issues are extensive** (many errors, complex problems):
- Attempt simple, obvious fixes first
- If still failing, escalate to the user with:
- Description of what was generated
- What verification is failing
- What you've attempted to fix
- Remaining issues that need user input
## Error Handling
### Generator Failures
- Check the error message for specific causes
- Verify all required options are provided
- Check for conflicts with existing files
- Ensure the generator name and options are correct
### Missing Options
- Consult the generator schema for required fields
- Infer values from context when reasonable
- Ask the user for values that cannot be inferred
## Key Principles
1. **Local generators first** - Always prefer workspace/local generators over external plugin generators when both could work
2. **Understand before running** - Read both the schema AND the source code to fully understand what will happen
3. **No prompts** - Always use `--no-interactive` to prevent hanging
4. **Generators are starting points** - Modify the output as needed to fully satisfy the user's requirements
5. **Verify changes work** - Don't just generate; ensure the code builds, lints, and tests pass
6. **Be proactive about fixes** - Don't just report errors; attempt to resolve them automatically when possible
7. **Match repo patterns** - Study existing similar code in the repo and match its conventions
+9
View File
@@ -0,0 +1,9 @@
---
name: nx-plugins
description: Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.
---
## Finding and Installing new plugins
- List plugins: `pnpm nx list`
- Install plugins `pnpm nx add <plugin>`. Example: `pnpm nx add @nx/react`.
+58
View File
@@ -0,0 +1,58 @@
---
name: nx-run-tasks
description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
---
You can run tasks with Nx in the following way.
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Look at the package.json or lockfile to determine which package manager is in use.
For more details on any command, run it with `--help` (e.g. `nx run-many --help`, `nx affected --help`).
## Understand which tasks can be run
You can check those via `nx show project <projectname> --json`, for example `nx show project myapp --json`. It contains a `targets` section which has information about targets that can be run. You can also just look at the `package.json` scripts or `project.json` targets, but you might miss out on inferred tasks by Nx plugins.
## Run a single task
```
nx run <project>:<task>
```
where `project` is the project name defined in `package.json` or `project.json` (if present).
## Run multiple tasks
```
nx run-many -t build test lint typecheck
```
You can pass a `-p` flag to filter to specific projects, otherwise it runs on all projects. You can also use `--exclude` to exclude projects, and `--parallel` to control the number of parallel processes (default is 3).
Examples:
- `nx run-many -t test -p proj1 proj2` — test specific projects
- `nx run-many -t test --projects=*-app --exclude=excluded-app` — test projects matching a pattern
- `nx run-many -t test --projects=tag:api-*` — test projects by tag
## Run tasks for affected projects
Use `nx affected` to only run tasks on projects that have been changed and projects that depend on changed projects. This is especially useful in CI and for large workspaces.
```
nx affected -t build test lint
```
By default it compares against the base branch. You can customize this:
- `nx affected -t test --base=main --head=HEAD` — compare against a specific base and head
- `nx affected -t test --files=libs/mylib/src/index.ts` — specify changed files directly
## Useful flags
These flags work with `run`, `run-many`, and `affected`:
- `--skipNxCache` — rerun tasks even when results are cached
- `--verbose` — print additional information such as stack traces
- `--nxBail` — stop execution after the first failed task
- `--configuration=<name>` — use a specific configuration (e.g. `production`)
+186
View File
@@ -0,0 +1,186 @@
---
name: nx-workspace
description: "Explore and understand Nx workspaces. USE WHEN answering any questions about the nx workspace, the projects in it or tasks to run. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What targets can I run?', 'What's affected by my changes?', 'Which projects depend on library Y?', or any questions about Nx workspace structure, project configuration, or available tasks."
---
# Nx Workspace Exploration
This skill provides read-only exploration of Nx workspaces. Use it to understand workspace structure, project configuration, available targets, and dependencies.
Keep in mind that you might have to prefix commands with `npx`/`pnpx`/`yarn` if nx isn't installed globally. Check the lockfile to determine the package manager in use.
## Listing Projects
Use `nx show projects` to list projects in the workspace.
```bash
# List all projects
nx show projects
# Filter by pattern (glob)
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# Filter by project type
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# Filter by target (projects that have a specific target)
nx show projects --withTarget build
nx show projects --withTarget e2e
# Find affected projects (changed since base branch)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# Combine filters
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# Output as JSON
nx show projects --json
```
## Project Configuration
Use `nx show project <name> --json` to get the full resolved configuration for a project.
**Important**: Do NOT read `project.json` directly - it only contains partial configuration. The `nx show project` command returns the full resolved config including inferred targets from plugins.
You can read the full project schema at `node_modules/nx/schemas/project-schema.json` to understand nx project configuration options.
```bash
# Get full project configuration
nx show project my-app --json
# Extract specific parts from the JSON
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# Check project metadata
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
```
## Target Information
Targets define what tasks can be run on a project.
```bash
# List all targets for a project
nx show project my-app --json | jq '.targets | keys'
# Get full target configuration
nx show project my-app --json | jq '.targets.build'
# Check target executor/command
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# View target options
nx show project my-app --json | jq '.targets.build.options'
# Check target inputs/outputs (for caching)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# Find projects with a specific target
nx show projects --withTarget serve
nx show projects --withTarget e2e
```
## Workspace Configuration
Read `nx.json` directly for workspace-level configuration.
You can read the full project schema at `node_modules/nx/schemas/nx-schema.json` to understand nx project configuration options.
```bash
# Read the full nx.json
cat nx.json
# Or use jq for specific sections
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
```
Key nx.json sections:
- `targetDefaults` - Default configuration applied to all targets of a given name
- `namedInputs` - Reusable input definitions for caching
- `plugins` - Nx plugins and their configuration
- ...and much more, read the schema or nx.json for details
## Affected Projects
Find projects affected by changes in the current branch.
```bash
# Affected since base branch (auto-detected)
nx show projects --affected
# Affected with explicit base
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# Affected between two commits
nx show projects --affected --base=abc123 --head=def456
# Affected apps only
nx show projects --affected --type app
# Affected excluding e2e projects
nx show projects --affected --exclude="*-e2e"
# Affected by uncommitted changes
nx show projects --affected --uncommitted
# Affected by untracked files
nx show projects --affected --untracked
```
## Common Exploration Patterns
### "What's in this workspace?"
```bash
nx show projects
nx show projects --type app
nx show projects --type lib
```
### "How do I build/test/lint project X?"
```bash
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
```
### "What depends on library Y?"
```bash
# Find projects that may depend on Y by searching for imports
# (Nx doesn't have a direct "dependents" command via CLI)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
```
### "What configuration options are available?"
```bash
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
```
### "Why is project X affected?"
```bash
# Check what files changed
git diff --name-only main
# See which project owns those files
nx show project X --json | jq '.root'
```
+92
View File
@@ -0,0 +1,92 @@
name: Banner Content Monitor
on:
schedule:
- cron: '*/15 * * * *'
workflow_dispatch: # Allow manual trigger
permissions: {}
env:
BANNER_URL: ${{ vars.BANNER_URL }}
jobs:
check-and-deploy:
if: ${{ github.repository_owner == 'nrwl' }}
runs-on: ubuntu-latest
steps:
- name: Fetch banner content and compute hash
id: banner
run: |
if [ -z "$BANNER_URL" ]; then
echo "BANNER_URL is not set"
exit 1
fi
# Fetch content and compute hash
CONTENT_HASH=$(curl -sf "$BANNER_URL" | sha256sum | cut -d' ' -f1)
if [ -z "$CONTENT_HASH" ]; then
echo "Failed to fetch banner content"
exit 1
fi
echo "current_hash=$CONTENT_HASH" >> $GITHUB_OUTPUT
echo "Current banner hash: $CONTENT_HASH"
- name: Restore cached hash
id: cache
uses: actions/cache/restore@v4
with:
path: .banner-hash
key: banner-content-hash-
restore-keys: |
banner-content-hash-
- name: Compare hashes
id: compare
run: |
CURRENT_HASH="${{ steps.banner.outputs.current_hash }}"
if [ -f .banner-hash ]; then
CACHED_HASH=$(cat .banner-hash)
echo "Cached hash: $CACHED_HASH"
else
CACHED_HASH=""
echo "No cached hash found"
fi
if [ "$CURRENT_HASH" != "$CACHED_HASH" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Banner content has changed!"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Banner content unchanged"
fi
- name: Trigger Netlify deploys
if: steps.compare.outputs.changed == 'true'
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
npm install -g netlify-cli
echo "Triggering nx-docs deploy..."
netlify deploy --trigger --prod -s nx-docs
echo "Triggering nx-dev deploy..."
netlify deploy --trigger --prod -s nx-dev
echo "Both deploys triggered successfully"
- name: Save new hash to cache
if: steps.compare.outputs.changed == 'true'
run: |
echo "${{ steps.banner.outputs.current_hash }}" > .banner-hash
- name: Update cache
if: steps.compare.outputs.changed == 'true'
uses: actions/cache/save@v4
with:
path: .banner-hash
key: banner-content-hash-${{ github.run_id }}
+19 -38
View File
@@ -11,12 +11,14 @@ on:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_ENABLE_METRICS_COLLECTION: 'true'
PNPM_HOME: ~/.pnpm
jobs:
main-linux:
runs-on: ubuntu-latest
env:
NX_BATCH_MODE: 'true'
NX_E2E_CI_CACHE_KEY: e2e-github-linux
NX_DAEMON: 'true'
NX_PERF_LOGGING: 'false'
@@ -28,6 +30,9 @@ jobs:
NX_ALLOW_NON_CACHEABLE_DTE: 'true'
NX_CLOUD_USE_NEW_TASK_APIS: 'true'
NX_CLOUD_USE_NEW_STREAM_OUTPUT: 'true'
NX_CLOUD_EXPERIMENTAL_POLLING: 'true'
NX_CLOUD_CONTINUOUS_ASSIGNMENT: 'true'
NX_CLOUD_VERBOSE_LOGGING: 'true'
steps:
- name: Checkout
@@ -46,7 +51,7 @@ jobs:
main-branch-name: 'master'
- name: Start CI Run
run: npx nx-cloud@next start-ci-run --fix-tasks="!*check-commit*" --auto-apply-fixes="*format:check*,*sync:check*,*conformance:check*,*format-native*,*lint-native*,*lint*,*astro-docs:validate-links*" --distribute-on="./.nx/workflows/dynamic-changesets.yaml" --stop-agents-after="e2e"
run: npx nx-cloud@next start-ci-run --distribute-on="./.nx/workflows/dynamic-changesets.yaml" --stop-agents-after="e2e"
- name: Install dependencies
run: |
@@ -56,28 +61,13 @@ jobs:
- name: Install Chrome
uses: browser-actions/setup-chrome@2dbff04819ebbfd5c974947148805a825b8a07fd # v2.1.0
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
name: Install pnpm
with:
version: 10.11.1
run_install: false
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
cache: 'pnpm'
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@ac90e63697ac2784f4ecfe2964e1a285c304003a # v1
with:
rustflags: ''
- name: Setup Java
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
cache: maven
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare --activate
- name: Setup Gradle
uses: gradle/actions/setup-gradle@48b5f213c81028ace310571dc5ec0fbbca0b2947 # v4.4.3
@@ -104,7 +94,7 @@ jobs:
pnpm nx-cloud record -- nx-cloud conformance:check
pids+=($!)
pnpm nx run-many -t check-imports check-commit check-lock-files check-codeowners --parallel=1 --no-dte &
pnpm nx run-many -t check-imports check-lock-files check-codeowners --parallel=1 --no-dte &
pids+=($!)
pnpm nx affected --targets=lint,test,test-kt,build,e2e,e2e-ci,format-native,lint-native &
@@ -149,16 +139,13 @@ jobs:
run: git fetch origin master:master
if: ${{ github.event_name == 'pull_request' }}
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
name: Install pnpm
with:
version: 10.11.1
run_install: false
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
cache: 'pnpm'
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare --activate
- name: Set SHAs
uses: nrwl/nx-set-shas@1859e66a83ac9be0dceecbd9a023702e27ac47f4 # v4.3.3
@@ -294,12 +281,6 @@ jobs:
~/Library/Caches/Homebrew
key: nrwl-nx-homebrew-packages
- name: Install Rust
if: steps.check-changes.outputs.has_changes == 'true'
uses: actions-rust-lang/setup-rust-toolchain@ac90e63697ac2784f4ecfe2964e1a285c304003a # v1
with:
rustflags: ''
- name: Install project dependencies
if: steps.check-changes.outputs.has_changes == 'true'
run: |
+10
View File
@@ -51,6 +51,8 @@ jobs:
build-mode: none
- language: rust
build-mode: none
- language: csharp
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
@@ -63,6 +65,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Language Tooling
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare --activate
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
+10
View File
@@ -46,6 +46,8 @@ jobs:
build-mode: none
- language: rust
build-mode: none
- language: csharp
build-mode: autobuild
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
@@ -58,6 +60,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Language Tooling
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare --activate
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
+26 -49
View File
@@ -20,6 +20,8 @@ jobs:
if: ${{ github.repository_owner == 'nrwl' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
env:
NODE_VERSION: ${{ matrix.node_version }}
strategy:
matrix:
os:
@@ -28,19 +30,20 @@ jobs:
# - windows-latest Windows fails to build gradle wrapper which always runs when we build nx.
## https://staging.nx.app/runs/LgD4vxGn8w?utm_source=pull-request&utm_medium=comment
node_version:
# TODO(v23): remove node 20 - EOL April 2026
- 20
- 22
# - 23
- 24
exclude:
# run just node v20 on macos and windows
# run just node v24 on macos and windows
- os: macos-latest
node_version: 20
- os: macos-latest
node_version: 22
# - os: macos-latest
# node_version: 23
# - os: windows-latest TODO (emily): Windows fails to build gradle wrapper which always runs when we build nx. Re-enable when we fix this.
# node_version: 22
# - os: windows-latest TODO (emily): Windows fails to build gradle wrapper which always runs when we build nx. Re-enable when we fix this.
# node_version: 23
# - os: windows-latest TODO(Jack): Windows fails to build gradle wrapper which always runs when we build nx. Re-enable when we fix this.
# node_version: 20
# - os: windows-latest TODO (Jack): Windows fails to build gradle wrapper which always runs when we build nx. Re-enable when we fix this.
# node_version: 22
name: Cache install (${{ matrix.os }}, node v${{ matrix.node_version }})
steps:
@@ -50,17 +53,14 @@ jobs:
fetch-depth: 0
filter: tree:0
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
name: Install pnpm
with:
version: 10.11.1
run_install: false
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- name: Set node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
- name: Enable corepack and install pnpm
run: |
npm install -g corepack@latest
corepack enable
corepack prepare --activate
- name: Get pnpm store directory
id: pnpm-cache
@@ -138,6 +138,8 @@ jobs:
contents: read
runs-on: ${{ matrix.os }}
timeout-minutes: 200 # <- cap each job to 200 minutes
env:
NODE_VERSION: ${{ matrix.node_version }}
strategy:
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}} # Load matrix from previous job
fail-fast: false
@@ -153,39 +155,14 @@ jobs:
- name: Prepare dir for output
run: mkdir -p outputs
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
name: Install pnpm
with:
version: 10.11.1
run_install: false
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
- name: Install Rust
if: ${{ matrix.os != 'windows-latest' }}
- name: Enable corepack and install pnpm
run: |
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup toolchain install 1.70.0
- name: Load Cargo Env
if: ${{ matrix.os != 'windows-latest' }}
run: echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
- name: Setup .NET 9
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
with:
dotnet-version: '9.0.x'
- name: Install bun
if: ${{ matrix.os != 'windows-latest' }}
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
with:
bun-version: latest
npm install -g corepack@latest
corepack enable
corepack prepare --activate
- name: Install packages
run: |
+3 -3
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20.19.0']
node-version: ['24']
steps:
- name: Checkout
@@ -19,14 +19,14 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: '20.19.0'
node-version: '24'
package-manager-cache: false
- name: Install pnpm
uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
id: pnpm-install
with:
version: 10.11.1
version: 10.28.2
run_install: false
- name: Get pnpm store directory
+2 -2
View File
@@ -20,12 +20,12 @@ jobs:
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
with:
version: 10.11.1
version: 10.28.2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: '20.19.0'
node-version: '24'
cache: 'pnpm'
- name: Cache node_modules
+8 -4
View File
@@ -67,6 +67,7 @@ const matrixData: MatrixData = {
{ name: 'e2e-storybook', codeowners: 'S04SVQ8H0G5' },
{ name: 'e2e-nuxt', codeowners: 'S04SJ6PL98X' }
],
// TODO(v23): remove node 20 - EOL April 2026
nodeTLS: 20,
setup: [
{
@@ -74,12 +75,15 @@ const matrixData: MatrixData = {
os_name: 'Linux',
os_timeout: 60,
package_managers: ['npm', 'pnpm', 'yarn'],
node_versions: ['20.19.0', '22.12.0'],
node_versions: ['20.19.0', '22.13.0', '24.0.0'],
excluded: ['e2e-detox', 'e2e-react-native', 'e2e-expo']
},
{ os: 'macos-latest', os_name: 'MacOS', os_timeout: 90, package_managers: ['npm'], node_versions: ['20.19.0'] }
// TODO (emily): Fix Windows support as gradle fails when running nx build https://staging.nx.app/runs/LgD4vxGn8w?utm_source=pull-request&utm_medium=comment
// { os: 'windows-latest', os_name: 'WinOS', os_timeout: 180, package_managers: ['npm'], node_versions: ['20.19.0'], excluded: ['e2e-detox', 'e2e-react-native', 'e2e-expo'] }
// Docker is not supported on ARM-based macOS runners (no nested virtualization)
// See: https://github.com/docker/setup-docker-action and https://github.com/douglascamata/setup-docker-macos-action
// We may want to look into adding intel only for this docker case, at least until vm-in-vm works on latest macos
{ os: 'macos-latest', os_name: 'MacOS', os_timeout: 90, package_managers: ['npm'], node_versions: ['24.0.0'], excluded: ['e2e-docker'] }
// TODO (Jack): Fix Windows support as gradle fails when running nx build https://staging.nx.app/runs/LgD4vxGn8w?utm_source=pull-request&utm_medium=comment
// { os: 'windows-latest', os_name: 'WinOS', os_timeout: 180, package_managers: ['npm'], node_versions: ['24.0.0'], excluded: ['e2e-detox', 'e2e-react-native', 'e2e-expo'] }
]
};
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
with:
version: 10.11.1 # Aligned with root package.json (pnpm/action-setup will helpfully error if out of sync)
version: 10.28.2 # Aligned with root package.json (pnpm/action-setup will helpfully error if out of sync)
- name: Run a security audit
run: pnpm dlx audit-ci --critical --report-type summary
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
node-version: 24
package-manager-cache: false
- name: Validate PR title
+54 -38
View File
@@ -3,7 +3,7 @@ name: publish
on:
# Automated schedule - canary releases from master
schedule:
- cron: "0 20 * * 1-5" # Monday - Friday, at 20:00 UTC (8pm UTC)
- cron: "0 19 * * 1-5" # Monday - Friday, at 19:00 UTC (7pm UTC)
# Manual trigger - PR releases or dry-runs (based on workflow inputs)
workflow_dispatch:
inputs:
@@ -22,7 +22,7 @@ env:
NX_RUN_GROUP: ${{ github.run_id }}-${{ github.run_attempt }}
CYPRESS_INSTALL_BINARY: 0
NODE_VERSION: 22.16.0
PNPM_VERSION: 10.11.1 # Aligned with root package.json (pnpm/action-setup will helpfully error if out of sync)
PNPM_VERSION: 10.28.2 # Aligned with root package.json (pnpm/action-setup will helpfully error if out of sync)
jobs:
# We first need to determine the version we are releasing, and if we need a custom repo or ref to use for the git checkout in subsequent steps.
@@ -120,10 +120,10 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-13
- host: macos-latest
target: x86_64-apple-darwin
setup: |-
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
build: |
pnpm nx run-many --target=build-native -- --target=x86_64-apple-darwin
- host: windows-latest
@@ -199,7 +199,7 @@ jobs:
rustup target add x86_64-unknown-linux-musl
pnpm nx run-many --verbose --target=build-native -- --target=x86_64-unknown-linux-musl
"
- host: macos-13
- host: macos-latest
target: aarch64-apple-darwin
setup: |-
rustup target add aarch64-apple-darwin
@@ -303,24 +303,15 @@ jobs:
repository: ${{ needs.resolve-required-data.outputs.repo || github.repository }}
ref: ${{ needs.resolve-required-data.outputs.ref || github.ref }}
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
if: ${{ !matrix.settings.docker }}
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
cache: 'pnpm'
- name: Install
uses: actions-rust-lang/setup-rust-toolchain@ac90e63697ac2784f4ecfe2964e1a285c304003a # v1
- name: Enable corepack and install pnpm
if: ${{ !matrix.settings.docker }}
with:
target: ${{ matrix.settings.target }}
rustflags: ''
run: |
corepack enable
corepack prepare --activate
- name: Cache cargo
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
@@ -363,12 +354,24 @@ jobs:
architecture: x86
- name: Build in docker
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build
run: ${{ matrix.settings.build }}
shell: bash
env:
BUILD_SCRIPT: ${{ matrix.settings.build }}
run: |
SCRIPT_FILE=$(mktemp)
echo "$BUILD_SCRIPT" > "$SCRIPT_FILE"
docker run --rm \
--user 0:0 \
-e PNPM_VERSION \
-v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db \
-v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache \
-v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index \
-v ${{ github.workspace }}:/build \
-v "$SCRIPT_FILE:/build-script.sh" \
-w /build \
${{ matrix.settings.docker }} \
bash /build-script.sh
- name: Build
run: ${{ matrix.settings.build }}
@@ -415,7 +418,7 @@ jobs:
env
whoami
sudo pkg install -y -f node libnghttp2 www/npm git openjdk17
sudo npm install --location=global --ignore-scripts pnpm@10.11.1
sudo npm install --location=global --ignore-scripts pnpm@10.28.2
# Set up Java 17
export JAVA_HOME=/usr/local/openjdk17
export PATH="$JAVA_HOME/bin:$PATH"
@@ -481,11 +484,27 @@ jobs:
rm -rf ~/.rustup/toolchains/*/share || true
# Remove other development tool caches
rm -rf ~/.cache/* || true
# Remove unnecessary workspace directories
rm -rf docs astro-docs nx-dev || true
echo "Checking disk space after cleanup"
df -h
echo "Building FreeBSD bindings"
pnpm nx run-many --verbose --outputStyle stream --target=build-native -- --target=x86_64-unknown-freebsd
BUILD_EXIT=0
pnpm nx run-many --verbose --outputStyle stream --target=build-native -- --target=x86_64-unknown-freebsd || BUILD_EXIT=$?
echo "=== Disk usage after build ==="
df -h
if [ "$BUILD_EXIT" -ne 0 ]; then
echo "Build failed with exit code $BUILD_EXIT"
exit $BUILD_EXIT
fi
echo "Build succeeded"
echo "Cleaning up"
pnpm nx reset
rm -rf node_modules
@@ -523,18 +542,14 @@ jobs:
repository: ${{ needs.resolve-required-data.outputs.repo || github.repository }}
ref: ${{ needs.resolve-required-data.outputs.ref || github.ref }}
- uses: pnpm/action-setup@7088e561eb65bb68695d245aa206f005ef30921d # v4.1.0
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup dev tools with mise
uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3
- name: Enable corepack and install pnpm
run: |
corepack enable
corepack prepare --activate
- name: Setup node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
check-latest: true
cache: 'pnpm'
- name: Use npm 11.5.2
run: npm install -g npm@11.5.2
@@ -554,6 +569,7 @@ jobs:
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-23/wasi-sdk-23.0-x86_64-linux.tar.gz
tar -xvf wasi-sdk-23.0-x86_64-linux.tar.gz
rustup toolchain install nightly-2025-05-09
pnpm build:wasm
- name: Publish
env:
+7 -2
View File
@@ -25,6 +25,10 @@ jest.debug.config.js
/nx-dev/nx-dev/public/documentation
/nx-dev/nx-dev/public/tutorials
/nx-dev/nx-dev/public/images/open-graph
# Banner JSON files are generated during static builds
/nx-dev/nx-dev/lib/banner.json
/astro-docs/src/content/banner.json
**/tests/temp-db
# Issues scraper creates these files, stored by github's cache
@@ -63,6 +67,7 @@ out
.rustup/
target
.flattened-pom.xml
dependency-reduced-pom.xml
*.wasm
/wasi-sdk*
@@ -75,10 +80,9 @@ storybook-static
.kotlin
.claude/settings.local.json
CLAUDE.local.md
.cursor/rules/nx-rules.mdc
.cursor/mcp.json
.github/instructions/nx.instructions.md
# Added by Claude Task Master
# Logs
@@ -133,3 +137,4 @@ test-results
# .NET build output
/packages/dotnet/analyzer/bin
/packages/dotnet/analyzer/obj
/*.deb
+1
View File
@@ -0,0 +1 @@
NX_USE_V8_SERIALIZER=false
+1 -1
View File
@@ -1,3 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/4.0.0-rc-5/apache-maven-4.0.0-rc-5-bin.zip
+68 -176
View File
@@ -1,184 +1,76 @@
common-env-vars: &common-env-vars
GIT_AUTHOR_EMAIL: test@test.com
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: test@test.com
GIT_COMMITTER_NAME: Test
SELECTED_PM: 'pnpm'
NX_NATIVE_LOGGING: 'nx::native::db'
# These are need for build and link validation for next.js and astro apps
NEXT_PUBLIC_ASTRO_URL: 'https://master--nx-docs.netlify.app'
NX_DEV_URL: 'https://canary.nx.dev'
common-init-steps: &common-init-steps
- name: Checkout
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/checkout/main.yaml'
- name: Cache restore
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/cache/main.yaml'
inputs:
key: 'pnpm-lock.yaml'
paths: ~/.local/share/pnpm/store
base-branch: 'master'
# reads mise.toml and installs toolchains needed for repo
- name: Setup toolchains
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/install-mise/main.yaml'
- name: Verify toolchain versions
script: |
echo "mise: $(mise --version)"
echo "node: $(node --version)"
echo "pnpm: $(pnpm --version)"
echo "bun: $(bun --version)"
echo "rust: $(rustc --version) - $(cargo --version)"
echo "dotnet: $(dotnet --version)"
echo "java: $(javac --version)"
- name: Install system deps
script: |
sudo apt-get update
sudo apt-get install -y ca-certificates lsof libvips-dev libglib2.0-dev libgirepository1.0-dev zip unzip
- name: Pnpm Install from lockfile
script: |
pnpm install --frozen-lockfile
- name: Install browsers
script: |
pnpm exec cypress install
pnpm exec playwright install --with-deps
- name: Install rust deps
script: |
cargo fetch
- name: Setup gradle
script: |
./gradlew wrapper
./gradlew --version
- name: Configure git metadata (needed for lerna smoke tests)
script: |
git config --global user.email test@test.com
git config --global user.name "Test Test"
launch-templates:
linux-large:
resource-class: 'docker_linux_amd64/large'
image: 'us-east1-docker.pkg.dev/nxcloudoperations/nx-cloud/nx-agents-base-images:ubuntu22.04-node20.19-v1'
env:
GIT_AUTHOR_EMAIL: test@test.com
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: test@test.com
GIT_COMMITTER_NAME: Test
SELECTED_PM: 'pnpm'
NX_NATIVE_LOGGING: 'nx::native::db'
# These are need for build and link validation for next.js and astro apps
NEXT_PUBLIC_ASTRO_URL: 'https://master--nx-docs.netlify.app'
NX_DEV_URL: 'https://canary.nx.dev'
init-steps:
- name: Checkout
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/checkout/main.yaml'
- name: Check Node Version
script: node --version
- name: Cache restore
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/cache/main.yaml'
inputs:
key: 'pnpm-lock.yaml'
paths: .pnpm-store
base-branch: 'master'
- name: Install zip and unzip
script: sudo apt-get -yqq install zip unzip
- name: Install bun
script: |
curl -fsSL https://bun.sh/install | bash
echo "BUN_INSTALL=$HOME/.bun" >> $NX_CLOUD_ENV
echo "PATH=$HOME/.bun/bin:$PATH" >> $NX_CLOUD_ENV
- name: Check bun
script: |
bun --version
- name: Install e2e deps
script: |
sudo apt-get update
sudo apt-get install -y ca-certificates lsof libvips-dev libglib2.0-dev libgirepository1.0-dev
- name: Pnpm Install from lockfile
script: |
pnpm install --frozen-lockfile
- name: Install Browsers
script: |
pnpm exec cypress install
pnpm exec playwright install --with-deps
- name: Install Rust
script: |
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup toolchain install 1.70.0
- name: Configure git metadata (needed for lerna smoke tests)
script: |
git config --global user.email test@test.com
git config --global user.name "Test Test"
- name: Load Cargo Env
script: echo "PATH=$HOME/.cargo/bin:$PATH" >> $NX_CLOUD_ENV
- name: Install Rust Dependencies
script: |
cargo fetch
- name: Setup Java 21
script: |
sudo apt update
sudo apt install -y openjdk-21-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
java -version
- name: Setup Gradle
script: |
./gradlew wrapper
./gradlew --version
- name: Setup .NET 9
script: |
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-9.0
dotnet --version
env: *common-env-vars
init-steps: *common-init-steps
linux-extra-large:
resource-class: 'docker_linux_amd64/extra_large'
image: 'us-east1-docker.pkg.dev/nxcloudoperations/nx-cloud/nx-agents-base-images:ubuntu22.04-node20.19-v1'
env:
GIT_AUTHOR_EMAIL: test@test.com
GIT_AUTHOR_NAME: Test
GIT_COMMITTER_EMAIL: test@test.com
GIT_COMMITTER_NAME: Test
SELECTED_PM: 'pnpm'
NX_NATIVE_LOGGING: 'nx::native::db'
# These are need for build and link validation for next.js and astro apps
NEXT_PUBLIC_ASTRO_URL: 'https://master--nx-docs.netlify.app'
NX_DEV_URL: 'https://canary.nx.dev'
init-steps:
- name: Checkout
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/checkout/main.yaml'
- name: Check Node Version
script: node --version
- name: Cache restore
uses: 'nrwl/nx-cloud-workflows/v5/workflow-steps/cache/main.yaml'
inputs:
key: 'pnpm-lock.yaml'
paths: .pnpm-store
base-branch: 'master'
- name: Install zip and unzip
script: sudo apt-get -yqq install zip unzip
- name: Install bun
script: |
curl -fsSL https://bun.sh/install | bash
echo "BUN_INSTALL=$HOME/.bun" >> $NX_CLOUD_ENV
echo "PATH=$HOME/.bun/bin:$PATH" >> $NX_CLOUD_ENV
- name: Check bun
script: |
bun --version
- name: Install e2e deps
script: |
sudo apt-get update
sudo apt-get install -y ca-certificates lsof libvips-dev libglib2.0-dev libgirepository1.0-dev
- name: Pnpm Install from lockfile
script: |
pnpm install --frozen-lockfile
- name: Install Browsers
script: |
pnpm exec cypress install
pnpm exec playwright install --with-deps
- name: Install Rust
script: |
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup toolchain install 1.70.0
- name: Configure git metadata (needed for lerna smoke tests)
script: |
git config --global user.email test@test.com
git config --global user.name "Test Test"
- name: Load Cargo Env
script: echo "PATH=$HOME/.cargo/bin:$PATH" >> $NX_CLOUD_ENV
- name: Install Rust Dependencies
script: |
cargo fetch
- name: Setup Java 21
script: |
sudo apt update
sudo apt install -y openjdk-21-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
java -version
- name: Setup Gradle
script: |
./gradlew wrapper
./gradlew --version
- name: Setup .NET 9
script: |
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-9.0
dotnet --version
env: *common-env-vars
init-steps: *common-init-steps
+52 -7
View File
@@ -1,28 +1,64 @@
distribute-on:
default: auto linux-large, 3 linux-extra-large
extra-small-changeset: 6 linux-large, 3 linux-extra-large
small-changeset: 6 linux-large, 4 linux-extra-large
medium-changeset: 6 linux-large, 5 linux-extra-large
large-changeset: 6 linux-large, 6 linux-extra-large
extra-large-changeset: 8 linux-large, 8 linux-extra-large
assignment-rules:
- projects:
- e2e-gradle
- e2e-release
- e2e-angular
- e2e-react
- e2e-next
- e2e-plugin
targets:
- e2e-ci**
run-on:
- agent: linux-extra-large
parallelism: 2
- projects:
- e2e-angular
- e2e-node
- e2e-react
targets:
- e2e-ci**
run-on:
- agent: linux-extra-large
parallelism: 1
- projects:
- nx
- workspace
- remix
- nx-maven-plugin
targets:
- install
- test
run-on:
- agent: linux-large
parallelism: 1
- agent: linux-extra-large
parallelism: 1
- projects:
- e2e-release
- e2e-nuxt
- e2e-web
- e2e-eslint
- e2e-remix
- e2e-cypress
- e2e-docker
- e2e-js
- e2e-nx
- e2e-nx-init
- nx-maven-plugin
- e2e-dotnet
- e2e-workspace-create
- e2e-rollup
targets:
- e2e-ci**
- install
run-on:
- agent: linux-large
parallelism: 1
- agent: linux-extra-large
parallelism: 1
parallelism: 2
# All other e2e tests can run in parallel
- targets:
@@ -58,6 +94,15 @@ assignment-rules:
- agent: linux-extra-large
parallelism: 6
# TODO(altan): remove when scheduling issue resolved
- projects:
- nx-dev
targets:
- prebuild-banner
run-on:
- agent: linux-extra-large
parallelism: 6
- targets:
- "*"
run-on:
+479
View File
@@ -0,0 +1,479 @@
---
description: Polls Nx Cloud CI pipeline and self-healing status. Returns structured state when actionable. Spawned by /nx-cloud-ci-monitor command to monitor CI Attempt status.
mode: subagent
---
# CI Watcher Subagent
You are a CI monitoring subagent responsible for polling Nx Cloud CI Attempt status and self-healing state. You report status back to the main agent - you do NOT make apply/reject decisions.
## Your Responsibilities
1. Poll CI status using the `ci_information` MCP tool
2. Implement exponential backoff between polls
3. Return structured state when an actionable condition is reached
4. Track iteration count and elapsed time
5. Output status updates based on verbosity level
## Input Parameters (from Main Agent)
The main agent may provide these optional parameters in the prompt:
| Parameter | Description |
| ------------------- | -------------------------------------------------------- |
| `branch` | Branch to monitor (auto-detected if not provided) |
| `expectedCommitSha` | Commit SHA that should trigger a new CI Attempt |
| `previousCipeUrl` | CI Attempt URL before the action (to detect change) |
| `subagentTimeout` | Polling timeout in minutes (default: 60) |
| `verbosity` | Output level: minimal, medium, verbose (default: medium) |
When `expectedCommitSha` or `previousCipeUrl` is provided, you must detect whether a new CI Attempt has spawned.
## MCP Tool Reference
### `ci_information`
**Input:**
```json
{
"branch": "string (optional, defaults to current git branch)",
"select": "string (optional, comma-separated field names)",
"pageToken": "number (optional, 0-based pagination for long strings)"
}
```
**Output:**
```json
{
"cipeStatus": "NOT_STARTED | IN_PROGRESS | SUCCEEDED | FAILED | CANCELED | TIMED_OUT",
"cipeUrl": "string",
"branch": "string",
"commitSha": "string | null",
"failedTaskIds": "string[]",
"verifiedTaskIds": "string[]",
"selfHealingEnabled": "boolean",
"selfHealingStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"verificationStatus": "NOT_STARTED | IN_PROGRESS | COMPLETED | FAILED | NOT_EXECUTABLE | null",
"userAction": "NONE | APPLIED | REJECTED | APPLIED_LOCALLY | APPLIED_AUTOMATICALLY | null",
"failureClassification": "string | null",
"taskOutputSummary": "string | null",
"suggestedFixReasoning": "string | null",
"suggestedFixDescription": "string | null",
"suggestedFix": "string | null",
"shortLink": "string | null",
"couldAutoApplyTasks": "boolean | null",
"confidence": "number | null",
"confidenceReasoning": "string | null"
}
```
**Select Parameter:**
| Usage | Returns |
| --------------- | ----------------------------------------------------------- |
| No `select` | Formatted overview (truncated, not recommended for polling) |
| Single field | Raw value with pagination for long strings |
| Multiple fields | Object with requested field values |
**Field Sets for Efficient Polling:**
```yaml
WAIT_FIELDS:
'cipeUrl,commitSha,cipeStatus'
# Minimal fields for detecting new CI Attempt
LIGHT_FIELDS:
'cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning'
# Status fields for determining actionable state
HEAVY_FIELDS:
'taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription'
# Large content fields - fetch only when returning to main agent
```
## Initial Wait
Before first poll, wait based on context:
- **Fresh start (no expected CIPE):** Wait 60 seconds to allow CI to start
- **Expecting new CIPE:** Wait 30 seconds (action already triggered)
**IMPORTANT:** Always run sleep in foreground, NOT as background command.
```bash
sleep 60 # or 30 if expecting new CIPE (FOREGROUND, not background)
```
## Two-Phase Operation
The subagent operates in one of two modes depending on input:
### Mode 1: Fresh Start (no `expectedCommitSha` or `previousCipeUrl`)
Normal polling - process whatever CIPE is returned by `ci_information`.
### Mode 2: Wait-for-New-CIPE (when `expectedCommitSha` or `previousCipeUrl` provided)
**CRITICAL**: When expecting a new CIPE, the subagent must **completely ignore** the old/stale CIPE. Do NOT process its status, do NOT return actionable states based on it.
#### Phase A: Wait Mode
1. Start a **new-CIPE timeout** timer (default: 30 minutes)
2. On each poll of `ci_information`:
- Check if CIPE is NEW:
- `cipeUrl` differs from `previousCipeUrl`**new CIPE detected**
- `commitSha` matches `expectedCommitSha`**correct CIPE detected**
- If still OLD CIPE: **ignore all status fields**, just wait and poll again
- Do NOT return `fix_available`, `ci_success`, etc. based on old CIPE!
3. Output wait status (see below)
4. If timeout (30 min) reached → return `no_new_cipe`
#### Phase B: Normal Polling (after new CIPE detected)
Once new CIPE is detected:
1. Clear the new-CIPE timeout
2. Switch to normal polling mode
3. Process the NEW CIPE's status normally
4. Return when actionable state reached
### Wait Mode Output
While in wait mode, output clearly that you're waiting (not processing):
```
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] WAIT MODE - Expecting new CI Attempt
[CI Monitor] Expected SHA: <expectedCommitSha>
[CI Monitor] Previous CI Attempt: <previousCipeUrl>
[CI Monitor] ═══════════════════════════════════════════════════════
[CI Monitor] Polling... (elapsed: 0m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 1m 30s)
[CI Monitor] Still seeing previous CI Attempt (ignoring): <oldCipeUrl>
[CI Monitor] Polling... (elapsed: 2m 30s)
[CI Monitor] ✓ New CI Attempt detected! URL: <newCipeUrl>, SHA: <newCommitSha>
[CI Monitor] Switching to normal polling mode...
```
### Why This Matters (Context Preservation)
**The problem**: Stale CIPE data can be very large:
- `taskOutputSummary`: potentially thousands of characters of build/test output
- `suggestedFix`: entire patch files
- `suggestedFixReasoning`: detailed explanation
If subagent returns stale CIPE data to main agent, it **pollutes main agent's context** with useless information (we already processed that CIPE). This wastes valuable context window.
**Without wait mode:**
1. Poll `ci_information` → get old CIPE with huge data
2. Return to main agent with all that stale data
3. Main agent's context gets polluted with useless info
4. Main agent has to process/ignore it anyway
**With wait mode:**
1. Poll `ci_information` → get old CIPE → **ignore it, don't return**
2. Keep waiting internally (stale data stays in subagent)
3. New CIPE appears → switch to normal mode
4. Return to main agent with only the NEW, relevant CIPE data
## Polling Loop
### Subagent State Management
Maintain internal accumulated state across polls:
```
accumulated_state = {}
```
### Call `ci_information` MCP Tool
**Wait Mode (expecting new CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeUrl,commitSha,cipeStatus"
})
```
Only fetch minimal fields needed to detect CI Attempt change. Do NOT fetch heavy fields - stale data wastes context.
**Normal Mode (processing CI Attempt):**
```
ci_information({
branch: "<branch_name>",
select: "cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,shortLink,confidence,confidenceReasoning"
})
```
Merge response into `accumulated_state` after each poll.
### Analyze Response
**If in Wait Mode** (expecting new CIPE):
1. Check if CIPE is new (see Two-Phase Operation above)
2. If old CIPE → **ignore status**, output wait message, poll again
3. If new CIPE → switch to normal mode, continue below
**If in Normal Mode**:
Based on the response, decide whether to **keep polling** or **return to main agent**.
### Keep Polling When
Continue polling (with backoff) if ANY of these conditions are true:
| Condition | Reason |
| --------------------------------------- | ---------------------------------------- |
| `cipeStatus == 'IN_PROGRESS'` | CI still running |
| `cipeStatus == 'NOT_STARTED'` | CI hasn't started yet |
| `selfHealingStatus == 'IN_PROGRESS'` | Self-healing agent working |
| `selfHealingStatus == 'NOT_STARTED'` | Self-healing not started yet |
| `failureClassification == 'FLAKY_TASK'` | Auto-rerun in progress |
| `userAction == 'APPLIED_AUTOMATICALLY'` | New CI Attempt spawning after auto-apply |
When `couldAutoApplyTasks == true`:
- `verificationStatus` = `NOT_STARTED`, `IN_PROGRESS` → keep polling (verification still in progress)
- `verificationStatus` = `COMPLETED` → return `fix_auto_applying` (auto-apply will happen, main agent spawns wait mode subagent)
- `verificationStatus` = `FAILED`, `NOT_EXECUTABLE` → return `fix_available` (auto-apply won't happen, needs manual action)
### Exponential Backoff
Between polls, wait with exponential backoff:
| Poll Attempt | Wait Time |
| ------------ | ----------------- |
| 1st | 60 seconds |
| 2nd | 90 seconds |
| 3rd+ | 120 seconds (cap) |
Reset to 60 seconds when state changes significantly.
**IMPORTANT:** Run sleep in foreground (NOT as background command). Background sleep causes "What should Claude do?" prompts when completed.
```bash
# Example backoff - run in FOREGROUND
sleep 60 # First wait
sleep 90 # Second wait
sleep 120 # Third and subsequent waits (capped)
```
### Fetch Heavy Fields on Actionable State
Before returning to main agent, fetch heavy fields if the status requires them:
| Status | Heavy Fields Needed |
| ------------------- | ------------------------------------------------------------------------------ |
| `ci_success` | None |
| `fix_auto_applying` | None |
| `fix_available` | `taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription` |
| `fix_failed` | `taskOutputSummary` |
| `no_fix` | `taskOutputSummary` |
| `environment_issue` | None |
| `no_new_cipe` | None |
| `polling_timeout` | None |
| `cipe_canceled` | None |
| `cipe_timed_out` | None |
```
# Example: fetching heavy fields for fix_available
ci_information({
branch: "<branch_name>",
select: "taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription"
})
```
Merge response into `accumulated_state`, then return merged state to main agent.
**Pagination:** Heavy string fields return first page only. If `hasMore` indicated, include in return format so main agent knows more content available.
### Return to Main Agent When
Return immediately with structured state if ANY of these conditions are true:
| Status | Condition |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | `cipeStatus == 'SUCCEEDED'` |
| `fix_auto_applying` | `selfHealingStatus == 'COMPLETED'` AND `couldAutoApplyTasks == true` AND `verificationStatus == 'COMPLETED'` |
| `fix_available` | `selfHealingStatus == 'COMPLETED'` AND `suggestedFix != null` AND (`couldAutoApplyTasks != true` OR `verificationStatus` in (`FAILED`, `NOT_EXECUTABLE`)) |
| `fix_failed` | `selfHealingStatus == 'FAILED'` |
| `environment_issue` | `failureClassification == 'ENVIRONMENT_STATE'` |
| `no_fix` | `cipeStatus == 'FAILED'` AND (`selfHealingEnabled == false` OR `selfHealingStatus == 'NOT_EXECUTABLE'`) |
| `no_new_cipe` | `expectedCommitSha` or `previousCipeUrl` provided, but no new CI Attempt detected after 30 min |
| `polling_timeout` | Subagent has been polling for > configured timeout (default 60 min) |
| `cipe_canceled` | `cipeStatus == 'CANCELED'` |
| `cipe_timed_out` | `cipeStatus == 'TIMED_OUT'` |
## Subagent Timeout
Track elapsed time. If you have been polling for more than **60 minutes** (configurable via main agent), return with `status: polling_timeout`.
## Return Format
When returning to the main agent, provide a structured response with accumulated state:
```
## CI Monitor Result
**Status:** <status>
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### CI Attempt Details
- **Status:** <cipeStatus>
- **URL:** <cipeUrl>
- **Branch:** <branch>
- **Commit:** <commitSha>
- **Failed Tasks:** <failedTaskIds>
- **Verified Tasks:** <verifiedTaskIds>
### Self-Healing Details
- **Enabled:** <selfHealingEnabled>
- **Status:** <selfHealingStatus>
- **Verification:** <verificationStatus>
- **User Action:** <userAction>
- **Classification:** <failureClassification>
- **Confidence:** <confidence>
- **Confidence Reasoning:** <confidenceReasoning>
### Fix Information (if available)
- **Short Link:** <shortLink>
- **Description:** <suggestedFixDescription>
- **Reasoning:** <suggestedFixReasoning>
### Task Output Summary (first page)
<taskOutputSummary>
[MORE_CONTENT_AVAILABLE: taskOutputSummary, pageToken: 1]
### Suggested Fix (first page)
<suggestedFix>
[MORE_CONTENT_AVAILABLE: suggestedFix, pageToken: 1]
```
### Pagination Indicators
When a heavy field has more content available, append indicator:
```
[MORE_CONTENT_AVAILABLE: <fieldName>, pageToken: <nextPage>]
```
Main agent can fetch additional pages if needed using:
```
ci_information({ select: "<fieldName>", pageToken: <nextPage> })
```
Fields that may have pagination:
- `taskOutputSummary` (reverse pagination - page 0 = most recent)
- `suggestedFix` (forward pagination - page 0 = start)
- `suggestedFixReasoning`
### Return Format for `no_new_cipe`
When returning with `status: no_new_cipe`, include additional context:
```
## CI Monitor Result
**Status:** no_new_cipe
**Iterations:** <count>
**Elapsed:** <minutes>m <seconds>s
### Expected CI Attempt Not Found
- **Expected Commit SHA:** <expectedCommitSha>
- **Previous CI Attempt URL:** <previousCipeUrl>
- **Last Seen CI Attempt URL:** <cipeUrl>
- **Last Seen Commit SHA:** <commitSha>
- **New CI Attempt Timeout:** 30 minutes (exceeded)
### Likely Cause
CI workflow failed before Nx tasks could run (e.g., install step, checkout, auth).
Check your CI provider logs for the commit <expectedCommitSha>.
### Last Known CI Attempt State
- **Status:** <cipeStatus>
- **Branch:** <branch>
```
## Status Reporting (Verbosity-Controlled)
Output is controlled by the `verbosity` parameter from the main agent:
| Level | What to Output |
| --------- | ----------------------------------------------------------------- |
| `minimal` | No intermediate output. Only return final result when actionable. |
| `medium` | Output only on significant state changes (not every poll). |
| `verbose` | Output detailed phase information after every poll. |
### Minimal Verbosity
No output during polling. Poll silently and return when done.
### Medium Verbosity (Default)
Output **only when state changes significantly** to save context tokens:
- `cipeStatus` changes (e.g., IN_PROGRESS → FAILED)
- `selfHealingStatus` changes (e.g., IN_PROGRESS → COMPLETED)
- New CI Attempt detected (in wait mode)
Format: single line, no decorators:
```
[CI Monitor] CI: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 4m
```
### Verbose Verbosity
Output detailed phase box after every poll:
```
[CI Monitor] ─────────────────────────────────────────────────────
[CI Monitor] Iteration <N> | Elapsed: <X>m <Y>s
[CI Monitor]
[CI Monitor] CI Status: <cipeStatus>
[CI Monitor] Self-Healing: <selfHealingStatus>
[CI Monitor] Verification: <verificationStatus>
[CI Monitor] Classification: <failureClassification>
[CI Monitor]
[CI Monitor] → <human-readable phase description>
[CI Monitor] ─────────────────────────────────────────────────────
```
### Phase Descriptions (for verbose output)
| Status Combo | Description |
| ----------------------------------------------------------------------------------------- | ------------------------------------------- |
| `cipeStatus: IN_PROGRESS` | "CI running..." |
| `cipeStatus: NOT_STARTED` | "Waiting for CI to start..." |
| `cipeStatus: FAILED` + `selfHealingStatus: NOT_STARTED` | "CI failed. Self-healing starting..." |
| `cipeStatus: FAILED` + `selfHealingStatus: IN_PROGRESS` | "CI failed. Self-healing generating fix..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: IN_PROGRESS` | "Fix generated! Verification running..." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: COMPLETED` | "Fix ready! Verified successfully." |
| `cipeStatus: FAILED` + `selfHealingStatus: COMPLETED` + `verificationStatus: FAILED` | "Fix generated but verification failed." |
| `cipeStatus: FAILED` + `selfHealingStatus: FAILED` | "Self-healing could not generate a fix." |
| `cipeStatus: SUCCEEDED` | "CI passed!" |
## Important Notes
- You do NOT make apply/reject decisions - that's the main agent's job
- You do NOT perform git operations
- You only poll and report state
- Respect the `verbosity` parameter for output (default: medium)
- If `ci_information` returns an error, wait and retry (count as failed poll)
- Track consecutive failures - if 5 consecutive failures, return with `status: error`
- When expecting new CI Attempt, track the 30-minute new-CI-Attempt timeout separately from the main polling timeout
+437
View File
@@ -0,0 +1,437 @@
---
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
argument-hint: '[instructions] [--max-cycles N] [--timeout MINUTES] [--verbosity minimal|medium|verbose] [--branch BRANCH] [--fresh] [--auto-fix-workflow] [--new-cipe-timeout MINUTES]'
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
$ARGUMENTS
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `$ARGUMENTS` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+437
View File
@@ -0,0 +1,437 @@
---
name: ci-monitor
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes automatically. Checks for Nx Cloud connection before starting.
---
# CI Monitor Command
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn the `ci-watcher` subagent to poll CI status and make decisions based on the results.
## Context
- **Current Branch:** !`git branch --show-current`
- **Current Commit:** !`git rev-parse --short HEAD`
- **Remote Status:** !`git status -sb | head -1`
## User Instructions
$ARGUMENTS
**Important:** If user provides specific instructions, respect them over default behaviors described below.
## Configuration Defaults
| Setting | Default | Description |
| ------------------------- | ------------- | ------------------------------------------------------------------- |
| `--max-cycles` | 10 | Maximum CIPE cycles before timeout |
| `--timeout` | 120 | Maximum duration in minutes |
| `--verbosity` | medium | Output level: minimal, medium, verbose |
| `--branch` | (auto-detect) | Branch to monitor |
| `--subagent-timeout` | 60 | Subagent polling timeout in minutes |
| `--fresh` | false | Ignore previous context, start fresh |
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CIPE failures (e.g., lockfile updates) |
| `--new-cipe-timeout` | 10 | Minutes to wait for new CIPE after action |
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
Parse any overrides from `$ARGUMENTS` and merge with defaults.
## Nx Cloud Connection Check
**CRITICAL**: Before starting the monitoring loop, verify the workspace is connected to Nx Cloud.
### Step 0: Verify Nx Cloud Connection
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
2. **If `nx.json` missing OR neither property exists** → exit with:
```
[ci-monitor] Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
```
3. **If connected** → continue to main loop
## Session Context Behavior
**Important:** Within a Claude Code session, conversation context persists. If you Ctrl+C to interrupt the monitor and re-run `/ci-monitor`, Claude remembers the previous state and may continue from where it left off.
- **To continue monitoring:** Just re-run `/ci-monitor` (context is preserved)
- **To start fresh:** Use `/ci-monitor --fresh` to ignore previous context
- **For a completely clean slate:** Exit Claude Code and restart `claude`
## Default Behaviors by Status
The subagent returns with one of the following statuses. This table defines the **default behavior** for each status. User instructions can override any of these.
| Status | Default Behavior |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ci_success` | Exit with success. Log "CI passed successfully!" |
| `fix_auto_applying` | Fix will be auto-applied by self-healing. Do NOT call MCP. Record `last_cipe_url`, spawn new subagent in wait mode to poll for new CIPE. |
| `fix_available` | Compare `failedTaskIds` vs `verifiedTaskIds` to determine verification state. See **Fix Available Decision Logic** section below. |
| `fix_failed` | Self-healing failed to generate fix. Attempt local fix based on `taskOutputSummary`. If successful → commit, push, loop. If not → exit with failure. |
| `environment_issue` | Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`. New CIPE spawns automatically. Loop to poll for new CIPE. |
| `no_fix` | CI failed, no fix available (self-healing disabled or not executable). Attempt local fix if possible. Otherwise exit with failure. |
| `no_new_cipe` | Expected CIPE never spawned (CI workflow likely failed before Nx tasks). Report to user, attempt common fixes if configured, or exit with guidance. |
| `polling_timeout` | Subagent polling timeout reached. Exit with timeout. |
| `cipe_canceled` | CIPE was canceled. Exit with canceled status. |
| `cipe_timed_out` | CIPE timed out. Exit with timeout status. |
| `error` | Increment `no_progress_count`. If >= 3 → exit with circuit breaker. Otherwise wait 60s and loop. |
### Fix Available Decision Logic
When subagent returns `fix_available`, main agent compares `failedTaskIds` vs `verifiedTaskIds`:
#### Step 1: Categorize Tasks
1. **Verified tasks** = tasks in both `failedTaskIds` AND `verifiedTaskIds`
2. **Unverified tasks** = tasks in `failedTaskIds` but NOT in `verifiedTaskIds`
3. **E2E tasks** = unverified tasks where target contains "e2e" (task format: `<project>:<target>` or `<project>:<target>:<config>`)
4. **Verifiable tasks** = unverified tasks that are NOT e2e
#### Step 2: Determine Path
| Condition | Path |
| --------------------------------------- | ---------------------------------------- |
| No unverified tasks (all verified) | Apply via MCP |
| Unverified tasks exist, but ALL are e2e | Apply via MCP (treat as verified enough) |
| Verifiable tasks exist | Local verification flow |
#### Step 3a: Apply via MCP (fully/e2e-only verified)
- Call `update_self_healing_fix({ shortLink, action: "APPLY" })`
- Record `last_cipe_url`, spawn subagent in wait mode
#### Step 3b: Local Verification Flow
When verifiable (non-e2e) unverified tasks exist:
1. **Detect package manager:**
- `pnpm-lock.yaml` exists → `pnpm nx`
- `yarn.lock` exists → `yarn nx`
- Otherwise → `npx nx`
2. **Run verifiable tasks in parallel:**
- Spawn `general` subagents to run each task concurrently
- Each subagent runs: `<pm> nx run <taskId>`
- Collect pass/fail results from all subagents
3. **Evaluate results:**
| Result | Action |
| ------------------------- | ---------------------------- |
| ALL verifiable tasks pass | Apply via MCP |
| ANY verifiable task fails | Apply-locally + enhance flow |
4. **Apply-locally + enhance flow:**
- Run `nx apply-locally <shortLink>`
- Enhance the code to fix failing tasks
- Run failing tasks again to verify fix
- If still failing → increment `local_verify_count`, loop back to enhance
- If passing → commit and push, record `expected_commit_sha`, spawn subagent in wait mode
5. **Track attempts** (wraps step 4):
- Increment `local_verify_count` after each enhance cycle
- If `local_verify_count >= local_verify_attempts` (default: 3):
- Get code in commit-able state
- Commit and push with message indicating local verification failed
- Report to user:
```
[ci-monitor] Local verification failed after <N> attempts. Pushed to CI for final validation. Failed: <taskIds>
```
- Record `expected_commit_sha`, spawn subagent in wait mode (let CI be final judge)
#### Commit Message Format
```bash
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"
```
### Unverified Fix Flow (No Verification Attempted)
When `verificationStatus` is `FAILED`, `NOT_EXECUTABLE`, or fix has `couldAutoApplyTasks != true` with no verification:
- Analyze fix content (`suggestedFix`, `suggestedFixReasoning`, `taskOutputSummary`)
- If fix looks correct → apply via MCP
- If fix needs enhancement → use Apply Locally + Enhance Flow above
- If fix is wrong → reject via MCP, fix from scratch, commit, push
### Auto-Apply Eligibility
The `couldAutoApplyTasks` field indicates whether the fix is eligible for automatic application:
- **`true`**: Fix is eligible for auto-apply. Subagent keeps polling while verification is in progress. Returns `fix_auto_applying` when verified, or `fix_available` if verification fails.
- **`false`** or **`null`**: Fix requires manual action (apply via MCP, apply locally, or reject)
**Key point**: When subagent returns `fix_auto_applying`, do NOT call MCP to apply - self-healing handles it. Just spawn a new subagent in wait mode.
### Apply vs Reject vs Apply Locally
- **Apply via MCP**: Calls `update_self_healing_fix({ shortLink, action: "APPLY" })`. Self-healing agent applies the fix in CI and a new CIPE spawns automatically. No local git operations needed.
- **Apply Locally**: Runs `nx apply-locally <shortLink>`. Applies the patch to your local working directory and sets state to `APPLIED_LOCALLY`. Use this when you want to enhance the fix before pushing.
- **Reject via MCP**: Calls `update_self_healing_fix({ shortLink, action: "REJECT" })`. Marks fix as rejected. Use only when the fix is completely wrong and you'll fix from scratch.
### Apply Locally + Enhance Flow
When the fix needs enhancement (use `nx apply-locally`, NOT reject):
1. Apply the patch locally: `nx apply-locally <shortLink>` (this also updates state to `APPLIED_LOCALLY`)
2. Make additional changes as needed
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Reject + Fix From Scratch Flow
When the fix is completely wrong:
1. Call MCP to reject: `update_self_healing_fix({ shortLink, action: "REJECT" })`
2. Fix the issue from scratch locally
3. Commit and push:
```bash
git add -A
git commit -m "fix: resolve <failedTaskIds>"
git push origin $(git branch --show-current)
```
4. Loop to poll for new CIPE
### Environment Issue Handling
When `failureClassification == 'ENVIRONMENT_STATE'`:
1. Call MCP to request rerun: `update_self_healing_fix({ shortLink, action: "RERUN_ENVIRONMENT_STATE" })`
2. New CIPE spawns automatically (no local git operations needed)
3. Loop to poll for new CIPE with `previousCipeUrl` set
### No-New-CIPE Handling
When `status == 'no_new_cipe'`:
This means the expected CIPE was never created - CI likely failed before Nx tasks could run.
1. **Report to user:**
```
[ci-monitor] No CI attempt for <sha> after 10 min. Check CI provider for pre-Nx failures (install, checkout, auth). Last CI attempt: <previousCipeUrl>
```
2. **If user configured auto-fix attempts** (e.g., `--auto-fix-workflow`):
- Detect package manager: check for `pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`
- Run install to update lockfile:
```bash
pnpm install # or npm install / yarn install
```
- If lockfile changed:
```bash
git add pnpm-lock.yaml # or appropriate lockfile
git commit -m "chore: update lockfile"
git push origin $(git branch --show-current)
```
- Record new commit SHA, loop to poll with `expectedCommitSha`
3. **Otherwise:** Exit with `no_new_cipe` status, providing guidance for user to investigate
## Exit Conditions
Exit the monitoring loop when ANY of these conditions are met:
| Condition | Exit Type |
| ------------------------------------------- | ---------------- |
| CI passes (`cipeStatus == 'SUCCEEDED'`) | Success |
| Max CIPE cycles reached | Timeout |
| Max duration reached | Timeout |
| 3 consecutive no-progress iterations | Circuit breaker |
| No fix available and local fix not possible | Failure |
| No new CIPE and auto-fix not configured | Pre-CIPE failure |
| User cancels | Cancelled |
## Main Loop
### Step 1: Initialize Tracking
```
cycle_count = 0
start_time = now()
no_progress_count = 0
local_verify_count = 0
last_state = null
last_cipe_url = null
expected_commit_sha = null
```
### Step 2: Spawn Subagent
Spawn the `ci-watcher` subagent to poll CI status:
**Fresh start (first spawn, no expected CIPE):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>."
)
```
**After action that triggers new CIPE (wait mode):**
```
Task(
agent: "ci-watcher",
prompt: "Monitor CI for branch '<branch>'.
Subagent timeout: <subagent-timeout> minutes.
New-CIPE timeout: <new-cipe-timeout> minutes.
Verbosity: <verbosity>.
WAIT MODE: A new CIPE should spawn. Ignore old CIPE until new one appears.
Expected commit SHA: <expected_commit_sha>
Previous CIPE URL: <last_cipe_url>"
)
```
### Step 3: Handle Subagent Response
When subagent returns:
1. Check the returned status
2. Look up default behavior in the table above
3. Check if user instructions override the default
4. Execute the appropriate action
5. **If action expects new CIPE**, update tracking (see Step 3a)
6. If action results in looping, go to Step 2
### Step 3a: Track State for New-CIPE Detection
After actions that should trigger a new CIPE, record state before looping:
| Action | What to Track | Subagent Mode |
| ----------------------------- | --------------------------------------------- | ------------- |
| Fix auto-applying | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply via MCP | `last_cipe_url = current cipeUrl` | Wait mode |
| Apply locally + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Reject + fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Fix failed + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| No fix + local fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
| Environment rerun | `last_cipe_url = current cipeUrl` | Wait mode |
| No-new-CIPE + auto-fix + push | `expected_commit_sha = $(git rev-parse HEAD)` | Wait mode |
**CRITICAL**: When passing `expectedCommitSha` or `last_cipe_url` to the subagent, it enters **wait mode**:
- Subagent will **completely ignore** the old/stale CIPE
- Subagent will only wait for new CIPE to appear
- Subagent will NOT return to main agent with stale CIPE data
- Once new CIPE detected, subagent switches to normal polling
**Why wait mode matters for context preservation**: Stale CIPE data can be very large (task output summaries, suggested fix patches, reasoning). If subagent returns this to main agent, it pollutes main agent's context with useless data since we already processed that CIPE. Wait mode keeps stale data in the subagent, never sending it to main agent.
### Step 4: Progress Tracking
After each action:
- If state changed significantly → reset `no_progress_count = 0`
- If state unchanged → `no_progress_count++`
- On new CI attempt detected → reset `local_verify_count = 0`
## Status Reporting
Based on verbosity level:
| Level | What to Report |
| --------- | -------------------------------------------------------------------------- |
| `minimal` | Only final result (success/failure/timeout) |
| `medium` | State changes + periodic updates ("Cycle N \| Elapsed: Xm \| Status: ...") |
| `verbose` | All of medium + full subagent responses, git outputs, MCP responses |
## User Instruction Examples
Users can override default behaviors:
| Instruction | Effect |
| ------------------------------------------------ | --------------------------------------------- |
| "never auto-apply" | Always prompt before applying any fix |
| "always ask before git push" | Prompt before each push |
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
| "if confidence < 70, reject" | Check confidence field before applying |
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CIPE failures |
| "wait 45 min for new CIPE" | Override new-CIPE timeout (default: 10 min) |
## Error Handling
| Error | Action |
| ------------------------ | ------------------------------------------------------------------------------------- |
| Git rebase conflict | Report to user, exit |
| `nx apply-locally` fails | Report to user, attempt manual patch or exit |
| MCP tool error | Retry once, if fails report to user |
| Subagent spawn failure | Retry once, if fails exit with error |
| No new CIPE detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
## Example Session
### Example 1: Normal Flow with Self-Healing (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-auth'
[ci-monitor] Config: max-cycles=5, timeout=120m, verbosity=medium
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: IN_PROGRESS | Self-Healing: NOT_STARTED | Elapsed: 1m
[CI Monitor] CI attempt: FAILED | Self-Healing: IN_PROGRESS | Elapsed: 3m
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 5m
[ci-monitor] Fix available! Verification: COMPLETED
[ci-monitor] Applying fix via MCP...
[ci-monitor] Fix applied in CI. Waiting for new CI attempt...
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 8m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 2
- Total time: 12m 34s
- Fixes applied: 1
- Result: SUCCESS
```
### Example 2: Pre-CI Failure (medium verbosity)
```
[ci-monitor] Starting CI monitor for branch 'feature/add-products'
[ci-monitor] Config: max-cycles=5, timeout=120m, auto-fix-workflow=true
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] CI attempt: FAILED | Self-Healing: COMPLETED | Elapsed: 2m
[ci-monitor] Applying fix locally, enhancing, and pushing...
[ci-monitor] Committed: abc1234
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] Waiting for new CI attempt... (expected SHA: abc1234)
[CI Monitor] ⚠️ CI attempt timeout (10 min). Returning no_new_cipe.
[ci-monitor] Status: no_new_cipe
[ci-monitor] --auto-fix-workflow enabled. Attempting lockfile update...
[ci-monitor] Lockfile updated. Committed: def5678
[ci-monitor] Spawning subagent to poll CI status...
[CI Monitor] New CI attempt detected!
[CI Monitor] CI attempt: SUCCEEDED | Elapsed: 18m
[ci-monitor] CI passed successfully!
[ci-monitor] Summary:
- Total cycles: 3
- Total time: 22m 15s
- Fixes applied: 1 (self-healing) + 1 (lockfile)
- Result: SUCCESS
```
+228
View File
@@ -0,0 +1,228 @@
---
name: nx-generate
description: Generate code using nx generators. USE WHEN scaffolding code or transforming existing code - for example creating libraries or applications, or anything else that is boilerplate code or automates repetitive tasks. ALWAYS use this first when generating code with Nx instead of calling MCP tools or running nx generate immediately.
---
# Run Nx Generator
Nx generators are powerful tools that scaffold projects, make automated code migrations or automate repetitive tasks in a monorepo. They ensure consistency across the codebase and reduce boilerplate work.
This skill applies when the user wants to:
- Create new projects like libraries or applications
- Scaffold features or boilerplate code
- Run workspace-specific or custom generators
- Do anything else that an nx generator exists for
## Generator Discovery Flow
### Step 1: List Available Generators
Use the Nx CLI to discover available generators:
- List all generators for a plugin: `npx nx list @nx/react`
- View available plugins: `npx nx list`
This includes:
- Plugin generators (e.g., `@nx/react:library`, `@nx/js:library`)
- Local workspace generators (defined in the repo's own plugins)
### Step 2: Match Generator to User Request
Based on the user's request, identify which generator(s) could fulfill their needs. Consider:
- What artifact type they want to create (library, application, etc.)
- Which framework or technology stack is relevant
- Whether they mentioned specific generator names
**IMPORTANT**: When both a local workspace generator and an external plugin generator could satisfy the request, **always prefer the local workspace generator**. Local generators are customized for the specific repo's patterns and conventions.
It's possible that the user request is something that no Nx generator exists for whatsoever. In this case, you can stop using this skill and try to help the user another way. HOWEVER, the burden of proof for this is high. Before aborting, carefully consider each and every generator that's available. Look into details for any that could be related in any way before making this decision.
## Pre-Execution Checklist
Before running any generator, complete these steps:
### 1. Fetch Generator Schema
Use the `--help` flag to understand all available options:
```bash
npx nx g @nx/react:library --help
```
Pay attention to:
- Required options that must be provided
- Optional options that may be relevant to the user's request
- Default values that might need to be overridden
### 2. Read Generator Source Code
Understanding what the generator actually does helps you:
- Know what files will be created/modified
- Understand any side effects (updating configs, installing deps, etc.)
- Identify options that might not be obvious from the schema
To find generator source code:
- For plugin generators: Use `node -e "console.log(require.resolve('@nx/<plugin>/generators.json'));"` to find the generators.json, then locate the source from there
- If that fails, read directly from `node_modules/<plugin>/generators.json`
- For local generators: They are typically in `tools/generators/` or a local plugin directory. You can search the repo for the generator name to find it.
### 2.5 Reevaluate if the generator is right
Once you have built up an understanding of what the selected generator does, reconsider: Is this the right generator to service the user request?
If not, it's okay to go back to the Generator Discovery Flow and select a different generator before proceeding. If you do, make sure to go through the entire pre-execution checklist once more.
### 3. Understand Repo Context
Before generating, examine the target area of the codebase:
- Look at similar existing artifacts (other libraries, applications, etc.)
- Identify patterns and conventions used in the repo
- Note naming conventions, file structures, and configuration patterns
- Try to match these patterns when configuring the generator
For example, if similar libraries are using a specific test runner, build tool or linter, try to match that if possible.
If projects or other artifacts are organized with a specific naming convention, try to match it.
### 4. Validate Required Options
Ensure all required options have values:
- Map the user's request to generator options
- Infer values from context where possible
- Ask the user for any critical missing information
## Execution
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally.
Many generators will behave differently based on where they are executed. For example, first-party nx library generators use the cwd to determine the directory that the library should be placed in. This is highly important.
### Consider Dry-Run (Optional)
Running with `--dry-run` first is strongly encouraged but not mandatory. Use your judgment:
- For complex generators or unfamiliar territory: do a dry-run first
- For simple, well-understood generators: may proceed directly
- Dry-run shows file names and created/deleted/modified markers, but not content
- There are cases where a generator does not support dry-run (for example if it had to install an npm package) - in that case --dry-run might fail. Don't be discouraged but simply move on to running the generator for real and iterating from there.
### Running the Generator
Execute the generator with:
```bash
nx generate <generator-name> <options> --no-interactive
```
**CRITICAL**: Always include `--no-interactive` to prevent prompts that would hang the execution.
Example:
```bash
nx generate @nx/react:library --name=my-utils --no-interactive
```
### Handling Generator Failures
If the generator fails:
1. **Diagnose the error** - Read the error message carefully
2. **Identify the cause** - Missing options, invalid values, conflicts, etc.
3. **Attempt automatic fix** - Adjust options or resolve conflicts
4. **Retry** - Run the generator again with corrected options
Common failure reasons:
- Missing required options
- Invalid option values
- Conflicting with existing files
- Missing dependencies
- Generator doesn't support certain flag combinations
## Post-Generation
### 1. Modify Generated Code (If Needed)
Generators provide a starting point, but the output may need adjustment to match the user's specific requirements:
- Add or modify functionality as requested
- Adjust imports, exports, or configurations
- Integrate with existing code patterns in the repo
### 2. Format Code
Run formatting on all generated/modified files:
```bash
nx format --fix
```
Languages other than javascript/typescript might need other formatting invocations too.
### 3. Run Verification
Verify that the generated code works correctly. What this looks like will vary depending on the type of generator and the targets available.
If the generator created a new project, run its targets directly
Use your best judgement to determine what needs to be verified.
Example:
```bash
nx lint <new-project>
nx test <new-project>
nx build <new-project>
```
### 4. Handle Verification Failures
When verification fails:
**If scope is manageable** (a few lint errors, minor type issues):
- Fix the issues
- Re-run verification to confirm
**If issues are extensive** (many errors, complex problems):
- Attempt simple, obvious fixes first
- If still failing, escalate to the user with:
- Description of what was generated
- What verification is failing
- What you've attempted to fix
- Remaining issues that need user input
## Error Handling
### Generator Failures
- Check the error message for specific causes
- Verify all required options are provided
- Check for conflicts with existing files
- Ensure the generator name and options are correct
### Missing Options
- Consult the generator schema for required fields
- Infer values from context when reasonable
- Ask the user for values that cannot be inferred
## Key Principles
1. **Local generators first** - Always prefer workspace/local generators over external plugin generators when both could work
2. **Understand before running** - Read both the schema AND the source code to fully understand what will happen
3. **No prompts** - Always use `--no-interactive` to prevent hanging
4. **Generators are starting points** - Modify the output as needed to fully satisfy the user's requirements
5. **Verify changes work** - Don't just generate; ensure the code builds, lints, and tests pass
6. **Be proactive about fixes** - Don't just report errors; attempt to resolve them automatically when possible
7. **Match repo patterns** - Study existing similar code in the repo and match its conventions
+9
View File
@@ -0,0 +1,9 @@
---
name: nx-plugins
description: Find and add Nx plugins. USE WHEN user wants to discover available plugins, install a new plugin, or add support for a specific framework or technology to the workspace.
---
## Finding and Installing new plugins
- List plugins: `pnpm nx list`
- Install plugins `pnpm nx add <plugin>`. Example: `pnpm nx add @nx/react`.
+58
View File
@@ -0,0 +1,58 @@
---
name: nx-run-tasks
description: Helps with running tasks in an Nx workspace. USE WHEN the user wants to execute build, test, lint, serve, or run any other tasks defined in the workspace.
---
You can run tasks with Nx in the following way.
Keep in mind that you might have to prefix things with npx/pnpx/yarn if the user doesn't have nx installed globally. Look at the package.json or lockfile to determine which package manager is in use.
For more details on any command, run it with `--help` (e.g. `nx run-many --help`, `nx affected --help`).
## Understand which tasks can be run
You can check those via `nx show project <projectname> --json`, for example `nx show project myapp --json`. It contains a `targets` section which has information about targets that can be run. You can also just look at the `package.json` scripts or `project.json` targets, but you might miss out on inferred tasks by Nx plugins.
## Run a single task
```
nx run <project>:<task>
```
where `project` is the project name defined in `package.json` or `project.json` (if present).
## Run multiple tasks
```
nx run-many -t build test lint typecheck
```
You can pass a `-p` flag to filter to specific projects, otherwise it runs on all projects. You can also use `--exclude` to exclude projects, and `--parallel` to control the number of parallel processes (default is 3).
Examples:
- `nx run-many -t test -p proj1 proj2` — test specific projects
- `nx run-many -t test --projects=*-app --exclude=excluded-app` — test projects matching a pattern
- `nx run-many -t test --projects=tag:api-*` — test projects by tag
## Run tasks for affected projects
Use `nx affected` to only run tasks on projects that have been changed and projects that depend on changed projects. This is especially useful in CI and for large workspaces.
```
nx affected -t build test lint
```
By default it compares against the base branch. You can customize this:
- `nx affected -t test --base=main --head=HEAD` — compare against a specific base and head
- `nx affected -t test --files=libs/mylib/src/index.ts` — specify changed files directly
## Useful flags
These flags work with `run`, `run-many`, and `affected`:
- `--skipNxCache` — rerun tasks even when results are cached
- `--verbose` — print additional information such as stack traces
- `--nxBail` — stop execution after the first failed task
- `--configuration=<name>` — use a specific configuration (e.g. `production`)
+186
View File
@@ -0,0 +1,186 @@
---
name: nx-workspace
description: "Explore and understand Nx workspaces. USE WHEN answering any questions about the nx workspace, the projects in it or tasks to run. EXAMPLES: 'What projects are in this workspace?', 'How is project X configured?', 'What targets can I run?', 'What's affected by my changes?', 'Which projects depend on library Y?', or any questions about Nx workspace structure, project configuration, or available tasks."
---
# Nx Workspace Exploration
This skill provides read-only exploration of Nx workspaces. Use it to understand workspace structure, project configuration, available targets, and dependencies.
Keep in mind that you might have to prefix commands with `npx`/`pnpx`/`yarn` if nx isn't installed globally. Check the lockfile to determine the package manager in use.
## Listing Projects
Use `nx show projects` to list projects in the workspace.
```bash
# List all projects
nx show projects
# Filter by pattern (glob)
nx show projects --projects "apps/*"
nx show projects --projects "shared-*"
# Filter by project type
nx show projects --type app
nx show projects --type lib
nx show projects --type e2e
# Filter by target (projects that have a specific target)
nx show projects --withTarget build
nx show projects --withTarget e2e
# Find affected projects (changed since base branch)
nx show projects --affected
nx show projects --affected --base=main
nx show projects --affected --type app
# Combine filters
nx show projects --type lib --withTarget test
nx show projects --affected --exclude="*-e2e"
# Output as JSON
nx show projects --json
```
## Project Configuration
Use `nx show project <name> --json` to get the full resolved configuration for a project.
**Important**: Do NOT read `project.json` directly - it only contains partial configuration. The `nx show project` command returns the full resolved config including inferred targets from plugins.
You can read the full project schema at `node_modules/nx/schemas/project-schema.json` to understand nx project configuration options.
```bash
# Get full project configuration
nx show project my-app --json
# Extract specific parts from the JSON
nx show project my-app --json | jq '.targets'
nx show project my-app --json | jq '.targets.build'
nx show project my-app --json | jq '.targets | keys'
# Check project metadata
nx show project my-app --json | jq '{name, root, sourceRoot, projectType, tags}'
```
## Target Information
Targets define what tasks can be run on a project.
```bash
# List all targets for a project
nx show project my-app --json | jq '.targets | keys'
# Get full target configuration
nx show project my-app --json | jq '.targets.build'
# Check target executor/command
nx show project my-app --json | jq '.targets.build.executor'
nx show project my-app --json | jq '.targets.build.command'
# View target options
nx show project my-app --json | jq '.targets.build.options'
# Check target inputs/outputs (for caching)
nx show project my-app --json | jq '.targets.build.inputs'
nx show project my-app --json | jq '.targets.build.outputs'
# Find projects with a specific target
nx show projects --withTarget serve
nx show projects --withTarget e2e
```
## Workspace Configuration
Read `nx.json` directly for workspace-level configuration.
You can read the full project schema at `node_modules/nx/schemas/nx-schema.json` to understand nx project configuration options.
```bash
# Read the full nx.json
cat nx.json
# Or use jq for specific sections
cat nx.json | jq '.targetDefaults'
cat nx.json | jq '.namedInputs'
cat nx.json | jq '.plugins'
cat nx.json | jq '.generators'
```
Key nx.json sections:
- `targetDefaults` - Default configuration applied to all targets of a given name
- `namedInputs` - Reusable input definitions for caching
- `plugins` - Nx plugins and their configuration
- ...and much more, read the schema or nx.json for details
## Affected Projects
Find projects affected by changes in the current branch.
```bash
# Affected since base branch (auto-detected)
nx show projects --affected
# Affected with explicit base
nx show projects --affected --base=main
nx show projects --affected --base=origin/main
# Affected between two commits
nx show projects --affected --base=abc123 --head=def456
# Affected apps only
nx show projects --affected --type app
# Affected excluding e2e projects
nx show projects --affected --exclude="*-e2e"
# Affected by uncommitted changes
nx show projects --affected --uncommitted
# Affected by untracked files
nx show projects --affected --untracked
```
## Common Exploration Patterns
### "What's in this workspace?"
```bash
nx show projects
nx show projects --type app
nx show projects --type lib
```
### "How do I build/test/lint project X?"
```bash
nx show project X --json | jq '.targets | keys'
nx show project X --json | jq '.targets.build'
```
### "What depends on library Y?"
```bash
# Find projects that may depend on Y by searching for imports
# (Nx doesn't have a direct "dependents" command via CLI)
grep -r "from '@myorg/Y'" --include="*.ts" --include="*.tsx" apps/ libs/
```
### "What configuration options are available?"
```bash
cat node_modules/nx/schemas/nx-schema.json | jq '.properties | keys'
cat node_modules/nx/schemas/project-schema.json | jq '.properties | keys'
```
### "Why is project X affected?"
```bash
# Check what files changed
git diff --name-only main
# See which project owns those files
nx show project X --json | jq '.root'
```
+1
View File
@@ -1,6 +1,7 @@
{
"singleQuote": true,
"endOfLine": "lf",
"trailingComma": "es5",
"plugins": ["prettier-plugin-tailwindcss"],
"overrides": [
{
+22 -13
View File
@@ -9,6 +9,25 @@ When responding to queries about this repository:
Always strive to provide accurate, helpful responses that align with the best practices and workflows described in this
file.
## Documentation Contributions
When working on Nx documentation, all documentation content lives in the `astro-docs/` folder. This is the new Astro-based documentation site built with Starlight.
**Important**: Before making any documentation changes, read the `astro-docs/README.md` file for detailed guidance on:
- Project structure and architecture
- Content types (regular docs, dynamic plugin docs, CLI docs)
- Available Markdoc tags for rich content
- Development workflow and commands
- Sidebar management
### Quick Reference
- Documentation content: `astro-docs/src/content/docs/`
- Use `.mdoc` (Markdoc) or `.mdx` format for documentation files
- Run `nx serve astro-docs` to start the local dev server
- Sidebar structure is defined in `astro-docs/sidebar.mts`
## GitHub Issue Response Mode
When responding to GitHub issues, determine your approach based on how the request is phrased:
@@ -187,18 +206,8 @@ Fixes #ISSUE_NUMBER
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
# CI Error Guidelines
If the user wants help with fixing an error in their CI pipeline, use the following flow:
- Retrieve the list of current CI Pipeline Executions (CIPEs) using the `nx_cloud_cipe_details` tool
- If there are any errors, use the `nx_cloud_fix_cipe_failure` tool to retrieve the logs for a specific task
- Use the task logs to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
- Make sure that the problem is fixed by running the task that you passed into the `nx_cloud_fix_cipe_failure` tool
- For understanding the workspace structure, projects, or available tasks, use the `/nx-workspace` skill which provides guidance on exploring Nx workspaces
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` MCP tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- For Nx plugin best practices, check `node_modules/@nx/<plugin>/PLUGIN.md`. Not all plugins have this file - proceed without it if unavailable.
<!-- nx configuration end-->
+22 -13
View File
@@ -9,6 +9,25 @@ When responding to queries about this repository:
Always strive to provide accurate, helpful responses that align with the best practices and workflows described in this
file.
## Documentation Contributions
When working on Nx documentation, all documentation content lives in the `astro-docs/` folder. This is the new Astro-based documentation site built with Starlight.
**Important**: Before making any documentation changes, read the `astro-docs/README.md` file for detailed guidance on:
- Project structure and architecture
- Content types (regular docs, dynamic plugin docs, CLI docs)
- Available Markdoc tags for rich content
- Development workflow and commands
- Sidebar management
### Quick Reference
- Documentation content: `astro-docs/src/content/docs/`
- Use `.mdoc` (Markdoc) or `.mdx` format for documentation files
- Run `nx serve astro-docs` to start the local dev server
- Sidebar structure is defined in `astro-docs/sidebar.mts`
## GitHub Issue Response Mode
When responding to GitHub issues, determine your approach based on how the request is phrased:
@@ -187,18 +206,8 @@ Fixes #ISSUE_NUMBER
- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly
- You have access to the Nx MCP server and its tools, use them to help the user
- When answering questions about the repository, use the `nx_workspace` tool first to gain an understanding of the workspace architecture where applicable.
- When working in individual projects, use the `nx_project_details` mcp tool to analyze and understand the specific project structure and dependencies
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- If the user needs help with an Nx configuration or project graph error, use the `nx_workspace` tool to get any errors
# CI Error Guidelines
If the user wants help with fixing an error in their CI pipeline, use the following flow:
- Retrieve the list of current CI Pipeline Executions (CIPEs) using the `nx_cloud_cipe_details` tool
- If there are any errors, use the `nx_cloud_fix_cipe_failure` tool to retrieve the logs for a specific task
- Use the task logs to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary
- Make sure that the problem is fixed by running the task that you passed into the `nx_cloud_fix_cipe_failure` tool
- For understanding the workspace structure, projects, or available tasks, use the `/nx-workspace` skill which provides guidance on exploring Nx workspaces
- For questions around nx configuration, best practices or if you're unsure, use the `nx_docs` MCP tool to get relevant, up-to-date docs. Always use this instead of assuming things about nx configuration
- For Nx plugin best practices, check `node_modules/@nx/<plugin>/PLUGIN.md`. Not all plugins have this file - proceed without it if unavailable.
<!-- nx configuration end-->
+21 -8
View File
@@ -14,7 +14,6 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
/graph/** @philipjfulcher @FrozenPandaz @bcabanes @MaxKless @Coly010 @jaysoo @nartc
/images @nrwl/nx-docs-reviewers
/nx-dev/** @nrwl/nx-docs-reviewers
/typedoc-theme @nrwl/nx-docs-reviewers
# Plugin Verticals
@@ -77,6 +76,7 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
/e2e/rollup/** @nrwl/nx-js-reviewers
/packages/vite/** @nrwl/nx-js-reviewers
/e2e/vite/** @nrwl/nx-js-reviewers
/packages/vitest/** @nrwl/nx-js-reviewers
## Module Federation
/packages/module-federation/** @nrwl/nx-js-reviewers
@@ -100,7 +100,7 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
/e2e/storybook/** @nrwl/nx-storybook-reviewers
# Docker
/packages/docker/** @nrwl/nx-core-reviewers @Coly010
/packages/docker/** @nrwl/nx-core-reviewers @Coly010 @jaysoo
## Devkit
/packages/devkit/** @nrwl/nx-devkit-reviewers
@@ -110,14 +110,18 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
# Gradle
/packages/gradle/** @FrozenPandaz @MaxKless @lourw
/e2e/gradle/** @FrozenPandaz @MaxKless @lourw
/build.gradle.kts @FrozenPandaz @MaxKless @lourw
/settings.gradle.kts @FrozenPandaz @MaxKless @lourw
# Maven
/packages/maven/** @FrozenPandaz @MaxKless @lourw
/e2e/maven/** @FrozenPandaz @MaxKless @lourw
/pom.xml @FrozenPandaz @MaxKless @lourw
# Nx-Plugin
/packages/plugin/** @nrwl/nx-devkit-reviewers
/e2e/plugin/** @nrwl/nx-devkit-reviewers
/packages/create-nx-plugin/** @nrwl/nx-devkit-reviewers
## Core
/packages/nx/** @nrwl/nx-core-reviewers
@@ -132,12 +136,18 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
/e2e/nx*/** @nrwl/nx-core-reviewers
/packages/workspace/** @nrwl/nx-core-reviewers
/e2e/workspace-create/** @nrwl/nx-core-reviewers
/e2e/release/** @nrwl/nx-core-reviewers
/packages/create-nx-workspace/** @nrwl/nx-core-reviewers
/packages/nx/src/command-line/release/** @nrwl/nx-core-reviewers @Coly010
/packages/nx/src/plugins/js/** @nrwl/nx-core-reviewers @nrwl/nx-js-reviewers
/e2e/release/** @nrwl/nx-core-reviewers @Coly010
# .NET
/packages/dotnet/** @FrozenPandaz @AgentEnder
/e2e/dotnet/** @FrozenPandaz @AgentEnder
# Misc
/e2e/lerna-smoke-tests/** @vsavkin @JamesHenry
/e2e/utils/** @meeroslav @nrwl/nx-testing-tools-reviewers @vsavkin
/community @nrwl/nx-docs-reviewers
/CONTRIBUTING.md @FrozenPandaz
/CODE_OF_CONDUCT.md @FrozenPandaz
/CODEOWNERS @FrozenPandaz @AgentEnder
@@ -149,14 +159,17 @@ rust-toolchain.toml @nrwl/nx-native-reviewers
# CI
/.nx/workflows/** @nrwl/nx-pipelines-reviewers
mise.toml @nrwl/nx-pipelines-reviewers @FrozenPandaz
/.github/** @nrwl/nx-pipelines-reviewers
/.husky/** @nrwl/nx-pipelines-reviewers
/packages/workspace/src/generators/ci-workflow/** @nrwl/nx-pipelines-reviewers
# Claude AI Integration
CLAUDE.md @FrozenPandaz
.claude/** @FrozenPandaz
.mcp.json @FrozenPandaz
# AI Agent Integration
CLAUDE.md @FrozenPandaz @Coly010
.claude/** @FrozenPandaz @Coly010
.mcp.json @FrozenPandaz @Coly010
AGENTS.md @FrozenPandaz @Coly010
.gemini @FrozenPandaz @Coly010
# Global Files
project.json @FrozenPandaz @vsavkin
+2 -11
View File
@@ -2,19 +2,10 @@
We would love for you to contribute to Nx! Read this document to see how to do it.
## How to Get Started Video
Watch this 5-minute video:
<a href="https://www.youtube.com/watch?v=8LCA_4qxc08" target="_blank" rel="noreferrer">
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/how-to-contribute.png" width="600" alt="Nx - How to contribute"></p>
</a>
## Got a Question?
We are trying to keep GitHub issues for bug reports and feature requests. Using the `nrwl` tag
on [Stack Overflow](https://stackoverflow.com/questions/tagged/nrwl) is a much better place to ask general questions
about how to use Nx.
We are trying to keep GitHub issues for bug reports and feature requests.
You can join our [Discord](https://go.nx.dev/community) for general questions and seeking help from others.
## Found an Issue?
Generated
+1606 -1387
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
(The MIT License)
Copyright (c) 2017-2025 Narwhal Technologies Inc.
Copyright (c) 2017-2026 Narwhal Technologies Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
+5 -7
View File
@@ -1,7 +1,7 @@
<p style="text-align: center;">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
<img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
<source media="(prefers-color-scheme: dark)" srcset="./images/nx-dark.svg">
<img alt="Nx - Smart Monorepos · Fast Builds" src="./images/nx-light.svg" width="100%">
</picture>
</p>
@@ -19,9 +19,7 @@
<hr>
# Smart Repos · Fast Builds
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
# The Monorepo Platform that amplifies both developers and AI agents. Nx optimizes your builds, scales your CI, and fixes failed PRs automatically. Ship in half the time.
Create a new Nx workspace with
@@ -58,7 +56,7 @@ Learn more in the [Nx CI docs &raquo;](https://nx.dev/ci/getting-started/intro?u
- [Our Twitter/X](https://x.com/nxdevtools)
<p style="text-align: center;"><a href="https://www.youtube.com/@nxdevtools/videos" target="_blank" rel="noreferrer"><img src="./images/nx-courses-and-videos.svg"
width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
width="100%" alt="Nx - Smart Monorepos · Fast Builds"></a></p>
## Want to help?
@@ -67,7 +65,7 @@ our [guidelines for contributing](https://github.com/nrwl/nx/blob/master/CONTRIB
help you get started.
<a href="https://www.youtube.com/watch?v=8LCA_4qxc08" target="_blank" rel="noreferrer">
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/how-to-contribute.png" width="600" alt="Nx - How to contribute video"></p>
<p style="text-align: center;"><img src="./images/how-to-contribute.png" width="600" alt="Nx - How to contribute video"></p>
</a>
## Core Team
+12
View File
@@ -13,3 +13,15 @@ Instead, please report them to the Security Team at security@nrwl.io.
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
Nx follows the principle of Coordinated Vulnerability Disclosure.
## What Should Be Reported
The security email is for **demonstrable, verified vulnerabilities within the Nx codebase itself**.
**Please do not use the security email for:**
- Reports about outdated dependencies (e.g., "package X has a newer version available")
- Reports about dependencies with known CVEs that do not directly affect Nx functionality
- General vulnerability scanner output
If you have a concern about an outdated dependency that you believe impacts Nx users, please open a [GitHub issue](https://github.com/nrwl/nx/issues/new/choose) instead.
+93 -4
View File
@@ -22,6 +22,48 @@ This documentation site leverages Astro's static site generation capabilities wi
- Dynamic API documentation generation from Nx packages and CLI commands
- Community plugin registry
## Information Architecture Principles
When creating or reorganizing documentation, follow these 5 principles to determine where content belongs.
### 1. Progressive Disclosure (The "Journey" Rule)
- **Concept:** Don't overwhelm the user. Reveal complexity only as they advance in their journey.
- **The Test:** _Is this for the First 30 Minutes (Getting Started), the First 30 Days (Features), or Forever (Reference)?_
### 2. Category Homogeneity (The "Scan" Rule)
- **Concept:** Items in a list must be of the same "type" (noun, verb, or concept) to reduce cognitive load.
- **The Test:** _Does this list mix Concepts (Mental Model), Tasks (Update Nx), and Products (React)? If yes, split it._
### 3. Type-Based Navigation (The "Intent" Rule)
- **Concept:** Separate **Learning** (Narrative/Guides) from **Looking Up** (Reference/API).
- **The Test:** _Is the user here to learn a workflow (Guide) or look up a flag syntax (Reference)?_
### 4. The Pen & Paper Test (The "Theory" Rule)
- **Concept:** Distinguish Architecture from Features to keep "Core Concepts" pure.
- **The Test:** _Can I explain this using only a pen and paper?_
- **Yes:** It goes in **How Nx Works** (Architecture).
- **No (I need a terminal):** It goes in **Platform Features** (Feature).
### 5. Universal vs. Specific (The "Placement" Rule)
- **Concept:** Distinguish Platform features from Ecosystem tools to prevent "Features" from becoming a junk drawer.
- **The Test:** _Does this feature apply to EVERY user (e.g., Caching, Agents)?_
- **Yes:** **Platform Features**.
- **No (Only React users):** **Technologies**.
### Sidebar Structure
The sidebar has 4 top-level sections that follow the user journey:
1. **Getting Started** - Essential setup, tutorials, and core concepts (How Nx Works, Platform Features)
2. **Technologies** - Framework and tool-specific guides (React, Angular, Node, build tools, test tools)
3. **Knowledge Base** - Recipes, troubleshooting, and topic-specific guides
4. **Reference** - Exhaustive facts, no narrative (CLI commands, configuration, API docs)
## Project Structure
```
@@ -36,9 +78,9 @@ astro-docs/
│ │ ├── markdoc/ # Markdoc tag components
│ │ └── utils/ # Utility functions
│ ├── content/ # Documentation content
│ │ ├── banner.json # Banner collection (generated by prebuild-banner)
│ │ ├── docs/ # Main documentation files (.mdoc, .mdx)
│ │ ── approved-community-plugins.json # Powers plugin registry
│ │ └── notifications.json # Notifications banners for docs site
│ │ ── approved-community-plugins.json # Powers plugin registry
│ ├── pages/ # Dynamic pages and routes (e.g. devkit)
│ ├── plugins/ # Content loaders and plugins
│ │ ├── *.loader.ts # Dynamic content loaders (e.g. CLI commands and API docs generation)
@@ -66,13 +108,11 @@ The site uses custom content loaders to dynamically generate documentation:
### Content Types
1. **Regular Documentation** (`src/content/docs/`)
- Written in `.mdoc` (Markdoc) or `.mdx` (MDX) format
- Organized by sections: getting-started, concepts, guides, api
- File-based routing (filename = URL path)
2. **Dynamic Plugin Documentation**
- Auto-generated from Nx packages
- Includes generators, executors, and migrations
- Updated during build process
@@ -233,3 +273,52 @@ export const sidebar = [
- Navigation structure
- Section organization
- Dynamic content injection points
## Banner Configuration
The floating banner promotes events/webinars. It's fetched at **build time** from a Framer CMS page and stored as an Astro content collection.
### Setup
Set `BANNER_URL` to point to a Framer page that renders banner JSON:
```
BANNER_URL=https://your-framer-site.framer.app/api/banners/main
```
The Framer page should render JSON inside a `<pre>` tag:
```json
{
"title": "Event Title",
"description": "Event description",
"primaryCtaUrl": "https://...",
"primaryCtaText": "Learn More",
"secondaryCtaUrl": "",
"secondaryCtaText": "",
"enabled": true,
"activeUntil": "2025-12-31T00:00:00.000Z"
}
```
### Schema
| Field | Type | Required | Description |
| ------------------ | -------- | -------- | ------------------------- |
| `title` | string | Yes | Banner headline |
| `description` | string | Yes | Banner body text |
| `primaryCtaUrl` | string | Yes | Primary button URL |
| `primaryCtaText` | string | Yes | Primary button text |
| `secondaryCtaUrl` | string | No | Secondary button URL |
| `secondaryCtaText` | string | No | Secondary button text |
| `enabled` | boolean | Yes | Show/hide the banner |
| `activeUntil` | ISO 8601 | No | Auto-hide after this date |
### Behavior
- Banner is fetched during `prebuild-banner` target and saved to `src/content/banner.json` as a collection (array)
- Uses Astro content collection with `file()` loader and schema validation
- Requires rebuild/redeploy to update the banner
- Users can dismiss the banner (stored in localStorage)
- If `enabled` is `false` or `activeUntil` has passed, the banner won't show
- If `BANNER_URL` is not set, an empty collection is generated
+14 -26
View File
@@ -6,14 +6,17 @@ import react from '@astrojs/react';
import markdoc from '@astrojs/markdoc';
import tailwindcss from '@tailwindcss/vite';
import { sidebar } from './sidebar.mts';
import rehypeTableOptionLinks from './src/plugins/utils/rehype-table-option-links.ts';
import { resolveNxDevUrl } from './src/utils/resolve-nx-dev-url.ts';
// Always resolve NX_DEV_URL so downstream consumers (Footer, Header) pick it up.
// For deploy previews this overrides any site-level env var to point to the matching preview.
process.env.NX_DEV_URL = resolveNxDevUrl();
const BASE = '/docs';
// This is exposed as window.__CONFIG
const PUBLIC_CONFIG = {
cookiebotDisabled: process.env.COOKIEBOT_DISABLED === 'true',
cookiebotId: process.env.COOKIEBOT_ID ?? null,
gaMeasurementId: 'UA-88380372-10',
gtmMeasurementId: 'GTM-KW8423B6',
isProd: process.env.NODE_ENV === 'production',
};
@@ -22,7 +25,7 @@ const PUBLIC_CONFIG = {
export default defineConfig({
base: BASE,
vite: { plugins: [tailwindcss()] },
// Allow this to be configured per environment
// Allow this to be configured per environment for robots.txt detection
// Note: this happens during build time so we don't use `import.meta.env`
site: process.env.NX_DEV_URL ?? 'https://nx.dev',
image: {
@@ -33,6 +36,9 @@ export default defineConfig({
},
},
},
markdown: {
rehypePlugins: [rehypeTableOptionLinks],
},
trailingSlash: 'never',
// This adapter doesn't support local previews, so only load it on Netlify.
adapter: process.env['NETLIFY'] ? netlify() : undefined,
@@ -56,22 +62,6 @@ export default defineConfig({
tag: 'script',
content: `window.__CONFIG = ${JSON.stringify(PUBLIC_CONFIG)};`,
},
...(process.env.COOKIEBOT_ID &&
process.env.COOKIEBOT_DISABLED !== 'true'
? [
{
/** @type {"script"} */
tag: 'script',
attrs: {
id: 'Cookiebot',
src: 'https://consent.cookiebot.com/uc.js',
'data-cbid': process.env.COOKIEBOT_ID,
'data-blockingmode': 'auto',
type: 'text/javascript',
},
},
]
: []),
{
tag: 'script',
attrs: {
@@ -82,20 +72,18 @@ export default defineConfig({
],
plugins: [],
routeMiddleware: [
'./src/plugins/banner.middleware.ts',
// NOTE: this is responsibile for populating the Reference section
// with generated routes from the nx-reference-packages content collection
// since the sidebar doesn't auto generate w/ dynamic routes from src/pages/reference
// only the src/content/docs/reference files
'./src/plugins/sidebar-reference-updater.middleware.ts',
'./src/plugins/sidebar-icons.middleware.ts',
'./src/plugins/og.middleware.ts',
'./src/plugins/github-stars.middleware.ts',
'./src/plugins/raw-content.middleware.ts',
'./src/plugins/canonical.middleware.ts',
],
markdown: {
// this breaks the renderMarkdown function in the plugin loader due to starlight path normalization
// as to _why_ it has to normalize a path?
// idk just working around the issue for now but we'll want to have linked headers so will need to fix
headingLinks: false,
headingLinks: true,
},
social: [
{ icon: 'github', label: 'GitHub', href: 'https://github.com/nrwl/nx' },
+1 -1
View File
@@ -11,7 +11,7 @@ test('links in descriptions of properties should correctly link to the same page
await page
.getByTestId('main-pane')
.getByRole('link', { name: 'nxCloudAccessToken' })
.getByRole('link', { name: 'nxCloudAccessToken', exact: true })
.click();
await expect(
+15
View File
@@ -4,9 +4,15 @@ import {
Markdoc,
} from '@astrojs/markdoc/config';
import starlightMarkdoc from '@astrojs/starlight-markdoc';
import { transformOptionsTable } from './src/utils/markdoc-table-option-links';
export default defineMarkdocConfig({
extends: [starlightMarkdoc()],
nodes: {
table: {
transform: transformOptionsTable,
},
},
tags: {
call_to_action: {
render: component('./src/components/markdoc/CallToAction.astro'),
@@ -238,6 +244,15 @@ export default defineMarkdocConfig({
},
},
},
sidebar_group_cards: {
render: component('./src/components/markdoc/SidebarGroupCards.astro'),
attributes: {
group: {
type: 'String',
required: true,
},
},
},
metrics: {
render: component('./src/components/markdoc/Metrics.astro'),
attributes: {
+15
View File
@@ -1,4 +1,19 @@
# Disable gradle and maven plugins on Netlify
# (Netlify only supports Java 8 but these plugins require Java 17)
[build.environment]
NX_GRADLE_DISABLE = "true"
NX_MAVEN_DISABLE = "true"
# Edge functions are auto-discovered from netlify/edge-functions/
# Path configuration is in each function's inline `config` export
# Permanent redirects (301 by default)
# Storybook docs consolidation
[[redirects]]
from = "/docs/technologies/test-tools/storybook/guides/storybook-9-setup"
to = "/docs/technologies/test-tools/storybook/guides/upgrading-storybook"
[[redirects]]
from = "/"
to = "/docs/getting-started/intro"
@@ -0,0 +1,59 @@
import type { Context } from 'https://edge.netlify.com';
/**
* Content negotiation for LLM-friendly docs access.
* See: https://llmstxt.org/
*/
export default async function handler(
request: Request,
context: Context
): Promise<Response | URL> {
const url = new URL(request.url);
const pathname = url.pathname;
const acceptHeader = request.headers.get('accept') || '';
// Serve markdown for LLM tools that explicitly request it
// Or if there are no accept headers passed (e.g. Cursor)
if (!acceptHeader || acceptHeader.includes('text/markdown')) {
const mdPath = pathname.replace(/\/?$/, '.md');
return new URL(mdPath, request.url);
}
const response = await context.next();
const contentType = response.headers.get('content-type') || '';
if (!contentType.includes('text/html')) {
return response;
}
const mdPath = pathname.replace(/\/?$/, '.md');
const linkHeader = [
`<${mdPath}>; rel="alternate"; type="text/markdown"`,
`</docs/llms.txt>; rel="alternate"; type="text/markdown"; title="LLM Index"`,
`</docs/llms-full.txt>; rel="alternate"; type="text/markdown"; title="Full Documentation"`,
].join(', ');
// Netlify responses are immutable
const newHeaders = new Headers(response.headers);
newHeaders.set('Link', linkHeader);
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
export const config = {
path: ['/docs/*'],
excludedPath: [
'/docs/*.md',
'/docs/*.js',
'/docs/*.txt',
'/docs/images/*',
// _astro and other asset paths
'/docs/_*',
],
};
@@ -0,0 +1,118 @@
import type { Context } from 'https://edge.netlify.com';
// Configuration - set these in Netlify environment variables
const GA_MEASUREMENT_ID =
Netlify.env.get('GA_MEASUREMENT_ID') || 'G-XXXXXXXXXX';
const GA_API_SECRET = Netlify.env.get('GA_API_SECRET') || '';
function getClientId(request: Request): string {
// Try to extract existing GA client ID from cookie
const cookies = request.headers.get('cookie') || '';
const gaMatch = cookies.match(/_ga=GA\d+\.\d+\.(\d+\.\d+)/);
if (gaMatch) {
return gaMatch[1];
}
// Generate a new client ID for this request
// For non-browser clients (AI tools), this creates a session-based ID
const timestamp = Date.now();
const random = Math.floor(Math.random() * 1000000000);
return `${random}.${timestamp}`;
}
async function sendToGA4(
request: Request,
context: Context,
pathname: string
): Promise<void> {
if (!GA_API_SECRET) {
console.warn('GA_API_SECRET not configured, skipping analytics');
return;
}
const clientId = getClientId(request);
const userAgent = request.headers.get('user-agent') || 'unknown';
// Anthropic: ClaudeBot (training), Claude-User (user fetch), Claude-SearchBot (search index),
// Claude-Web (web crawler), anthropic-ai (legacy training)
// OpenAI: GPTBot (training), ChatGPT-User (user browsing), OAI-SearchBot (search index)
// Perplexity: PerplexityBot (search index), Perplexity-User (user fetch)
// Google: Google-Extended (AI/Gemini training)
// Other: Bytespider (ByteDance training)
const isAITool =
/ClaudeBot|Claude-User|Claude-SearchBot|Claude-Web|anthropic-ai|GPTBot|ChatGPT-User|OAI-SearchBot|PerplexityBot|Perplexity-User|Google-Extended|Bytespider/i.test(
userAgent
);
// Generic bots (SEO crawlers, social previews, etc.)
const isGenericBot =
/Googlebot|Amazonbot|CCBot|BingBot|YandexBot|DuckDuckBot|Applebot|crawler|spider|slurp|facebook|twitter|linkedin|slack|discord|telegram/i.test(
userAgent
);
const payload = {
client_id: clientId,
events: [
{
name: 'server_page_view',
params: {
page_location: request.url,
page_title: pathname,
page_path: pathname,
// Custom parameters for filtering
content_type: pathname.endsWith('.txt')
? 'text/plain'
: 'text/markdown',
file_extension: pathname.substring(pathname.lastIndexOf('.')),
user_agent: userAgent,
is_ai_tool: isAITool ? 'true' : 'false',
is_bot: isGenericBot ? 'true' : 'false',
country: context.geo?.country?.code || 'unknown',
},
},
],
};
console.log(`Tracked asset path: ${pathname}`);
const endpoint = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
try {
await fetch(endpoint, {
method: 'POST',
body: JSON.stringify(payload),
});
} catch (error) {
// Log but don't fail the request
console.error('Failed to send to GA4:', error);
}
}
export default async function handler(
request: Request,
context: Context
): Promise<Response> {
const url = new URL(request.url);
const pathname = url.pathname;
// Send analytics in background (non-blocking)
context.waitUntil(sendToGA4(request, context, pathname));
// Continue to serve the actual file
const response = await context.next();
// Netlify Edge Function responses are immutable, so create a new Response
const newHeaders = new Headers(response.headers);
newHeaders.set('x-nx-edge-function', 'track-asset-requests');
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
export const config = {
path: ['/**/*.txt', '/**/*.md'],
// Something is adding .png.md and .svg.md to get image paths, exclude those.
excludedPath: ['/docs/og/*', '/docs/*.svg.md', '/docs/*.png.md'],
};
@@ -0,0 +1,128 @@
import type { Context } from 'https://edge.netlify.com';
const GA_MEASUREMENT_ID =
Netlify.env.get('GA_MEASUREMENT_ID') || 'G-XXXXXXXXXX';
const GA_API_SECRET = Netlify.env.get('GA_API_SECRET') || '';
function getClientId(request: Request): string {
const cookies = request.headers.get('cookie') || '';
const gaMatch = cookies.match(/_ga=GA\d+\.\d+\.(\d+\.\d+)/);
if (gaMatch) return gaMatch[1];
const timestamp = Date.now();
const random = Math.floor(Math.random() * 1000000000);
return `${random}.${timestamp}`;
}
async function sendToGA4(
request: Request,
context: Context,
pathname: string
): Promise<void> {
if (!GA_API_SECRET) {
console.warn('GA_API_SECRET not configured, skipping analytics');
return;
}
const clientId = getClientId(request);
const userAgent = request.headers.get('user-agent') || 'unknown';
// Anthropic: ClaudeBot (training), Claude-User (user fetch), Claude-SearchBot (search index),
// Claude-Web (web crawler), anthropic-ai (legacy training)
// OpenAI: GPTBot (training), ChatGPT-User (user browsing), OAI-SearchBot (search index)
// Perplexity: PerplexityBot (search index), Perplexity-User (user fetch)
// Google: Google-Extended (AI/Gemini training)
// Other: Bytespider (ByteDance training)
const isAITool =
/ClaudeBot|Claude-User|Claude-SearchBot|Claude-Web|anthropic-ai|GPTBot|ChatGPT-User|OAI-SearchBot|PerplexityBot|Perplexity-User|Google-Extended|Bytespider/i.test(
userAgent
);
// Generic bots (SEO crawlers, social previews, etc.)
const isGenericBot =
/Googlebot|Amazonbot|CCBot|BingBot|YandexBot|DuckDuckBot|Applebot|crawler|spider|slurp|facebook|twitter|linkedin|slack|discord|telegram/i.test(
userAgent
);
const payload = {
client_id: clientId,
events: [
{
name: 'server_page_view',
params: {
page_location: request.url,
page_title: pathname,
page_path: pathname,
content_type: 'text/html',
file_extension: '.html',
user_agent: userAgent,
is_ai_tool: isAITool ? 'true' : 'false',
is_bot: isGenericBot ? 'true' : 'false',
country: context.geo?.country?.code || 'unknown',
},
},
],
};
console.log(`Tracked HTML page: ${pathname}`);
const endpoint = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
try {
await fetch(endpoint, {
method: 'POST',
body: JSON.stringify(payload),
});
} catch (error) {
console.error('Failed to send to GA4:', error);
}
}
export default async function handler(
request: Request,
context: Context
): Promise<Response> {
const pathname = new URL(request.url).pathname;
// Always track - filtering is done at config level via `accept: ['text/html']`
context.waitUntil(sendToGA4(request, context, pathname));
const response = await context.next();
const newHeaders = new Headers(response.headers);
newHeaders.set('x-nx-edge-function', 'track-page-requests');
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
export const config = {
path: ['/docs/*'],
// Only track requests from clients that want HTML (browsers)
// This filters out curl, AI agents, and other non-browser clients
accept: ['text/html'],
excludedPath: [
// Text/code files (handled by track-asset-requests or not tracked)
'/docs/*.md',
'/docs/*.js',
'/docs/*.txt',
// Images
'/docs/*.svg',
'/docs/*.png',
'/docs/*.jpg',
'/docs/*.jpeg',
'/docs/*.gif',
'/docs/*.webp',
'/docs/*.ico',
'/docs/images/*',
'/docs/og/*',
// Fonts
'/docs/fonts/*',
'/docs/*.woff',
'/docs/*.woff2',
// Search index (pagefind)
'/docs/pagefind/*',
// Astro build assets
'/docs/_*',
],
};
+2
View File
@@ -16,9 +16,11 @@
"@nx/nx-dev-ui-icons": "workspace:*",
"@nx/nx-dev-ui-markdoc": "workspace:*",
"@tailwindcss/vite": "^4.1.11",
"@types/hast": "^3.0.4",
"astro": "^5.10.1",
"astro-og-canvas": "^0.7.0",
"canvaskit-wasm": "^0.40.0",
"octokit": "^2.0.14",
"tailwindcss": "4.1.11"
}
}
+20
View File
@@ -3,9 +3,22 @@
"$schema": "../node_modules/nx/schemas/project-schema.json",
"comment": "package.json#scripts runs in the project root directory with astro assumes is where the node_modules is. which fails. so run the scripts in project.json#targets with --root command instead",
"targets": {
"prebuild-banner": {
"cache": false,
"outputs": ["{projectRoot}/src/content/banner.json"],
"command": "node ../scripts/documentation/prebuild-banner.mjs",
"options": {
"cwd": "astro-docs",
"env": {
"BANNER_OUTPUT_PATH": "src/content/banner.json",
"BANNER_ENV_VAR": "BANNER_URL"
}
}
},
"serve": {
"continuous": true,
"dependsOn": [
"prebuild-banner",
{
"projects": ["devkit", "create-nx-workspace", "dotnet", "maven"],
"target": "build"
@@ -18,11 +31,18 @@
},
"build": {
"dependsOn": [
"prebuild-banner",
{
"projects": ["devkit", "create-nx-workspace", "dotnet", "maven"],
"target": "build"
}
],
"inputs": [
"production",
"^production",
"{projectRoot}/src/content/banner.json",
{ "env": "NX_DEV_URL" }
],
"outputs": [
"{projectRoot}/dist",
"{projectRoot}/.astro",
+113 -111
View File
@@ -1,32 +1,46 @@
(function () {
// Open search modal if signaled via sessionStorage (e.g., from Cmd+K on non-docs pages)
var SEARCH_STORAGE_KEY = 'nx-open-search';
var SEARCH_EXPIRY_MS = 30000; // 30 seconds
function openSearchFromStorage() {
var timestamp = sessionStorage.getItem(SEARCH_STORAGE_KEY);
if (!timestamp) return;
// Clear immediately to prevent re-triggering
sessionStorage.removeItem(SEARCH_STORAGE_KEY);
// Check if expired (older than 30 seconds)
var age = Date.now() - parseInt(timestamp, 10);
if (age > SEARCH_EXPIRY_MS) return;
var openSearchBtn = document.querySelector('button[data-open-modal]');
if (openSearchBtn) {
openSearchBtn.click();
// Focus the search input after modal opens
setTimeout(function () {
var searchInput = document.querySelector('dialog[open] input');
if (searchInput) {
searchInput.focus();
}
}, 100);
}
}
// Check on load
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', openSearchFromStorage);
} else {
// Small delay to ensure search component is initialized
setTimeout(openSearchFromStorage, 100);
}
const config = window.__CONFIG || {};
if (!config.isProd) return;
const isCookiebotDisabled = config.cookiebotDisabled ?? false;
const gaMeasurementId = config.gaMeasurementId ?? 'UA-88380372-10';
const gtmMeasurementId = config.gtmMeasurementId ?? 'GTM-KW8423B6';
// Initialize global objects
window.Cookiebot = window.Cookiebot || {};
window.dataLayer = window.dataLayer || [];
window.gtag =
window.gtag ||
function () {
window.dataLayer.push(arguments);
};
const loadGoogleAnalytics = () => {
const script = document.createElement('script');
script.src = `https://www.googletagmanager.com/gtag/js?id=${gaMeasurementId}`;
script.async = true;
document.head.appendChild(script);
// Initialize gtag
window.gtag('js', new Date());
window.gtag('config', gaMeasurementId, {
page_path: window.location.pathname,
});
};
const loadGTM = () => {
if (!gtmMeasurementId) return;
@@ -43,70 +57,82 @@
})(window, document, 'script', 'dataLayer', gtmMeasurementId);
};
const loadHubSpot = () => {
const hsScript = document.createElement('script');
hsScript.src = 'https://js.hs-scripts.com/2757427.js';
hsScript.async = true;
hsScript.defer = true;
document.head.appendChild(hsScript);
// Load HubSpot Forms
const hsFormsScript = document.createElement('script');
hsFormsScript.src = '//js.hsforms.net/forms/v2.js';
hsFormsScript.async = true;
hsFormsScript.defer = true;
document.head.appendChild(hsFormsScript);
// GA4 events are dispatched via GTM dataLayer.
const pushGtmEvent = (eventName, payload) => {
window.dataLayer.push({ event: eventName, ...payload });
};
const loadApollo = () => {
const n = Math.random().toString(36).substring(7);
const script = document.createElement('script');
script.src = `https://assets.apollo.io/micro/website-tracker/tracker.iife.js?nocache=${n}`;
script.async = true;
script.defer = true;
script.onload = function () {
if (window.trackingFunctions?.onLoad) {
window.trackingFunctions.onLoad({
appId: '65e1db2f1976f30300fd8b26',
// Scroll depth tracking
const SCROLL_THRESHOLDS = [10, 25, 50, 75, 90];
let firedThresholds = new Set();
let scrollTrackingEnabled = false;
let scrollRafId = null;
function getScrollPercentage() {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
const scrollHeight = document.documentElement.scrollHeight;
const clientHeight = window.innerHeight;
return (scrollTop + clientHeight) / scrollHeight;
}
function handleScrollTracking() {
if (!scrollTrackingEnabled) return;
const scrollPercentage = getScrollPercentage() * 100;
// Fire events for all thresholds we've passed but haven't fired yet
for (const threshold of SCROLL_THRESHOLDS) {
if (scrollPercentage >= threshold && !firedThresholds.has(threshold)) {
firedThresholds.add(threshold);
sendSearchEvent(`scroll_${threshold}`, {
event_category: 'scroll',
event_label: window.location.pathname,
});
}
};
document.head.appendChild(script);
};
}
}
const loadHotjar = () => {
(function (h, o, t, j, a, r) {
h.hj =
h.hj ||
function () {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = { hjid: 2774127, hjsv: 6 };
a = o.getElementsByTagName('head')[0];
r = o.createElement('script');
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
};
function throttledScrollHandler() {
if (scrollRafId !== null) return;
const loadTwitterPixel = () => {
!(function (e, t, n, s, u, a) {
e.twq ||
((s = e.twq =
function () {
s.exe ? s.exe.apply(s, arguments) : s.queue.push(arguments);
}),
(s.version = '1.1'),
(s.queue = []),
(u = t.createElement(n)),
(u.async = !0),
(u.src = 'https://static.ads-twitter.com/uwt.js'),
(a = t.getElementsByTagName(n)[0]),
a.parentNode.insertBefore(u, a));
})(window, document, 'script');
window.twq('config', 'obtp4');
};
scrollRafId = requestAnimationFrame(() => {
handleScrollTracking();
scrollRafId = null;
});
}
function attachScrollListener() {
window.addEventListener('scroll', throttledScrollHandler, {
passive: true,
});
}
function setupScrollTracking() {
// Reset scroll depth on navigation (for SPA-like behavior via View Transitions)
firedThresholds = new Set();
scrollTrackingEnabled = false;
// Delay tracking start to avoid false triggers during navigation
setTimeout(() => {
scrollTrackingEnabled = true;
// Immediately check current scroll position to capture thresholds
// that may have been passed during the delay
handleScrollTracking();
}, 500);
attachScrollListener();
// Handle Astro View Transitions - reset on navigation
document.addEventListener('astro:after-swap', () => {
firedThresholds = new Set();
scrollTrackingEnabled = false;
setTimeout(() => {
scrollTrackingEnabled = true;
// Immediately check current scroll position after navigation
handleScrollTracking();
}, 500);
});
}
const SEARCH_DEBOUNCE_MS = 1000;
let searchDebounceTimer;
@@ -115,8 +141,7 @@
let inputHandler = null;
function sendSearchEvent(eventType, data) {
if (typeof window.gtag !== 'undefined')
window.gtag('event', eventType, data);
pushGtmEvent(eventType, data);
}
function trackSearchQuery(query) {
@@ -167,31 +192,11 @@
});
}
const checkAndLoadScripts = () => {
if (isCookiebotDisabled) {
loadGoogleAnalytics();
loadGTM();
loadHubSpot();
setupSearchTracking();
} else if (window.Cookiebot && window.Cookiebot.consent) {
// Statistics cookies (Google Analytics, GTM, Search Tracking)
if (window.Cookiebot.consent.statistics) {
loadGoogleAnalytics();
loadGTM();
setupSearchTracking();
}
// Marketing cookies (HubSpot, Apollo, Hotjar, Twitter)
if (window.Cookiebot.consent.marketing) {
loadHubSpot();
loadApollo();
loadHotjar();
loadTwitterPixel();
}
} else {
// Wait for Cookiebot to load
setTimeout(checkAndLoadScripts, 100);
}
const initializeAnalytics = () => {
if (!gtmMeasurementId) return;
loadGTM();
setupSearchTracking();
setupScrollTracking();
};
// Add GTM noscript iframe to body
@@ -208,11 +213,8 @@
document.body.insertBefore(noscript, document.body.firstChild);
};
// Listen for user consent to cookies
window.addEventListener('CookiebotOnAccept', checkAndLoadScripts);
// Initial check
checkAndLoadScripts();
initializeAnalytics();
// Add GTM noscript on DOM ready
if (document.readyState === 'loading') {
+1 -9
View File
@@ -1,9 +1 @@
<svg
role="img"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
>
<title>Java</title>
<path d="m16.5093 4.9869-.0607-.0347c-1.1014.369-4.4915 1.707-4.4915 4.202 0 1.411 1.378 2.1925 1.378 3.5158 0 .472-.2666.9146-.4836 1.1791l.1091.063c.5735-.3728 1.589-1.18 1.589-2.2222 0-.8825-1.2216-1.943-1.2216-3.0774 0-1.7875 2.357-3.1899 3.1813-3.6256zm-1.6642-3.27c0 3.6925-5.0604 5.1055-5.0604 7.7309 0 1.843 1.2222 2.9987 1.8983 3.7293l-.055.0317c-.8536-.534-3.0995-1.876-3.0995-4.0927 0-3.112 5.8123-4.599 5.8123-8.134 0-.435-.0644-.7683-.1095-.9482L14.2901 0c.1842.2315.555.8102.555 1.7168m.514 14.9392c-.5962.1688-1.9389.4441-3.859.4441-1.8844 0-3.424-.3226-3.4289-.7024-.0032-.2527.3024-.3628.3024-.3628l-.0544-.0316c-.9023.1595-1.7406.406-1.7357.7752.0084.6698 2.5697 1.1728 4.9129 1.1728 1.992 0 3.9053-.3343 4.7684-.7722zm-6.368 2.0708c-.4185.0832-1.3305.2926-1.3305.7361 0 .6144 1.9513 1.085 3.835 1.085 2.5922 0 3.6539-.667 3.702-.7016l-1.078-.6235c-.4583.1092-1.2306.2808-2.6214.2808-1.5521 0-2.5634-.2658-2.5634-.5569 0-.0617.0386-.135.1106-.1886zm10.5923-4.1337c-.0725 1.3911-1.3577 2.2573-2.6423 2.9893l.1164.067c1.3708-.3855 3.8166-1.5085 3.6144-3.2346-.1007-.8608-.8875-1.4758-1.9133-1.4758-.3194 0-.6036.0563-.834.1265l-.0007.0022-.0486.1224c.9175-.1796 1.7558.4904 1.7082 1.403zm-8.1232 8.1638c3.6058-.0313 7.6402-.737 7.6298-1.9232-.0019-.215-.1418-.3622-.2635-.4513l-.0592.034c-.3333.9188-3.1508 1.5977-7.3132 1.634-2.6859.0234-6.4063-.62-6.4128-1.3636-.0065-.7455 1.7625-1.1552 1.7625-1.1552l-.125-.0714c-1.1854.1632-3.3697.731-3.3625 1.5506.0104 1.185 5.0304 1.7734 8.1439 1.7461zm-.375.847c-1.4333.0126-3.1833-.1061-4.6555-.3535l-.1363.0784c1.4664.43 3.508.6896 5.7514.6702 4.4059-.0386 7.9779-1.1311 8.0485-2.446l-.051-.0297c-.2953.3604-2.2009 2.0216-8.9572 2.0806zm-5.5195-9.328c0-.6646 2.521-1.0374 3.6947-1.1277l.112.0647c-.451.082-2.26.401-2.26.8172 0 .4532 2.7747.7501 4.3853.7501 2.7355 0 4.595-.414 5.095-.5505l.6997.4072c-.4792.2346-2.5362.8495-5.7945.8495-3.6214 0-5.9322-.7086-5.9322-1.2105" />
</svg>
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M 16.921875 2.25 C 16.71679725 2.26171875 16.4970705 2.3408205 16.2890625 2.5078125 C 15.40722675 3.2138669999999996 15.541992 3.5771482499999996 15.1171875 4.4296875 C 14.973633 4.9248045 14.736328499999999 4.962891 14.53125 4.5234375 C 14.28515625 4.08691425 14.16503925 3.5419919999999996 13.78125 3.2109375 C 13.16308575 2.67773475 12.4658205 3.0791017500000004 12.84375 3.6796875 C 13.2216795 4.28027325 13.376953499999999 4.91308575 13.5234375 5.90625 C 13.74316425 7.3857420000000005 13.125 9.03222675 12.3046875 9.8203125 C 10.822266 6.7880857500000005 8.885742 4.53808575 7.5234375 3.84375 C 7.1103517499999995 3.6328125 6.984375 3.80859375 6.984375 4.0078125 C 7.2421875 6.978516000000001 7.3359375 9.02929725 7.171875 10.546875 C 7.0986329999999995 11.2265625 5.49609375 13.734375 5.578125 14.3203125 C 5.66015625 14.9033205 6.12890625 15.817383 6.4453125 16.2890625 C 6.31640625 16.1953125 5.99121075 16.4091795 6.0703125 16.7109375 C 5.49902325 17.03027325 5.551758 17.51953125 6.140625 17.6484375 C 6.29296875 18.0439455 6.3251954999999995 18.24023475 6.75 18.421875 C 6.66796875 19.25683575 6.580078500000001 20.11523475 6.4921875 21.046875 C 6.873047250000001 22.921875 9.776367 19.67871075 10.1484375 19.40625 C 12.161133 17.9296875 12.46875 21.15234375 13.875 21.65625 C 16.2421875 22.5029295 15.474609749999999 17.52246075 13.5703125 12.6328125 C 13.34472675 9.489258 14.40234375 8.59277325 15.421875 8.1796875 C 15.958008 8.00390625 16.3564455 7.96875 17.0859375 8.1796875 C 18.33984375 8.54003925 18.60058575 7.11328125 17.484375 6.9375 C 17.0595705 6.8701170000000005 16.7519535 6.8759767499999995 16.359375 6.703125 C 16.5175785 6.0732420000000005 17.14453125 6.041016000000001 17.765625 5.953125 C 19.17773475 5.75390625 19.0546875 4.23046875 17.484375 4.59375 C 16.7988285 4.754883 16.49121075 5.16210975 16.2421875 5.15625 C 16.56152325 4.573242 17.10058575 4.072266 17.625 3.328125 C 18.0175785 2.7685545 17.5341795 2.21484375 16.921875 2.25 Z M 9.6328125 7.734375 C 9.817383 7.7109375 9.978516 7.72265625 10.1484375 7.78125 C 10.8251955 8.009766 11.05371075 8.87109375 10.640625 9.6796875 C 10.22753925 10.48828125 9.3251955 10.9394535 8.6484375 10.7109375 C 7.9716795000000005 10.48242225 7.7666017499999995 9.64453125 8.1796875 8.8359375 C 8.49023475 8.229492 9.07910175 7.8076170000000005 9.6328125 7.734375 Z M 8.90625 8.8359375 C 8.80371075 8.838867 8.698242 8.89746075 8.6015625 9 C 8.4082035 9.208008 8.34375 9.55078125 8.4609375 9.75 C 8.5810545 9.94921875 8.8300785 9.9345705 9.0234375 9.7265625 C 9.21679725 9.5185545 9.2841795 9.17578125 9.1640625 8.9765625 C 9.10546875 8.8769535 9.00878925 8.833008 8.90625 8.8359375 Z M 11.390625 10.7578125 C 12.521484749999999 12.919922249999999 13.587890999999999 15.48046875 13.8046875 18.3984375 C 13.90722675 19.78710975 12.791015999999999 18.28710975 12.65625 18.046875 C 10.359375 13.91015625 7.4091795000000005 22.40625 7.9921875 17.0859375 C 8.2939455 14.89453125 8.4404295 14.604492 8.5078125 12.046875 C 8.5078125 12.046875 10.265625 12.963867 11.390625 10.7578125 Z M 7.21875 13.2890625 C 7.1630857500000005 14.0126955 7.1484375 14.490234749999999 7.078125 15.234375 C 6.9228517499999995 14.830078499999999 6.7177732500000005 14.7890625 6.609375 14.4140625 C 6.8349607500000005 14.16796875 6.990234750000001 13.6875 7.21875 13.2890625 Z"/></svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

-9
View File
@@ -1,9 +0,0 @@
# *
User-agent: *
Allow: /
# Host
Host: https://nx.dev
# Sitemaps
Sitemap: https://nx.dev/sitemap-index.xml
+1133 -175
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Some files were not shown because too many files have changed in this diff Show More