nx 24.0.0-beta.0 → 24.0.0-beta.2
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/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/command-line/graph/graph.js +2 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +19 -23
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +16 -19
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +25 -13
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +82 -22
- package/dist/src/command-line/migrate/agentic/select.js +3 -3
- package/dist/src/command-line/migrate/agentic/types.js +1 -3
- package/dist/src/command-line/migrate/command-object.js +5 -9
- package/dist/src/command-line/migrate/execute-migration.d.ts +2 -2
- package/dist/src/command-line/migrate/execute-migration.js +18 -10
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +6 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +12 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +4 -1
- package/dist/src/command-line/migrate/migrate-commits.js +10 -3
- package/dist/src/command-line/migrate/migrate-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate.d.ts +3 -30
- package/dist/src/command-line/migrate/migrate.js +206 -237
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +5 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +68 -20
- package/dist/src/command-line/migrate/run/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/index.d.ts +6 -5
- package/dist/src/command-line/migrate/run/index.js +12 -1
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +21 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +149 -32
- package/dist/src/command-line/migrate/run/run-state.d.ts +13 -0
- package/dist/src/command-line/migrate/run/run-state.js +21 -0
- package/dist/src/command-line/migrate/run/runbook.js +19 -0
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +3 -0
- package/dist/src/command-line/migrate/run/util.js +7 -1
- package/dist/src/command-line/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/show/show-target/info.js +1 -1
- package/dist/src/config/nx-json.d.ts +13 -4
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +72 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/hasher/check-task-files.js +4 -4
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/native/index.d.ts +92 -14
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +6 -1
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +7 -16
- package/dist/src/tasks-runner/create-task-graph.js +43 -57
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/init-tasks-runner.js +13 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/readiness/probes.d.ts +9 -0
- package/dist/src/tasks-runner/readiness/probes.js +62 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +38 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +190 -0
- package/dist/src/tasks-runner/run-command.js +7 -6
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +37 -10
- package/dist/src/tasks-runner/task-orchestrator.js +459 -79
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +64 -6
- package/dist/src/tasks-runner/utils.js +6 -22
- package/dist/src/utils/child-process.js +1 -0
- package/dist/src/utils/git-utils.d.ts +6 -1
- package/dist/src/utils/git-utils.js +26 -5
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/package.json +12 -11
- package/schemas/nx-schema.json +93 -4
- package/schemas/project-schema.json +84 -2
|
@@ -20,6 +20,9 @@ const deferred_output_1 = require("./deferred-output");
|
|
|
20
20
|
// ignore rule that normally hides it goes missing mid-run (a checkout, a
|
|
21
21
|
// .gitignore edit, or the migration's own changes).
|
|
22
22
|
const MIGRATE_COMMIT_EXCLUDES = [types_1.MIGRATE_RUNS_RELATIVE_DIR];
|
|
23
|
+
// Without it the agent continues as the absorb guidance says, and a cause that
|
|
24
|
+
// fails every commit leaves the whole run uncommitted.
|
|
25
|
+
const AGENT_SESSION_COMMIT_FAILURE = "Commits in this session cannot ask for input, such as a signing passphrase or a hook's prompt, so later commits may fail the same way until the cause is fixed. Before the next step, tell the user what failed and ask whether to fix the cause first or to continue as is. Either way nx tries every later commit, and the first one that lands includes these changes.";
|
|
23
26
|
/**
|
|
24
27
|
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
25
28
|
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
@@ -28,10 +31,14 @@ const MIGRATE_COMMIT_EXCLUDES = [types_1.MIGRATE_RUNS_RELATIVE_DIR];
|
|
|
28
31
|
* The default `failureGuidance` describes the classic loop's absorb-and-recap
|
|
29
32
|
* behavior; a caller with no later commit or recap to absorb the diff (the
|
|
30
33
|
* standalone single-migration worker) passes its own.
|
|
34
|
+
*
|
|
35
|
+
* A `sink` collects the output for a caller sharing the terminal with an
|
|
36
|
+
* agent, and the commit then runs without the terminal.
|
|
31
37
|
*/
|
|
32
|
-
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [], failureGuidance = 'Any uncommitted changes will be included in the next successful commit, which will reference this migration; if they remain uncommitted, the end-of-run output will list this migration so you can commit or revert them manually.',
|
|
38
|
+
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [], failureGuidance = 'Any uncommitted changes will be included in the next successful commit, which will reference this migration; if they remain uncommitted, the end-of-run output will list this migration so you can commit or revert them manually.', sink) {
|
|
33
39
|
if (!shouldCreateCommits)
|
|
34
40
|
return { status: 'disabled' };
|
|
41
|
+
const out = sink ?? deferred_output_1.terminalOutput;
|
|
35
42
|
await installDepsIfChanged();
|
|
36
43
|
// Generator may have only touched gitignored paths or the excluded scratch
|
|
37
44
|
// dir, or the prompt half made no change: log neutrally, not as an error.
|
|
@@ -42,7 +49,7 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
42
49
|
}
|
|
43
50
|
const commitMessage = buildCommitMessage(`${commitPrefix}${migration.name}`, pendingMigrations);
|
|
44
51
|
try {
|
|
45
|
-
const sha = await (0, git_utils_1.tryCommitChangesAsync)(commitMessage, root, MIGRATE_COMMIT_EXCLUDES);
|
|
52
|
+
const sha = await (0, git_utils_1.tryCommitChangesAsync)(commitMessage, root, MIGRATE_COMMIT_EXCLUDES, { withoutTerminal: sink !== undefined });
|
|
46
53
|
if (sha)
|
|
47
54
|
return { status: 'committed', sha };
|
|
48
55
|
// null = commit landed but `git rev-parse HEAD` failed (see
|
|
@@ -52,7 +59,7 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
52
59
|
}
|
|
53
60
|
catch (err) {
|
|
54
61
|
const reason = err instanceof Error ? err.message : String(err);
|
|
55
|
-
out.line('red', `The commit for ${migration.name} failed:\n${reason}\nCheck \`git status\` and \`git log\`; the commit may have landed despite this error. ${failureGuidance}`);
|
|
62
|
+
out.line('red', `The commit for ${migration.name} failed:\n${reason}\nCheck \`git status\` and \`git log\`; the commit may have landed despite this error. ${failureGuidance}${sink ? ` ${AGENT_SESSION_COMMIT_FAILURE}` : ''}`);
|
|
56
63
|
return { status: 'failed', reason };
|
|
57
64
|
}
|
|
58
65
|
}
|
|
@@ -9,12 +9,12 @@ import { type MigrateArgs } from './command-object';
|
|
|
9
9
|
* config value never trips the mutually-exclusive-flag guards in
|
|
10
10
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
11
11
|
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
12
|
-
* running the whole migrations file or a standalone single migration
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* running the whole migrations file or a standalone single migration, and
|
|
13
|
+
* `finalValidation` for the whole file only. A `--run-id` reconcile or
|
|
14
|
+
* recorded worker takes none of them: a recorded run takes its commit config
|
|
15
|
+
* from run.json and is driven by the outer agent. A `--run-migrations
|
|
16
|
+
* --run-id` continue takes `agentic` only, to select the agent of the new
|
|
17
|
+
* session. A `--start-fresh` starts a new run and takes all five.
|
|
18
18
|
*
|
|
19
19
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
20
20
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -14,12 +14,12 @@ const MULTI_MAJOR_MODE_ENV = 'NX_MULTI_MAJOR_MODE';
|
|
|
14
14
|
* config value never trips the mutually-exclusive-flag guards in
|
|
15
15
|
* `parseMigrationsOptions`: `include` and `multiMajorMode` in the generate
|
|
16
16
|
* phase only; `createCommits` / `commitPrefix` and `agentic` / `validate` when
|
|
17
|
-
* running the whole migrations file or a standalone single migration
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* running the whole migrations file or a standalone single migration, and
|
|
18
|
+
* `finalValidation` for the whole file only. A `--run-id` reconcile or
|
|
19
|
+
* recorded worker takes none of them: a recorded run takes its commit config
|
|
20
|
+
* from run.json and is driven by the outer agent. A `--run-migrations
|
|
21
|
+
* --run-id` continue takes `agentic` only, to select the agent of the new
|
|
22
|
+
* session. A `--start-fresh` starts a new run and takes all five.
|
|
23
23
|
*
|
|
24
24
|
* `include` is carried as `includeFromConfig` so it is never mistaken for an
|
|
25
25
|
* explicit `--include`: `resolveInclude` applies it only when the resolved
|
|
@@ -60,6 +60,12 @@ function applyNxJsonMigrateDefaults(args, migrateConfig, env = process.env) {
|
|
|
60
60
|
assertType(migrateConfig.validate, 'boolean', 'validate');
|
|
61
61
|
merged.validate = migrateConfig.validate;
|
|
62
62
|
}
|
|
63
|
+
if (isRunMigrations &&
|
|
64
|
+
merged.finalValidation === undefined &&
|
|
65
|
+
migrateConfig.finalValidation !== undefined) {
|
|
66
|
+
assertType(migrateConfig.finalValidation, 'boolean', 'finalValidation');
|
|
67
|
+
merged.finalValidation = migrateConfig.finalValidation;
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
// A continue takes `agentic` too; the reconcile and the worker must not:
|
|
65
71
|
// there it trips the `--agentic`/`--run-id` parse conflict.
|
|
@@ -196,7 +196,9 @@ export { filterDowngradedUpdates };
|
|
|
196
196
|
export declare function generateMigrationsJsonAndUpdatePackageJson(root: string, opts: GenerateMigrations, fetch?: MigratorOptions['fetch']): Promise<void>;
|
|
197
197
|
export { isPromptOnlyMigration, isHybridMigration };
|
|
198
198
|
export declare function formatSkippedPromptsNextStep(skipped: PlannedMigration[]): string;
|
|
199
|
-
export declare function executeMigrations(root: string, migrations: PlannedMigration[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean, agentic?: ResolvedAgentic,
|
|
199
|
+
export declare function executeMigrations(root: string, migrations: PlannedMigration[], isVerbose: boolean, shouldCreateCommits: boolean, commitPrefix: string, shouldSkipInstall?: boolean, agentic?: Exclude<ResolvedAgentic, {
|
|
200
|
+
kind: 'enabled';
|
|
201
|
+
}>): Promise<{
|
|
200
202
|
migrationsWithNoChanges: PlannedMigration[];
|
|
201
203
|
skippedPromptsCount: number;
|
|
202
204
|
notRunMigrationsCount: number;
|
|
@@ -213,33 +215,4 @@ export declare function migrate(root: string, args: {
|
|
|
213
215
|
}, rawArgs: string[]): Promise<number>;
|
|
214
216
|
export declare function readLocalNxVersion(root: string): string | undefined;
|
|
215
217
|
export declare function runMigration(): Promise<number>;
|
|
216
|
-
/**
|
|
217
|
-
* Resolves a migration's collection once and derives everything the run loop
|
|
218
|
-
* needs from that single read: the implementation context (`collection` +
|
|
219
|
-
* `collectionPath`, handed to `runNxOrAngularMigration`) and, for agentic runs,
|
|
220
|
-
* the workspace-relative documentation path handed to the agent.
|
|
221
|
-
*
|
|
222
|
-
* Read fresh per migration (not cached across the loop) so a prior migration's
|
|
223
|
-
* reinstall is reflected, exactly as before. Error handling matches each field's
|
|
224
|
-
* role:
|
|
225
|
-
* - Migrations that run an implementation REQUIRE the collection; an unreadable
|
|
226
|
-
* collection throws and aborts that migration (caught by the run loop).
|
|
227
|
-
* - Prompt-only migrations don't run an implementation, so the collection is
|
|
228
|
-
* read only to resolve documentation - a failure there is non-fatal: the
|
|
229
|
-
* prompt still runs and the supplementary doc is skipped with a warning.
|
|
230
|
-
*/
|
|
231
|
-
export declare function resolveMigrationForRun(root: string, migration: {
|
|
232
|
-
package: string;
|
|
233
|
-
name: string;
|
|
234
|
-
documentation?: string;
|
|
235
|
-
implementation?: string;
|
|
236
|
-
factory?: string;
|
|
237
|
-
prompt?: string;
|
|
238
|
-
}, resolveDocumentation: boolean): {
|
|
239
|
-
resolvedCollection?: {
|
|
240
|
-
collection: MigrationsJson;
|
|
241
|
-
collectionPath: string;
|
|
242
|
-
};
|
|
243
|
-
documentationPath?: string;
|
|
244
|
-
};
|
|
245
218
|
export declare function nxCliPath(nxWorkspaceRoot?: string): Promise<string>;
|