nx 24.0.0-beta.1 → 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/src/command-line/graph/graph.js +2 -1
- 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 +6 -7
- 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/migrate-analytics.d.ts +6 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +12 -0
- 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 +163 -231
- 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 +3 -3
- package/dist/src/command-line/migrate/run/index.js +5 -1
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +21 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +77 -19
- 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/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/config/nx-json.d.ts +13 -4
- package/dist/src/config/workspace-json-project-json.d.ts +12 -0
- package/dist/src/core/graph/main.js +1 -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 +32 -3
- 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/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/run-command.js +2 -2
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/task-orchestrator.d.ts +10 -6
- package/dist/src/tasks-runner/task-orchestrator.js +89 -59
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- package/dist/src/utils/plugins/core-plugins.js +4 -0
- package/package.json +12 -11
- package/schemas/nx-schema.json +28 -4
- package/schemas/project-schema.json +22 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.treeOperationLabel = exports.commitsStep = exports.MigrateCommitBroker = exports.formatElapsed = exports.COMMIT_INSTALLS_FIRST = exports.BROKER_ENV_VAR = exports.renderExistingRunReport = exports.renderExistingRunCommands = exports.renderContinueCommand = exports.runOrchestratorResume = exports.runOrchestratorReconcile = exports.runOrchestratorInit = exports.releaseRunToHandOff = exports.holdRunToContinue = exports.completionWarnings = exports.activeRunToReplace = exports.runSingleMigrationWorker = exports.pmInstallCommand = exports.createRunId = exports.hasUnresolvedIssues = exports.tallySteps = exports.stepLabel = exports.runTallies = exports.latestRound = exports.hasPendingCommitDebt = exports.completionSummaryLines = exports.applyStepEvent = exports.TERMINAL_STEP_STATUSES = exports.createRun = exports.findActiveRun = exports.writeRunState = exports.readRunState = exports.runHandoffsDir = exports.runDir = exports.migrateRunsDir = exports.NewerRunStateFormatError = exports.CURRENT_RUN_STATE_FORMAT_VERSION = void 0;
|
|
3
|
+
exports.treeOperationLabel = exports.commitsStep = exports.MigrateCommitBroker = exports.formatElapsed = exports.COMMIT_INSTALLS_FIRST = exports.BROKER_ENV_VAR = exports.renderExistingRunReport = exports.renderExistingRunCommands = exports.renderContinueCommand = exports.runOrchestratorResume = exports.runOrchestratorReconcile = exports.runOrchestratorInit = exports.releaseRunToHandOff = exports.holdRunToContinue = exports.deleteRunForStartFresh = exports.completionWarnings = exports.checkRunForStartFresh = exports.activeRunToReplace = exports.activeRunForClassic = exports.runSingleMigrationWorker = exports.pmInstallCommand = exports.createRunId = exports.hasUnresolvedIssues = exports.tallySteps = exports.stepLabel = exports.runTallies = exports.latestRound = exports.hasPendingCommitDebt = exports.completionSummaryLines = exports.applyStepEvent = exports.migrationIdProblems = exports.TERMINAL_STEP_STATUSES = exports.createRun = exports.findActiveRun = exports.writeRunState = exports.readRunState = exports.runHandoffsDir = exports.runDir = exports.migrateRunsDir = exports.NewerRunStateFormatError = exports.CURRENT_RUN_STATE_FORMAT_VERSION = void 0;
|
|
4
4
|
var run_state_1 = require("./run-state");
|
|
5
5
|
Object.defineProperty(exports, "CURRENT_RUN_STATE_FORMAT_VERSION", { enumerable: true, get: function () { return run_state_1.CURRENT_RUN_STATE_FORMAT_VERSION; } });
|
|
6
6
|
Object.defineProperty(exports, "NewerRunStateFormatError", { enumerable: true, get: function () { return run_state_1.NewerRunStateFormatError; } });
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "writeRunState", { enumerable: true, get: functio
|
|
|
12
12
|
Object.defineProperty(exports, "findActiveRun", { enumerable: true, get: function () { return run_state_1.findActiveRun; } });
|
|
13
13
|
Object.defineProperty(exports, "createRun", { enumerable: true, get: function () { return run_state_1.createRun; } });
|
|
14
14
|
Object.defineProperty(exports, "TERMINAL_STEP_STATUSES", { enumerable: true, get: function () { return run_state_1.TERMINAL_STEP_STATUSES; } });
|
|
15
|
+
Object.defineProperty(exports, "migrationIdProblems", { enumerable: true, get: function () { return run_state_1.migrationIdProblems; } });
|
|
15
16
|
var state_machine_1 = require("./state-machine");
|
|
16
17
|
Object.defineProperty(exports, "applyStepEvent", { enumerable: true, get: function () { return state_machine_1.applyStepEvent; } });
|
|
17
18
|
Object.defineProperty(exports, "completionSummaryLines", { enumerable: true, get: function () { return state_machine_1.completionSummaryLines; } });
|
|
@@ -29,8 +30,11 @@ Object.defineProperty(exports, "pmInstallCommand", { enumerable: true, get: func
|
|
|
29
30
|
var worker_1 = require("./worker");
|
|
30
31
|
Object.defineProperty(exports, "runSingleMigrationWorker", { enumerable: true, get: function () { return worker_1.runSingleMigrationWorker; } });
|
|
31
32
|
var orchestrator_1 = require("./orchestrator");
|
|
33
|
+
Object.defineProperty(exports, "activeRunForClassic", { enumerable: true, get: function () { return orchestrator_1.activeRunForClassic; } });
|
|
32
34
|
Object.defineProperty(exports, "activeRunToReplace", { enumerable: true, get: function () { return orchestrator_1.activeRunToReplace; } });
|
|
35
|
+
Object.defineProperty(exports, "checkRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.checkRunForStartFresh; } });
|
|
33
36
|
Object.defineProperty(exports, "completionWarnings", { enumerable: true, get: function () { return orchestrator_1.completionWarnings; } });
|
|
37
|
+
Object.defineProperty(exports, "deleteRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.deleteRunForStartFresh; } });
|
|
34
38
|
Object.defineProperty(exports, "holdRunToContinue", { enumerable: true, get: function () { return orchestrator_1.holdRunToContinue; } });
|
|
35
39
|
Object.defineProperty(exports, "releaseRunToHandOff", { enumerable: true, get: function () { return orchestrator_1.releaseRunToHandOff; } });
|
|
36
40
|
Object.defineProperty(exports, "runOrchestratorInit", { enumerable: true, get: function () { return orchestrator_1.runOrchestratorInit; } });
|
|
@@ -69,6 +69,27 @@ export declare function activeRunToReplace(root: string, runId: string | undefin
|
|
|
69
69
|
* exclusive one refuses while this process still holds.
|
|
70
70
|
*/
|
|
71
71
|
export declare function releaseRunToHandOff(root: string, runId: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* The active run a classic `--run-migrations` must not run over, held while
|
|
74
|
+
* the caller reports it or asks what to do; null when no run is active. Run
|
|
75
|
+
* directories that cannot be read refuse as they do for init.
|
|
76
|
+
*/
|
|
77
|
+
export declare function activeRunForClassic(root: string, plannedIds: readonly string[]): {
|
|
78
|
+
runId: string;
|
|
79
|
+
facts: ExistingRunFacts;
|
|
80
|
+
} | null;
|
|
81
|
+
/**
|
|
82
|
+
* Throws when a classic start fresh could not delete the active run `runId`.
|
|
83
|
+
* Run before the commit prompt, as init does, so the user is not asked for a
|
|
84
|
+
* run that is then refused; deleteRunForStartFresh repeats the checks.
|
|
85
|
+
*/
|
|
86
|
+
export declare function checkRunForStartFresh(root: string, runId: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Deletes the record of the active run `runId` for a classic start fresh,
|
|
89
|
+
* under the refusals init applies before it replaces a run. The classic loop
|
|
90
|
+
* records no run of its own afterwards.
|
|
91
|
+
*/
|
|
92
|
+
export declare function deleteRunForStartFresh(root: string, runId: string): void;
|
|
72
93
|
export declare function runOrchestratorReconcile(input: RunOrchestratorReconcileInput): Promise<void>;
|
|
73
94
|
/**
|
|
74
95
|
* What a completed run leaves behind for whoever reads its summary, one line
|
|
@@ -5,6 +5,9 @@ exports.runOrchestratorResume = runOrchestratorResume;
|
|
|
5
5
|
exports.holdRunToContinue = holdRunToContinue;
|
|
6
6
|
exports.activeRunToReplace = activeRunToReplace;
|
|
7
7
|
exports.releaseRunToHandOff = releaseRunToHandOff;
|
|
8
|
+
exports.activeRunForClassic = activeRunForClassic;
|
|
9
|
+
exports.checkRunForStartFresh = checkRunForStartFresh;
|
|
10
|
+
exports.deleteRunForStartFresh = deleteRunForStartFresh;
|
|
8
11
|
exports.runOrchestratorReconcile = runOrchestratorReconcile;
|
|
9
12
|
exports.completionWarnings = completionWarnings;
|
|
10
13
|
const child_process_1 = require("child_process");
|
|
@@ -42,7 +45,7 @@ const issues_1 = require("./issues");
|
|
|
42
45
|
const runbook_1 = require("./runbook");
|
|
43
46
|
const existing_run_report_1 = require("./existing-run-report");
|
|
44
47
|
const package_manager_1 = require("../../../utils/package-manager");
|
|
45
|
-
// The
|
|
48
|
+
// The migrate orchestrator: drives a durable run one dispense at a time.
|
|
46
49
|
// An outer AI agent runs each dispensed command and re-invokes `nx migrate
|
|
47
50
|
// --run-id=<id>` to reconcile; there is no long-lived process.
|
|
48
51
|
const PLAN_SNAPSHOT_0 = 'plan-0.json';
|
|
@@ -55,7 +58,11 @@ const HANG_THRESHOLD_MS = 15 * 60 * 1000;
|
|
|
55
58
|
const NO_PROGRESS_THRESHOLD = 3;
|
|
56
59
|
// Two rearms per step: one for the diagnosed fix and one for its correction.
|
|
57
60
|
const REARM_ESCALATION_CAP = 2;
|
|
58
|
-
const INIT_CONTINUE_HINT = 're-run the command, or
|
|
61
|
+
const INIT_CONTINUE_HINT = 're-run the command, or re-run it with --agentic=false to use the standard migrate flow.';
|
|
62
|
+
const ID_PROBLEM_REFUSALS = {
|
|
63
|
+
'not-shell-safe': 'contains characters that are not shell-safe. Orchestrated runs require shell-safe migration ids.',
|
|
64
|
+
duplicate: 'is listed more than once in the plan. Orchestrated runs require each migration id once.',
|
|
65
|
+
};
|
|
59
66
|
function continueRunHint(runId) {
|
|
60
67
|
return `re-run the command to continue run '${runId}'.`;
|
|
61
68
|
}
|
|
@@ -92,9 +99,7 @@ function refuseUnsafeScratchExposure(exposure, thenWhat) {
|
|
|
92
99
|
async function runOrchestratorInit(input) {
|
|
93
100
|
const { root, migrationsJson, migrationsPath, createCommits, commitPrefix, skipInstall, installedNxVersion, validate, finalValidation, emitAgentInstructions = true, onExistingRun = 'report', replaceRunId, confirmStart, } = input;
|
|
94
101
|
const migrations = (migrationsJson.migrations ?? []);
|
|
95
|
-
const sorted = (0, sort_migrations_1.sortMigrations)(migrations.slice()
|
|
96
|
-
hoistHandoffGitignore: true,
|
|
97
|
-
});
|
|
102
|
+
const sorted = (0, sort_migrations_1.sortMigrations)(migrations.slice());
|
|
98
103
|
const plannedIds = sorted.map((m) => `${m.package}:${m.name}`);
|
|
99
104
|
// An active run means a prior init already happened (e.g. it crashed before
|
|
100
105
|
// the agent's first reconcile); starting a second run would compete with it,
|
|
@@ -124,13 +129,13 @@ async function runOrchestratorInit(input) {
|
|
|
124
129
|
}
|
|
125
130
|
});
|
|
126
131
|
}
|
|
127
|
-
// Dispensed commands interpolate migration ids verbatim
|
|
128
|
-
// validates the incoming plan's ids. Before
|
|
129
|
-
// not be thrown away for a plan that cannot
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
132
|
+
// Dispensed commands interpolate migration ids verbatim and a worker finds
|
|
133
|
+
// its step by id, so every init validates the incoming plan's ids. Before
|
|
134
|
+
// the delete below: a run must not be thrown away for a plan that cannot
|
|
135
|
+
// start.
|
|
136
|
+
const [idProblem] = (0, run_state_1.migrationIdProblems)(sorted);
|
|
137
|
+
if (idProblem !== undefined) {
|
|
138
|
+
throw new Error(`The migration id '${idProblem.id}' ${ID_PROBLEM_REFUSALS[idProblem.problem]} To run the plan without orchestration, re-run with --agentic=false.`);
|
|
134
139
|
}
|
|
135
140
|
if (confirmStart && !(await confirmStart())) {
|
|
136
141
|
return { kind: 'refused' };
|
|
@@ -152,9 +157,8 @@ async function runOrchestratorInit(input) {
|
|
|
152
157
|
// Applied before the checkpoint so the entry (when it can be added) already
|
|
153
158
|
// covers older scratch by the time the checkpoint's `git add -A` runs; the
|
|
154
159
|
// fallback's standalone commit is suppressed because that checkpoint
|
|
155
|
-
// carries the edit.
|
|
156
|
-
//
|
|
157
|
-
// migration runs.
|
|
160
|
+
// carries the edit. A planned ignore migration can't be deferred to: the
|
|
161
|
+
// run dir is created below, before that migration runs.
|
|
158
162
|
await (0, handoff_gitignore_1.applyAgenticHandoffGitignoreFallback)({
|
|
159
163
|
migrations: sorted,
|
|
160
164
|
installedNxVersion,
|
|
@@ -314,11 +318,65 @@ function activeRunToReplace(root, runId) {
|
|
|
314
318
|
function releaseRunToHandOff(root, runId) {
|
|
315
319
|
(0, state_lock_1.releaseRunActivity)((0, run_state_1.runDir)(root, runId));
|
|
316
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* The active run a classic `--run-migrations` must not run over, held while
|
|
323
|
+
* the caller reports it or asks what to do; null when no run is active. Run
|
|
324
|
+
* directories that cannot be read refuse as they do for init.
|
|
325
|
+
*/
|
|
326
|
+
function activeRunForClassic(root, plannedIds) {
|
|
327
|
+
const active = findActiveRunForInit(root);
|
|
328
|
+
if (!active)
|
|
329
|
+
return null;
|
|
330
|
+
// Held before the facts are read, as init's report does.
|
|
331
|
+
(0, state_lock_1.holdRunActivity)(root, active.runId);
|
|
332
|
+
return {
|
|
333
|
+
runId: active.runId,
|
|
334
|
+
facts: (0, existing_run_report_1.collectExistingRunFacts)(root, active.runId, active.state, plannedIds),
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Throws when a classic start fresh could not delete the active run `runId`.
|
|
339
|
+
* Run before the commit prompt, as init does, so the user is not asked for a
|
|
340
|
+
* run that is then refused; deleteRunForStartFresh repeats the checks.
|
|
341
|
+
*/
|
|
342
|
+
function checkRunForStartFresh(root, runId) {
|
|
343
|
+
(0, state_lock_1.withRunCreationLock)(root, () => {
|
|
344
|
+
const active = activeRunToDelete(root, runId);
|
|
345
|
+
refuseUndeletableRun(root, runId, active.state);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Deletes the record of the active run `runId` for a classic start fresh,
|
|
350
|
+
* under the refusals init applies before it replaces a run. The classic loop
|
|
351
|
+
* records no run of its own afterwards.
|
|
352
|
+
*/
|
|
353
|
+
function deleteRunForStartFresh(root, runId) {
|
|
354
|
+
const deleted = (0, state_lock_1.withRunCreationLock)(root, () => {
|
|
355
|
+
activeRunToDelete(root, runId);
|
|
356
|
+
return deleteRunRecord(root, runId);
|
|
357
|
+
});
|
|
358
|
+
if (deleted) {
|
|
359
|
+
removeDeletedRunDir(root, runId);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// Call under the creation lock. A run that became active since the user chose
|
|
363
|
+
// is refused, never deleted in place of the one they saw.
|
|
364
|
+
function activeRunToDelete(root, runId) {
|
|
365
|
+
refuseLiveReservation(root);
|
|
366
|
+
const active = findActiveRunForInit(root, true);
|
|
367
|
+
if (!active) {
|
|
368
|
+
throw new Error(noActiveRunToReplace(runId));
|
|
369
|
+
}
|
|
370
|
+
if (active.runId !== runId) {
|
|
371
|
+
throw new Error(`Not starting fresh: migrate run '${active.runId}' became active while this command was starting. Re-run the command to see it.`);
|
|
372
|
+
}
|
|
373
|
+
return active;
|
|
374
|
+
}
|
|
317
375
|
// Reads the newest active run; null when no run is active. Uninterpretable
|
|
318
376
|
// run dirs refuse a fresh start (one of them could be an active run this
|
|
319
|
-
//
|
|
320
|
-
// unless `refuseUninterpretable`: a start-fresh would delete that run
|
|
321
|
-
// then find only the unreadable ones. NewerRunStateFormatError propagates
|
|
377
|
+
// invocation would compete with) but only warn when a healthy active run is
|
|
378
|
+
// found, unless `refuseUninterpretable`: a start-fresh would delete that run
|
|
379
|
+
// and then find only the unreadable ones. NewerRunStateFormatError propagates
|
|
322
380
|
// from the read.
|
|
323
381
|
function findActiveRunForInit(root, refuseUninterpretable = false) {
|
|
324
382
|
const { active, uninterpretable } = (0, run_state_1.findActiveRun)(root);
|
|
@@ -331,7 +389,7 @@ function findActiveRunForInit(root, refuseUninterpretable = false) {
|
|
|
331
389
|
const details = uninterpretable.map((u) => `${types_1.MIGRATE_RUNS_RELATIVE_DIR}/${(0, text_1.singleLine)(u.dirName)}: ${(0, text_1.singleLine)(u.reason)}`);
|
|
332
390
|
if (!active || refuseUninterpretable) {
|
|
333
391
|
throw new Error([
|
|
334
|
-
`Whether a migrate run is still active could not be determined;
|
|
392
|
+
`Whether a migrate run is still active could not be determined; running the plan could re-apply migrations an unfinished run already applied.`,
|
|
335
393
|
...details,
|
|
336
394
|
`Fix or remove the listed ${noun}, then re-run the command.`,
|
|
337
395
|
].join('\n'));
|
|
@@ -9,6 +9,19 @@ export declare const RUN_STATE_FILE_NAME = "run.json";
|
|
|
9
9
|
* with fails closed as corrupt instead of being dispensed.
|
|
10
10
|
*/
|
|
11
11
|
export declare const SHELL_SAFE_VALUE: RegExp;
|
|
12
|
+
export type MigrationIdProblem = 'not-shell-safe' | 'duplicate';
|
|
13
|
+
/**
|
|
14
|
+
* The ids of `migrations` that no orchestrated run can take, each once, in the
|
|
15
|
+
* order found. A worker finds its step by migration id, so an id the plan
|
|
16
|
+
* lists twice can't name one step.
|
|
17
|
+
*/
|
|
18
|
+
export declare function migrationIdProblems(migrations: ReadonlyArray<{
|
|
19
|
+
package: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}>): {
|
|
22
|
+
id: string;
|
|
23
|
+
problem: MigrationIdProblem;
|
|
24
|
+
}[];
|
|
12
25
|
export declare const ISSUE_ID: RegExp;
|
|
13
26
|
declare const MIGRATE_RUN_STATUSES: readonly ['active', 'completed'];
|
|
14
27
|
export type MigrateRunStatus = (typeof MIGRATE_RUN_STATUSES)[number];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NewerRunStateFormatError = exports.TREE_OPERATION_KINDS = exports.MIGRATE_ISSUE_DISPOSITIONS = exports.TERMINAL_STEP_STATUSES = exports.ISSUE_ID = exports.SHELL_SAFE_VALUE = exports.RUN_STATE_FILE_NAME = exports.CURRENT_RUN_STATE_FORMAT_VERSION = void 0;
|
|
4
|
+
exports.migrationIdProblems = migrationIdProblems;
|
|
4
5
|
exports.issueFingerprint = issueFingerprint;
|
|
5
6
|
exports.migrateRunsDir = migrateRunsDir;
|
|
6
7
|
exports.runDir = runDir;
|
|
@@ -32,6 +33,26 @@ exports.RUN_STATE_FILE_NAME = 'run.json';
|
|
|
32
33
|
* with fails closed as corrupt instead of being dispensed.
|
|
33
34
|
*/
|
|
34
35
|
exports.SHELL_SAFE_VALUE = /^[A-Za-z0-9@/:._-]+$/;
|
|
36
|
+
/**
|
|
37
|
+
* The ids of `migrations` that no orchestrated run can take, each once, in the
|
|
38
|
+
* order found. A worker finds its step by migration id, so an id the plan
|
|
39
|
+
* lists twice can't name one step.
|
|
40
|
+
*/
|
|
41
|
+
function migrationIdProblems(migrations) {
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
const problems = new Map();
|
|
44
|
+
for (const m of migrations) {
|
|
45
|
+
const id = `${m.package}:${m.name}`;
|
|
46
|
+
if (!exports.SHELL_SAFE_VALUE.test(id)) {
|
|
47
|
+
problems.set(id, 'not-shell-safe');
|
|
48
|
+
}
|
|
49
|
+
else if (seen.has(id) && !problems.has(id)) {
|
|
50
|
+
problems.set(id, 'duplicate');
|
|
51
|
+
}
|
|
52
|
+
seen.add(id);
|
|
53
|
+
}
|
|
54
|
+
return [...problems].map(([id, problem]) => ({ id, problem }));
|
|
55
|
+
}
|
|
35
56
|
// `new Date().toISOString()`, the only shape Nx writes. Retention and active-run
|
|
36
57
|
// selection compare these lexicographically, and the value is rendered into the
|
|
37
58
|
// stdout the agent scans for blocks, so neither a different notation nor an
|
|
@@ -5,12 +5,6 @@ interface SortableMigration {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Sorts in place (like `Array.prototype.sort`) and returns the same array.
|
|
8
|
-
*
|
|
9
|
-
* `hoistHandoffGitignore` is set for agentic runs, which write scratch under
|
|
10
|
-
* `.nx/migrate-runs`; see `agentic/handoff-gitignore.ts` for why the v23
|
|
11
|
-
* gitignore migration must run first there.
|
|
12
8
|
*/
|
|
13
|
-
export declare function sortMigrations<T extends SortableMigration>(migrations: T[]
|
|
14
|
-
hoistHandoffGitignore: boolean;
|
|
15
|
-
}): T[];
|
|
9
|
+
export declare function sortMigrations<T extends SortableMigration>(migrations: T[]): T[];
|
|
16
10
|
export {};
|
|
@@ -2,23 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sortMigrations = sortMigrations;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
|
-
const types_1 = require("./agentic/types");
|
|
6
5
|
const version_utils_1 = require("./version-utils");
|
|
7
6
|
/**
|
|
8
7
|
* Sorts in place (like `Array.prototype.sort`) and returns the same array.
|
|
9
|
-
*
|
|
10
|
-
* `hoistHandoffGitignore` is set for agentic runs, which write scratch under
|
|
11
|
-
* `.nx/migrate-runs`; see `agentic/handoff-gitignore.ts` for why the v23
|
|
12
|
-
* gitignore migration must run first there.
|
|
13
8
|
*/
|
|
14
|
-
function sortMigrations(migrations
|
|
9
|
+
function sortMigrations(migrations) {
|
|
15
10
|
return migrations.sort((a, b) => {
|
|
16
|
-
if (opts.hoistHandoffGitignore) {
|
|
17
|
-
if ((0, types_1.isHandoffGitignoreMigration)(a))
|
|
18
|
-
return -1;
|
|
19
|
-
if ((0, types_1.isHandoffGitignoreMigration)(b))
|
|
20
|
-
return 1;
|
|
21
|
-
}
|
|
22
11
|
if (a.name === '15-7-0-split-configuration-into-project-json-files') {
|
|
23
12
|
return -1;
|
|
24
13
|
}
|
|
@@ -711,7 +711,9 @@ export interface NxSyncConfiguration {
|
|
|
711
711
|
export interface NxMigrateConfiguration {
|
|
712
712
|
/**
|
|
713
713
|
* Whether to automatically create a git commit after each migration runs.
|
|
714
|
-
* Equivalent to the `--create-commits` flag. Defaults to `
|
|
714
|
+
* Equivalent to the `--create-commits` flag. Defaults to `true` when the
|
|
715
|
+
* agentic flow runs the migrations in a Git repository, and `false`
|
|
716
|
+
* otherwise.
|
|
715
717
|
*/
|
|
716
718
|
createCommits?: boolean;
|
|
717
719
|
/**
|
|
@@ -753,11 +755,18 @@ export interface NxMigrateConfiguration {
|
|
|
753
755
|
*/
|
|
754
756
|
agentic?: boolean | AgentId;
|
|
755
757
|
/**
|
|
756
|
-
* Whether
|
|
757
|
-
*
|
|
758
|
-
*
|
|
758
|
+
* Whether the AI agent driving a migrate run reviews the changes of
|
|
759
|
+
* generator-only migrations. Equivalent to the `--validate` flag. Defaults to
|
|
760
|
+
* `true`.
|
|
759
761
|
*/
|
|
760
762
|
validate?: boolean;
|
|
763
|
+
/**
|
|
764
|
+
* Whether a migrate run an AI agent drives ends with a final check, where the
|
|
765
|
+
* agent makes sure the projects the run touched still lint, build, and pass
|
|
766
|
+
* their unit tests. Equivalent to the `--final-validation` flag. Defaults to
|
|
767
|
+
* `true`.
|
|
768
|
+
*/
|
|
769
|
+
finalValidation?: boolean;
|
|
761
770
|
}
|
|
762
771
|
/**
|
|
763
772
|
* Nx.json configuration
|
|
@@ -247,21 +247,33 @@ export interface TargetDependencyConfig {
|
|
|
247
247
|
*/
|
|
248
248
|
waitFor?: 'started' | 'ready';
|
|
249
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* `always`: the files the input resolves to stay in the hash even when the task
|
|
252
|
+
* is hashed from its ultracache recording.
|
|
253
|
+
* `dependencies` with `projects`: the selected projects' dependencies (as `^input`
|
|
254
|
+
* resolves for each), not the projects themselves.
|
|
255
|
+
*/
|
|
250
256
|
export type InputDefinition = {
|
|
251
257
|
input: string;
|
|
252
258
|
projects: string | string[];
|
|
259
|
+
dependencies?: boolean;
|
|
260
|
+
always?: boolean;
|
|
253
261
|
} | {
|
|
254
262
|
input: string;
|
|
255
263
|
dependencies: true;
|
|
264
|
+
always?: boolean;
|
|
256
265
|
} | {
|
|
257
266
|
input: string;
|
|
267
|
+
always?: boolean;
|
|
258
268
|
} | {
|
|
259
269
|
fileset: string;
|
|
260
270
|
includeIgnored?: boolean;
|
|
271
|
+
always?: boolean;
|
|
261
272
|
} | {
|
|
262
273
|
fileset: string;
|
|
263
274
|
dependencies: true;
|
|
264
275
|
includeIgnored?: boolean;
|
|
276
|
+
always?: boolean;
|
|
265
277
|
} | {
|
|
266
278
|
runtime: string;
|
|
267
279
|
} | {
|