Skip to content

Commit fb9098f

Browse files
MaxKlessFrozenPandaz
authored andcommitted
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 (cherry picked from commit ee22084)
1 parent 13c3a76 commit fb9098f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

packages/nx/src/command-line/configure-ai-agents/configure-ai-agents.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
} from '../../ai/utils';
1313
import { installPackageToTmp } from '../../devkit-internals';
1414
import { output } from '../../utils/output';
15+
import { resolvePackageVersionUsingRegistry } from '../../utils/package-manager';
1516
import { ensurePackageHasProvenance } from '../../utils/provenance';
17+
import { nxVersion } from '../../utils/versions';
1618
import { workspaceRoot } from '../../utils/workspace-root';
1719
import { ConfigureAiAgentsOptions } from './command-object';
1820
import ora = require('ora');
@@ -30,6 +32,19 @@ export async function configureAiAgentsHandler(
3032
return await configureAiAgentsHandlerImpl(args);
3133
}
3234

35+
// Skip downloading latest if the current version is already the latest
36+
try {
37+
const latestVersion = await resolvePackageVersionUsingRegistry(
38+
'nx',
39+
'latest'
40+
);
41+
if (latestVersion === nxVersion) {
42+
return await configureAiAgentsHandlerImpl(args);
43+
}
44+
} catch {
45+
// If we can't check, proceed with download
46+
}
47+
3348
let cleanup: () => void | undefined;
3449
try {
3550
await ensurePackageHasProvenance('nx', 'latest');

0 commit comments

Comments
 (0)