nx 23.2.0-beta.1 → 23.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/init-local.js +3 -5
- package/dist/bin/nx.js +2 -0
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/adapter/ngcli-adapter.js +60 -1
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -10
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +5 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/completion/command-object.js +7 -12
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
- package/dist/src/command-line/format/format.js +84 -101
- package/dist/src/command-line/generate/generate.js +35 -35
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +30 -40
- package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
- package/dist/src/command-line/init/command-object.js +4 -2
- package/dist/src/command-line/init/configure-plugins.js +4 -1
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
- package/dist/src/command-line/init/implementation/angular/index.js +10 -15
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
- package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
- package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
- package/dist/src/command-line/init/implementation/format.d.ts +18 -0
- package/dist/src/command-line/init/implementation/format.js +114 -0
- package/dist/src/command-line/init/implementation/utils.js +8 -0
- package/dist/src/command-line/init/init-v1.js +15 -18
- package/dist/src/command-line/init/init-v2.js +40 -57
- package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
- package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
- package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
- package/dist/src/command-line/migrate/agentic/runner.js +24 -24
- package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
- package/dist/src/command-line/migrate/agentic/select.js +30 -32
- package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
- package/dist/src/command-line/migrate/agentic/types.js +35 -0
- package/dist/src/command-line/migrate/command-object.d.ts +6 -0
- package/dist/src/command-line/migrate/command-object.js +19 -1
- package/dist/src/command-line/migrate/execute-migration.d.ts +28 -9
- package/dist/src/command-line/migrate/execute-migration.js +112 -27
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
- package/dist/src/command-line/migrate/migrate-commits.js +130 -15
- package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
- package/dist/src/command-line/migrate/migrate-config.js +22 -14
- package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
- package/dist/src/command-line/migrate/migrate-output.js +52 -8
- package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
- package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
- package/dist/src/command-line/migrate/migrate.d.ts +28 -68
- package/dist/src/command-line/migrate/migrate.js +657 -293
- package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
- package/dist/src/command-line/migrate/multi-major.js +7 -10
- package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
- package/dist/src/command-line/migrate/run/agent-output.js +65 -0
- package/dist/src/command-line/migrate/run/index.d.ts +9 -0
- package/dist/src/command-line/migrate/run/index.js +23 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
- package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
- package/dist/src/command-line/migrate/run/run-id.js +56 -0
- package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
- package/dist/src/command-line/migrate/run/run-state.js +438 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
- package/dist/src/command-line/migrate/run/state-lock.js +76 -0
- package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
- package/dist/src/command-line/migrate/run/state-machine.js +315 -0
- package/dist/src/command-line/migrate/run/util.d.ts +59 -0
- package/dist/src/command-line/migrate/run/util.js +148 -0
- package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
- package/dist/src/command-line/migrate/run/worker.js +682 -0
- package/dist/src/command-line/migrate/run-migration-process.js +6 -5
- package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
- package/dist/src/command-line/migrate/safe-prompt.js +32 -43
- package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
- package/dist/src/command-line/migrate/sort-migrations.js +32 -0
- package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
- package/dist/src/command-line/migrate/step-actions.js +12 -0
- package/dist/src/command-line/migrate/text.d.ts +18 -0
- package/dist/src/command-line/migrate/text.js +26 -0
- package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
- package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
- package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
- package/dist/src/command-line/nx-commands.js +26 -24
- package/dist/src/command-line/release/changelog.js +11 -17
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/plan.js +15 -28
- package/dist/src/command-line/release/publish.js +5 -0
- package/dist/src/command-line/release/release.js +6 -17
- package/dist/src/command-line/release/utils/git.js +1 -1
- package/dist/src/command-line/release/utils/release-graph.d.ts +18 -0
- package/dist/src/command-line/release/utils/release-graph.js +81 -21
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
- package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +10 -6
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
- package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
- package/dist/src/config/misc-interfaces.d.ts +19 -7
- package/dist/src/config/nx-json.d.ts +4 -2
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -1
- package/dist/src/daemon/client/client.js +160 -36
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +105 -8
- package/dist/src/devkit-internals.js +223 -7
- package/dist/src/executors/run-commands/running-tasks.js +46 -29
- package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
- package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
- package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
- package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
- package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
- package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
- package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
- package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
- package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
- package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
- package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
- package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
- package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
- package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
- package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
- package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
- package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +37 -4
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
- package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
- package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
- package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +27 -2
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
- package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
- package/dist/src/tasks-runner/life-cycle.js +2 -2
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
- package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
- package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
- package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
- package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
- package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
- package/dist/src/tasks-runner/run-command.js +28 -35
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
- package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
- package/dist/src/tasks-runner/task-orchestrator.js +182 -18
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.js +7 -5
- package/dist/src/utils/analytics-enabled.d.ts +7 -0
- package/dist/src/utils/analytics-enabled.js +11 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +4 -58
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/child-process.d.ts +31 -1
- package/dist/src/utils/child-process.js +103 -0
- package/dist/src/utils/chunkify.d.ts +7 -1
- package/dist/src/utils/chunkify.js +10 -3
- package/dist/src/utils/exit-codes.d.ts +9 -0
- package/dist/src/utils/exit-codes.js +19 -0
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/formatters/index.d.ts +13 -0
- package/dist/src/utils/formatters/index.js +74 -0
- package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
- package/dist/src/utils/formatters/oxfmt.js +764 -0
- package/dist/src/utils/formatters/prettier.d.ts +26 -0
- package/dist/src/utils/formatters/prettier.js +201 -0
- package/dist/src/utils/formatters/shared.d.ts +5 -0
- package/dist/src/utils/formatters/shared.js +8 -0
- package/dist/src/utils/git-utils.d.ts +48 -2
- package/dist/src/utils/git-utils.js +220 -14
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +170 -1
- package/dist/src/utils/ignore.js +263 -11
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-console-prompt.js +3 -6
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/output.d.ts +153 -0
- package/dist/src/utils/output.js +289 -5
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.d.ts +2 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +262 -42
- package/dist/src/utils/params.d.ts +7 -1
- package/dist/src/utils/params.js +64 -6
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/prompt-helpers.d.ts +53 -0
- package/dist/src/utils/prompt-helpers.js +111 -0
- package/dist/src/utils/provenance.js +6 -14
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
- package/dist/src/utils/write-formatted-json-file.js +5 -4
- package/migrations.json +6 -0
- package/package.json +29 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
- package/dist/src/utils/is-using-prettier.d.ts +0 -3
- package/dist/src/utils/is-using-prettier.js +0 -62
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
package/dist/bin/init-local.js
CHANGED
|
@@ -6,7 +6,7 @@ const perf_hooks_1 = require("perf_hooks");
|
|
|
6
6
|
const nx_commands_1 = require("../src/command-line/nx-commands");
|
|
7
7
|
const strip_indents_1 = require("../src/utils/strip-indents");
|
|
8
8
|
const client_1 = require("../src/daemon/client/client");
|
|
9
|
-
const
|
|
9
|
+
const prompt_helpers_1 = require("../src/utils/prompt-helpers");
|
|
10
10
|
const output_1 = require("../src/utils/output");
|
|
11
11
|
const analytics_1 = require("../src/analytics");
|
|
12
12
|
/**
|
|
@@ -136,11 +136,9 @@ async function ensureNxConsoleInstalledViaDaemon() {
|
|
|
136
136
|
],
|
|
137
137
|
});
|
|
138
138
|
try {
|
|
139
|
-
const
|
|
140
|
-
type: 'confirm',
|
|
141
|
-
name: 'shouldInstallNxConsole',
|
|
139
|
+
const shouldInstallNxConsole = await (0, prompt_helpers_1.confirmationPrompt)({
|
|
142
140
|
message: 'Install Nx Console? (you can uninstall anytime)',
|
|
143
|
-
|
|
141
|
+
onCancel: () => false,
|
|
144
142
|
});
|
|
145
143
|
// Set preference and install if user said yes
|
|
146
144
|
const result = await client_1.daemonClient.setNxConsolePreferenceAndInstall(shouldInstallNxConsole);
|
package/dist/bin/nx.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
if (process.env.FORCE_COLOR === '0') {
|
|
8
|
+
process.env.NX_ORIGINAL_FORCE_COLOR = '0';
|
|
8
9
|
process.env.NO_COLOR = '1';
|
|
9
10
|
delete process.env.FORCE_COLOR;
|
|
10
11
|
}
|
|
@@ -208,6 +209,7 @@ function resolveNx(workspace) {
|
|
|
208
209
|
function isNxCloudCommand(command) {
|
|
209
210
|
const nxCloudCommands = [
|
|
210
211
|
'start-ci-run',
|
|
212
|
+
'start-nx-agents',
|
|
211
213
|
'start-agent',
|
|
212
214
|
'stop-all-agents',
|
|
213
215
|
'complete-ci-run',
|
|
@@ -215,12 +215,11 @@ class DefaultChangelogRenderer {
|
|
|
215
215
|
if (!name || name.includes('[bot]')) {
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
|
-
if (_authors.has(name)) {
|
|
219
|
-
|
|
220
|
-
entry.email.add(author.email);
|
|
218
|
+
if (!_authors.has(name)) {
|
|
219
|
+
_authors.set(name, { email: new Set() });
|
|
221
220
|
}
|
|
222
|
-
|
|
223
|
-
_authors.
|
|
221
|
+
if (author.email) {
|
|
222
|
+
_authors.get(name).email.add(author.email);
|
|
224
223
|
}
|
|
225
224
|
}
|
|
226
225
|
}
|
package/dist/release/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @public Programmatic API for nx release
|
|
3
3
|
*/
|
|
4
|
-
export { ReleaseClient, release, releaseChangelog, releasePublish, releaseVersion, VersionActions, AfterAllProjectsVersioned, } from '../src/command-line/release';
|
|
4
|
+
export { ReleaseClient, release, releaseChangelog, releasePublish, releaseVersion, VersionActions, AfterAllProjectsVersioned, ResolveVersionForDependency, } from '../src/command-line/release';
|
|
@@ -31,6 +31,7 @@ const executor_utils_1 = require("../command-line/run/executor-utils");
|
|
|
31
31
|
const plugins_1 = require("../project-graph/plugins");
|
|
32
32
|
const schema_utils_1 = require("../config/schema-utils");
|
|
33
33
|
const handle_import_1 = require("../utils/handle-import");
|
|
34
|
+
const prompt_helpers_1 = require("../utils/prompt-helpers");
|
|
34
35
|
const target_merging_1 = require("../project-graph/utils/project-configuration/target-merging");
|
|
35
36
|
function getProjectGraph() {
|
|
36
37
|
try {
|
|
@@ -653,8 +654,66 @@ function createPromptProvider() {
|
|
|
653
654
|
return { ...question, type: definition.type };
|
|
654
655
|
}
|
|
655
656
|
});
|
|
656
|
-
|
|
657
|
+
// Angular hands over a whole form at once; clack asks one question at a
|
|
658
|
+
// time, so they are run in order and the answers reassembled.
|
|
659
|
+
return (async () => {
|
|
660
|
+
const answers = {};
|
|
661
|
+
for (const question of questions) {
|
|
662
|
+
answers[question.name] = await askSchematicQuestion(question);
|
|
663
|
+
}
|
|
664
|
+
return answers;
|
|
665
|
+
})();
|
|
657
666
|
};
|
|
667
|
+
async function askSchematicQuestion(question) {
|
|
668
|
+
const validate = question.validate
|
|
669
|
+
? (value) => {
|
|
670
|
+
const result = question.validate(value);
|
|
671
|
+
if (result === true)
|
|
672
|
+
return undefined;
|
|
673
|
+
return typeof result === 'string' ? result : 'Invalid value';
|
|
674
|
+
}
|
|
675
|
+
: undefined;
|
|
676
|
+
const choices = (question.choices ?? []).map((c) => typeof c === 'string' ? { value: c } : { value: c.name, label: c.message });
|
|
677
|
+
switch (question.type) {
|
|
678
|
+
case 'confirm':
|
|
679
|
+
return (0, prompt_helpers_1.confirmationPrompt)({
|
|
680
|
+
message: question.message,
|
|
681
|
+
initial: question.initial !== false,
|
|
682
|
+
});
|
|
683
|
+
case 'select':
|
|
684
|
+
return (0, prompt_helpers_1.selectPrompt)({
|
|
685
|
+
message: question.message,
|
|
686
|
+
choices,
|
|
687
|
+
initial: question.initial,
|
|
688
|
+
});
|
|
689
|
+
case 'multiselect':
|
|
690
|
+
return (0, prompt_helpers_1.multiselectPrompt)({
|
|
691
|
+
message: question.message,
|
|
692
|
+
choices,
|
|
693
|
+
initialValues: question.initial,
|
|
694
|
+
});
|
|
695
|
+
case 'numeral': {
|
|
696
|
+
// No numeric prompt; the answer is parsed back so callers still get a
|
|
697
|
+
// number rather than the typed string.
|
|
698
|
+
const answer = await (0, prompt_helpers_1.textPrompt)({
|
|
699
|
+
message: question.message,
|
|
700
|
+
initialValue: question.initial === undefined
|
|
701
|
+
? undefined
|
|
702
|
+
: String(question.initial),
|
|
703
|
+
validate: (value) => value !== '' && !Number.isNaN(Number(value))
|
|
704
|
+
? validate?.(value)
|
|
705
|
+
: 'Please enter a number',
|
|
706
|
+
});
|
|
707
|
+
return Number(answer);
|
|
708
|
+
}
|
|
709
|
+
default:
|
|
710
|
+
return (0, prompt_helpers_1.textPrompt)({
|
|
711
|
+
message: question.message,
|
|
712
|
+
initialValue: question.initial,
|
|
713
|
+
validate,
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
}
|
|
658
717
|
}
|
|
659
718
|
async function runMigration(root, packageName, migrationName, projects, isVerbose, projectGraph) {
|
|
660
719
|
const logger = (0, exports.getLogger)(isVerbose);
|
|
@@ -7,9 +7,11 @@ const fs_1 = require("fs");
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const semver_1 = require("semver");
|
|
9
9
|
const smol_toml_1 = tslib_1.__importDefault(require("smol-toml"));
|
|
10
|
-
const
|
|
10
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
11
11
|
const generate_files_1 = require("../../generators/utils/generate-files");
|
|
12
12
|
const json_1 = require("../../generators/utils/json");
|
|
13
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
14
|
+
const analytics_enabled_1 = require("../../utils/analytics-enabled");
|
|
13
15
|
const native_1 = require("../../native");
|
|
14
16
|
const package_json_1 = require("../../utils/package-json");
|
|
15
17
|
const package_manager_1 = require("../../utils/package-manager");
|
|
@@ -71,6 +73,8 @@ function normalizeOptions(options) {
|
|
|
71
73
|
async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
72
74
|
const hasAgent = (agent) => options.agents.includes(agent);
|
|
73
75
|
const nxVersion = (0, installed_nx_version_1.getInstalledNxVersion)() ?? getDeclaredNxVersionOrDefault();
|
|
76
|
+
const analyticsEnabled = (0, analytics_enabled_1.isAnalyticsEnabled)((0, nx_json_1.readNxJson)(tree));
|
|
77
|
+
let addedAnalyticsDomain = false;
|
|
74
78
|
const agentsMd = (0, constants_1.agentsMdPath)(options.directory);
|
|
75
79
|
// write AGENTS.md for most agents
|
|
76
80
|
if (hasAgent('cursor') ||
|
|
@@ -87,6 +91,9 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
87
91
|
if (!tree.exists(claudeSettingsPath)) {
|
|
88
92
|
(0, json_1.writeJson)(tree, claudeSettingsPath, {});
|
|
89
93
|
}
|
|
94
|
+
const allowedDomains = (0, json_1.readJson)(tree, claudeSettingsPath).sandbox?.network?.allowedDomains;
|
|
95
|
+
addedAnalyticsDomain =
|
|
96
|
+
analyticsEnabled && !allowedDomains?.includes(constants_1.analyticsDomain);
|
|
90
97
|
(0, json_1.updateJson)(tree, claudeSettingsPath, (json) => ({
|
|
91
98
|
...json,
|
|
92
99
|
extraKnownMarketplaces: {
|
|
@@ -103,19 +110,11 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
103
110
|
...json.enabledPlugins,
|
|
104
111
|
'nx@nx-claude-plugins': true,
|
|
105
112
|
},
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
allowedDomains: json.sandbox?.network?.allowedDomains?.includes(constants_1.analyticsDomain)
|
|
112
|
-
? json.sandbox.network.allowedDomains
|
|
113
|
-
: [
|
|
114
|
-
...(json.sandbox?.network?.allowedDomains ?? []),
|
|
115
|
-
constants_1.analyticsDomain,
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
113
|
+
// Widening the sandbox's egress is only justified while events are
|
|
114
|
+
// actually being sent, so it follows the workspace's analytics opt-in.
|
|
115
|
+
...(analyticsEnabled
|
|
116
|
+
? { sandbox: allowAnalyticsDomain(json.sandbox) }
|
|
117
|
+
: {}),
|
|
119
118
|
}));
|
|
120
119
|
// Clean up .mcp.json (nx-mcp now handled by plugin)
|
|
121
120
|
const mcpJsonPath = (0, constants_1.claudeMcpJsonPath)(options.directory);
|
|
@@ -234,11 +233,20 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
234
233
|
(0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.nx/polygraph');
|
|
235
234
|
(0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.claude/worktrees');
|
|
236
235
|
(0, ignore_1.addEntryToGitIgnore)(tree, (0, path_1.join)(options.directory, '.gitignore'), '.claude/settings.local.json');
|
|
237
|
-
await (0,
|
|
236
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
238
237
|
// we use the check variable to determine if we should actually make changes or just report what would be changed
|
|
239
238
|
return async (check = false) => {
|
|
240
239
|
const messages = [];
|
|
241
240
|
const errors = [];
|
|
241
|
+
if (addedAnalyticsDomain) {
|
|
242
|
+
messages.push({
|
|
243
|
+
title: `Allowed ${constants_1.analyticsDomain} through Claude Code's sandbox network filter`,
|
|
244
|
+
bodyLines: [
|
|
245
|
+
`Nx sends analytics there because this workspace sets "analytics": true in nx.json.`,
|
|
246
|
+
`Set it to false to opt out, then remove the domain from .claude/settings.json.`,
|
|
247
|
+
],
|
|
248
|
+
});
|
|
249
|
+
}
|
|
242
250
|
if (hasAgent('copilot')) {
|
|
243
251
|
try {
|
|
244
252
|
if ((await (0, native_1.isEditorInstalled)(0 /* SupportedEditor.VSCode */)) &&
|
|
@@ -300,6 +308,18 @@ async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
|
300
308
|
};
|
|
301
309
|
};
|
|
302
310
|
}
|
|
311
|
+
function allowAnalyticsDomain(sandbox) {
|
|
312
|
+
const allowedDomains = sandbox?.network?.allowedDomains ?? [];
|
|
313
|
+
return {
|
|
314
|
+
...sandbox,
|
|
315
|
+
network: {
|
|
316
|
+
...sandbox?.network,
|
|
317
|
+
allowedDomains: allowedDomains.includes(constants_1.analyticsDomain)
|
|
318
|
+
? allowedDomains
|
|
319
|
+
: [...allowedDomains, constants_1.analyticsDomain],
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
}
|
|
303
323
|
function writeAgentRules(tree, path, writeNxCloudRules) {
|
|
304
324
|
if (!tree.exists(path)) {
|
|
305
325
|
// File doesn't exist - create with h1 header (standalone content)
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { EventDimensions } from '../native';
|
|
2
2
|
export declare const customDimensions: EventDimensions;
|
|
3
3
|
export type EventParameters = Partial<Record<EventDimensions[keyof EventDimensions], string | number | boolean>>;
|
|
4
|
+
/**
|
|
5
|
+
* Fraction of sessions that report perf spans. Stamping this rate on a
|
|
6
|
+
* measure's detail (as the sampleRate dimension) opts it into sampling; see
|
|
7
|
+
* is_sampled_in in native/telemetry/service.rs. Multiply GA counts by 1/rate.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PERF_SPAN_SAMPLE_RATE = 0.1;
|
|
4
10
|
export declare function startAnalytics(): Promise<void>;
|
|
5
11
|
export declare function reportNxAddCommand(packageName: string, version: string): void;
|
|
6
12
|
export declare function reportNxGenerateCommand(generator: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.customDimensions = void 0;
|
|
3
|
+
exports.PERF_SPAN_SAMPLE_RATE = exports.customDimensions = void 0;
|
|
4
4
|
exports.startAnalytics = startAnalytics;
|
|
5
5
|
exports.reportNxAddCommand = reportNxAddCommand;
|
|
6
6
|
exports.reportNxGenerateCommand = reportNxGenerateCommand;
|
|
@@ -10,6 +10,7 @@ exports.argsToQueryString = argsToQueryString;
|
|
|
10
10
|
exports.flushAnalytics = flushAnalytics;
|
|
11
11
|
const tslib_1 = require("tslib");
|
|
12
12
|
const nx_json_1 = require("../config/nx-json");
|
|
13
|
+
const analytics_enabled_1 = require("../utils/analytics-enabled");
|
|
13
14
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
14
15
|
const versions_1 = require("../utils/versions");
|
|
15
16
|
const native_1 = require("../native");
|
|
@@ -19,7 +20,7 @@ const os = tslib_1.__importStar(require("os"));
|
|
|
19
20
|
const crypto_1 = require("crypto");
|
|
20
21
|
const machine_id_cache_1 = require("../utils/machine-id-cache");
|
|
21
22
|
const is_ci_1 = require("../utils/is-ci");
|
|
22
|
-
const
|
|
23
|
+
const workspace_id_1 = require("../utils/workspace-id");
|
|
23
24
|
const db_connection_1 = require("../utils/db-connection");
|
|
24
25
|
// Conditionally import telemetry functions only on non-WASM platforms
|
|
25
26
|
let initializeTelemetry;
|
|
@@ -42,6 +43,12 @@ exports.customDimensions = native_1.IS_WASM
|
|
|
42
43
|
? null
|
|
43
44
|
: (getEventDimensions?.() ?? null);
|
|
44
45
|
let _telemetryInitialized = false;
|
|
46
|
+
/**
|
|
47
|
+
* Fraction of sessions that report perf spans. Stamping this rate on a
|
|
48
|
+
* measure's detail (as the sampleRate dimension) opts it into sampling; see
|
|
49
|
+
* is_sampled_in in native/telemetry/service.rs. Multiply GA counts by 1/rate.
|
|
50
|
+
*/
|
|
51
|
+
exports.PERF_SPAN_SAMPLE_RATE = 0.1;
|
|
45
52
|
async function startAnalytics() {
|
|
46
53
|
// Analytics not supported on WASM
|
|
47
54
|
if (native_1.IS_WASM) {
|
|
@@ -52,17 +59,20 @@ async function startAnalytics() {
|
|
|
52
59
|
// detection, machine id, telemetry init) may throw past this boundary -
|
|
53
60
|
// on any failure, continue without telemetry.
|
|
54
61
|
try {
|
|
55
|
-
|
|
62
|
+
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
63
|
+
if (!(0, analytics_enabled_1.isAnalyticsEnabled)(nxJson)) {
|
|
56
64
|
return;
|
|
57
65
|
}
|
|
58
|
-
const
|
|
59
|
-
const workspaceId = (0, analytics_prompt_1.generateWorkspaceId)();
|
|
66
|
+
const workspaceId = (0, workspace_id_1.generateWorkspaceId)(workspace_root_1.workspaceRoot, nxJson);
|
|
60
67
|
if (!workspaceId) {
|
|
61
68
|
// Not a git repo — no telemetry
|
|
62
69
|
return;
|
|
63
70
|
}
|
|
64
71
|
const isNxCloud = !!(nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken);
|
|
65
|
-
|
|
72
|
+
// A CI fleet is not a user: shared images bake in /etc/machine-id, so a
|
|
73
|
+
// uid would collapse whole fleets into one GA "user" (and trip per-user
|
|
74
|
+
// collection caps). GA falls back to cid = workspace for CI traffic.
|
|
75
|
+
const userId = (0, is_ci_1.isCI)() ? undefined : await getTelemetryUserId(workspaceId);
|
|
66
76
|
const packageManagerInfo = getPackageManagerInfo();
|
|
67
77
|
const nodeVersion = (0, semver_1.parse)(process.version);
|
|
68
78
|
const nodeVersionString = nodeVersion
|
|
@@ -226,10 +236,6 @@ function getPackageManagerInfo() {
|
|
|
226
236
|
version: (0, package_manager_1.getPackageManagerVersion)(pm),
|
|
227
237
|
};
|
|
228
238
|
}
|
|
229
|
-
function isAnalyticsEnabled() {
|
|
230
|
-
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
231
|
-
return nxJson?.analytics === true;
|
|
232
|
-
}
|
|
233
239
|
// Mix workspace id in: shared Docker images (Gitpod, Cypress, etc.) bake
|
|
234
240
|
// in /etc/machine-id, so machine-id alone collapses many users into one.
|
|
235
241
|
async function getTelemetryUserId(workspaceId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { customDimensions, EventParameters, startAnalytics, reportNxAddCommand, reportNxGenerateCommand, reportCommandRunEvent, reportEvent, flushAnalytics, } from './analytics';
|
|
1
|
+
export { customDimensions, EventParameters, PERF_SPAN_SAMPLE_RATE, startAnalytics, reportNxAddCommand, reportNxGenerateCommand, reportCommandRunEvent, reportEvent, flushAnalytics, } from './analytics';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flushAnalytics = exports.reportEvent = exports.reportCommandRunEvent = exports.reportNxGenerateCommand = exports.reportNxAddCommand = exports.startAnalytics = exports.customDimensions = void 0;
|
|
3
|
+
exports.flushAnalytics = exports.reportEvent = exports.reportCommandRunEvent = exports.reportNxGenerateCommand = exports.reportNxAddCommand = exports.startAnalytics = exports.PERF_SPAN_SAMPLE_RATE = exports.customDimensions = void 0;
|
|
4
4
|
var analytics_1 = require("./analytics");
|
|
5
5
|
Object.defineProperty(exports, "customDimensions", { enumerable: true, get: function () { return analytics_1.customDimensions; } });
|
|
6
|
+
Object.defineProperty(exports, "PERF_SPAN_SAMPLE_RATE", { enumerable: true, get: function () { return analytics_1.PERF_SPAN_SAMPLE_RATE; } });
|
|
6
7
|
Object.defineProperty(exports, "startAnalytics", { enumerable: true, get: function () { return analytics_1.startAnalytics; } });
|
|
7
8
|
Object.defineProperty(exports, "reportNxAddCommand", { enumerable: true, get: function () { return analytics_1.reportNxAddCommand; } });
|
|
8
9
|
Object.defineProperty(exports, "reportNxGenerateCommand", { enumerable: true, get: function () { return analytics_1.reportNxGenerateCommand; } });
|
|
@@ -18,9 +18,14 @@ const semver_1 = require("semver");
|
|
|
18
18
|
const configure_plugins_1 = require("../init/configure-plugins");
|
|
19
19
|
const spinner_1 = require("../../utils/spinner");
|
|
20
20
|
const analytics_1 = require("../../analytics");
|
|
21
|
+
const client_1 = require("../../daemon/client/client");
|
|
21
22
|
function addHandler(options) {
|
|
22
23
|
return (0, handle_errors_1.handleErrors)(options.verbose, async () => {
|
|
23
24
|
output_1.output.addNewline();
|
|
25
|
+
// Package managers write the lock file before node_modules is fully linked,
|
|
26
|
+
// so a live daemon restarts mid-install and caches a graph whose plugins,
|
|
27
|
+
// still being relinked, no longer resolve.
|
|
28
|
+
await client_1.daemonClient.stop();
|
|
24
29
|
const [pkgName, version] = parsePackageSpecifier(options.packageSpecifier);
|
|
25
30
|
(0, analytics_1.reportNxAddCommand)(pkgName, version);
|
|
26
31
|
const nxJson = (0, nx_json_1.readNxJson)();
|
|
@@ -49,6 +49,7 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
|
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
const status = await (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, { nxJson }, nxArgs, overrides, null, extraTargetDependencies, extraOptions);
|
|
52
|
+
await output_1.output.drain();
|
|
52
53
|
process.exit(status);
|
|
53
54
|
}
|
|
54
55
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsCompletionCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const os_1 = require("os");
|
|
7
7
|
const path_1 = require("path");
|
|
@@ -69,18 +69,13 @@ async function pickShellsInteractively() {
|
|
|
69
69
|
process.exit(1);
|
|
70
70
|
}
|
|
71
71
|
const detected = detectAvailableShells();
|
|
72
|
-
|
|
73
|
-
type: 'multiselect',
|
|
74
|
-
name: 'shells',
|
|
72
|
+
return await (0, prompt_helpers_1.multiselectPrompt)({
|
|
75
73
|
message: 'Install nx completion for which shell(s)?',
|
|
76
|
-
choices: SHELL_CHOICES
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})),
|
|
82
|
-
}));
|
|
83
|
-
return answer.shells ?? [];
|
|
74
|
+
choices: SHELL_CHOICES,
|
|
75
|
+
// Pre-select shells we can detect on this machine.
|
|
76
|
+
initialValues: SHELL_CHOICES.filter((name) => detected.has(name)),
|
|
77
|
+
onCancel: () => [],
|
|
78
|
+
});
|
|
84
79
|
}
|
|
85
80
|
/** Best-effort detect-which-shells-the-user-has. Pre-checks the multiselect.
|
|
86
81
|
* Signals: $SHELL basename, presence of conventional rc files, $PSModulePath
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.configureAiAgentsHandler = configureAiAgentsHandler;
|
|
4
4
|
exports.configureAiAgentsHandlerImpl = configureAiAgentsHandlerImpl;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const prompt_helpers_1 = require("../../utils/prompt-helpers");
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
8
|
const node_path_1 = require("node:path");
|
|
9
9
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
@@ -11,7 +11,7 @@ const constants_1 = require("../../ai/constants");
|
|
|
11
11
|
const detect_ai_agent_1 = require("../../ai/detect-ai-agent");
|
|
12
12
|
const utils_1 = require("../../ai/utils");
|
|
13
13
|
const client_1 = require("../../daemon/client/client");
|
|
14
|
-
const
|
|
14
|
+
const package_json_1 = require("../../utils/package-json");
|
|
15
15
|
const output_1 = require("../../utils/output");
|
|
16
16
|
const package_manager_1 = require("../../utils/package-manager");
|
|
17
17
|
const provenance_1 = require("../../utils/provenance");
|
|
@@ -44,7 +44,7 @@ async function configureAiAgentsHandler(args, inner = false) {
|
|
|
44
44
|
let cleanup;
|
|
45
45
|
try {
|
|
46
46
|
await (0, provenance_1.ensurePackageHasProvenance)('nx', 'latest');
|
|
47
|
-
const packageInstallResults = (0,
|
|
47
|
+
const packageInstallResults = (0, package_json_1.installPackageToTmp)('nx', 'latest', (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot));
|
|
48
48
|
cleanup = packageInstallResults.cleanup;
|
|
49
49
|
let modulePath = require.resolve('nx/src/command-line/configure-ai-agents/configure-ai-agents.js', { paths: [packageInstallResults.tempDir] });
|
|
50
50
|
const module = await (0, handle_import_1.handleImport)(modulePath);
|
|
@@ -63,8 +63,10 @@ async function configureAiAgentsHandler(args, inner = false) {
|
|
|
63
63
|
await resetDaemonAgentStatus();
|
|
64
64
|
}
|
|
65
65
|
async function configureAiAgentsHandlerImpl(options) {
|
|
66
|
-
// Node 24
|
|
67
|
-
//
|
|
66
|
+
// Node 24's stricter readline throws ERR_USE_AFTER_CLOSE when a prompt
|
|
67
|
+
// library operates on a closed interface. Added for enquirer, which nx no
|
|
68
|
+
// longer uses; verify against Node 24 before removing.
|
|
69
|
+
// TODO(v24): drop if @clack/prompts proves not to need it.
|
|
68
70
|
process.on('uncaughtException', (error) => {
|
|
69
71
|
if (error &&
|
|
70
72
|
typeof error === 'object' &&
|
|
@@ -158,7 +160,7 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
158
160
|
...partiallyConfiguredAgents,
|
|
159
161
|
...outOfDateAgents,
|
|
160
162
|
...nonConfiguredAgents,
|
|
161
|
-
].map((a) => getAgentChoiceForPrompt(a).
|
|
163
|
+
].map((a) => getAgentChoiceForPrompt(a).label),
|
|
162
164
|
});
|
|
163
165
|
process.exit(1);
|
|
164
166
|
}
|
|
@@ -239,26 +241,22 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
239
241
|
}
|
|
240
242
|
// Interactive mode (or non-interactive with explicit --agents)
|
|
241
243
|
const allAgentChoices = [];
|
|
242
|
-
const
|
|
243
|
-
let currentIndex = 0;
|
|
244
|
+
const preselectedAgents = [];
|
|
244
245
|
// Partially configured agents first (highest priority)
|
|
245
246
|
partiallyConfiguredAgents.forEach((a) => {
|
|
246
247
|
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
247
|
-
|
|
248
|
-
currentIndex++;
|
|
248
|
+
preselectedAgents.push(a.name);
|
|
249
249
|
});
|
|
250
250
|
// Outdated agents second
|
|
251
251
|
for (const a of fullyConfiguredAgents) {
|
|
252
252
|
if (a.outdated) {
|
|
253
253
|
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
254
|
-
|
|
255
|
-
currentIndex++;
|
|
254
|
+
preselectedAgents.push(a.name);
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
257
|
// Non-configured agents last
|
|
259
258
|
nonConfiguredAgents.forEach((a) => {
|
|
260
259
|
allAgentChoices.push(getAgentChoiceForPrompt(a));
|
|
261
|
-
currentIndex++;
|
|
262
260
|
});
|
|
263
261
|
if (allAgentChoices.length === 0) {
|
|
264
262
|
output_1.output.success({
|
|
@@ -270,18 +268,13 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
270
268
|
let selectedAgents;
|
|
271
269
|
if (options.interactive !== false) {
|
|
272
270
|
try {
|
|
273
|
-
selectedAgents =
|
|
274
|
-
type: 'multiselect',
|
|
275
|
-
name: 'agents',
|
|
271
|
+
selectedAgents = await (0, prompt_helpers_1.multiselectPrompt)({
|
|
276
272
|
message: 'Which AI agents would you like to configure? (space to select, enter to confirm)',
|
|
277
273
|
choices: allAgentChoices,
|
|
278
|
-
|
|
274
|
+
initialValues: preselectedAgents,
|
|
279
275
|
required: true,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return pc.dim(` ${getAgentFooterDescription(focused.agentConfiguration)}`);
|
|
283
|
-
},
|
|
284
|
-
})).agents;
|
|
276
|
+
onCancel: () => process.exit(1),
|
|
277
|
+
});
|
|
285
278
|
}
|
|
286
279
|
catch {
|
|
287
280
|
process.exit(1);
|
|
@@ -289,7 +282,7 @@ async function configureAiAgentsHandlerImpl(options) {
|
|
|
289
282
|
}
|
|
290
283
|
else {
|
|
291
284
|
// non-interactive with explicit --agents: configure all requested
|
|
292
|
-
selectedAgents = allAgentChoices.map((a) => a.
|
|
285
|
+
selectedAgents = allAgentChoices.map((a) => a.value);
|
|
293
286
|
}
|
|
294
287
|
if (selectedAgents?.length === 0) {
|
|
295
288
|
output_1.output.log({
|
|
@@ -388,10 +381,11 @@ function getAgentChoiceForPrompt(agent) {
|
|
|
388
381
|
const partiallyConfigured = agent.mcp !== agent.rules;
|
|
389
382
|
const needsUpdate = partiallyConfigured || agent.outdated;
|
|
390
383
|
return {
|
|
391
|
-
|
|
392
|
-
|
|
384
|
+
value: agent.name,
|
|
385
|
+
label: needsUpdate
|
|
393
386
|
? `${agent.displayName} (update available)`
|
|
394
387
|
: agent.displayName,
|
|
388
|
+
hint: getAgentFooterDescription(agent),
|
|
395
389
|
agentConfiguration: agent,
|
|
396
390
|
};
|
|
397
391
|
}
|