nx 24.0.0-beta.2 → 24.0.0-beta.4
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/post-install.js +5 -3
- package/dist/src/adapter/ngcli-adapter.js +1 -2
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -41
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -48
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +63 -36
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +7 -5
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +35 -5
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +5 -5
- package/dist/src/command-line/migrate/command-object.js +3 -3
- package/dist/src/command-line/migrate/execute-migration.d.ts +4 -4
- package/dist/src/command-line/migrate/execute-migration.js +7 -5
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +12 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +26 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +9 -10
- package/dist/src/command-line/migrate/migrate-commits.js +25 -18
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.d.ts +3 -0
- package/dist/src/command-line/migrate/migrate.js +77 -44
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +4 -0
- package/dist/src/command-line/migrate/run/broker.js +1 -1
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +2 -1
- package/dist/src/command-line/migrate/run/index.js +5 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +40 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +233 -92
- package/dist/src/command-line/migrate/run/run-state.d.ts +4 -1
- package/dist/src/command-line/migrate/run/run-state.js +20 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +99 -21
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/util.d.ts +4 -2
- package/dist/src/command-line/migrate/run/util.js +23 -2
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +6 -0
- package/dist/src/config/nx-json.d.ts +8 -5
- package/dist/src/config/workspace-json-project-json.d.ts +23 -12
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/runtime.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/devkit-exports.d.ts +8 -0
- package/dist/src/devkit-exports.js +12 -1
- package/dist/src/devkit-internals.d.ts +2 -1
- package/dist/src/devkit-internals.js +7 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +20 -10
- package/dist/src/executors/run-commands/running-tasks.d.ts +12 -3
- package/dist/src/executors/run-commands/running-tasks.js +22 -18
- package/dist/src/hasher/check-task-files.js +1 -4
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +7 -6
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/index.d.ts +11 -5
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -3
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +6 -5
- package/dist/src/project-graph/affected/affected-tasks.js +16 -6
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +49 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +7 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/tasks-runner/pseudo-ipc.d.ts +1 -0
- package/dist/src/tasks-runner/pseudo-ipc.js +4 -0
- package/dist/src/tasks-runner/readiness/probes.d.ts +6 -1
- package/dist/src/tasks-runner/readiness/probes.js +41 -2
- package/dist/src/tasks-runner/readiness/ready-signal-server.d.ts +18 -0
- package/dist/src/tasks-runner/readiness/ready-signal-server.js +71 -0
- package/dist/src/tasks-runner/readiness/ready-signal.d.ts +25 -0
- package/dist/src/tasks-runner/readiness/ready-signal.js +70 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +35 -10
- package/dist/src/tasks-runner/readiness/ready-when.js +197 -42
- package/dist/src/tasks-runner/readiness/startup-host.d.ts +1 -0
- package/dist/src/tasks-runner/readiness/startup-host.js +32 -0
- package/dist/src/tasks-runner/task-env.js +11 -0
- package/dist/src/tasks-runner/task-orchestrator.d.ts +8 -0
- package/dist/src/tasks-runner/task-orchestrator.js +152 -42
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +15 -1
- package/dist/src/tasks-runner/utils.js +79 -33
- package/dist/src/ultracache/config.d.ts +3 -3
- package/dist/src/ultracache/config.js +4 -4
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/migrations.json +13 -6
- package/package.json +11 -11
- package/schemas/migrations-schema.json +11 -0
- package/schemas/nx-schema.json +24 -13
- package/schemas/project-schema.json +15 -9
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
|
@@ -20,22 +20,38 @@ 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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const AGENT_SESSION_NO_INPUT = "Commits in this session cannot ask for input, such as a signing passphrase or a hook's prompt";
|
|
24
|
+
function commitFailureGuidance(recovery, inAgentSession) {
|
|
25
|
+
switch (recovery) {
|
|
26
|
+
case 'later-step':
|
|
27
|
+
// Without the session half, the agent continues as the absorb guidance
|
|
28
|
+
// says, and a cause that fails every commit leaves the run uncommitted.
|
|
29
|
+
return `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.${inAgentSession
|
|
30
|
+
? ` ${AGENT_SESSION_NO_INPUT}, 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.`
|
|
31
|
+
: ''}`;
|
|
32
|
+
case 'manual':
|
|
33
|
+
return `Commit or revert any remaining uncommitted changes manually.${inAgentSession
|
|
34
|
+
? ` ${AGENT_SESSION_NO_INPUT}. Tell the user what failed.`
|
|
35
|
+
: ''}`;
|
|
36
|
+
default: {
|
|
37
|
+
const unhandled = recovery;
|
|
38
|
+
throw new Error(`Unhandled commit failure recovery: ${unhandled}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
26
42
|
/**
|
|
27
43
|
* `pendingMigrations` are listed in the commit body so a `git log -p` reader
|
|
28
44
|
* can see which earlier migrations' diffs this commit absorbed (their own
|
|
29
45
|
* commits failed and `git add -A` picked their working-tree state up too).
|
|
30
46
|
*
|
|
31
|
-
*
|
|
32
|
-
* behavior
|
|
33
|
-
*
|
|
47
|
+
* `recovery` picks the failure guidance: the default describes the classic
|
|
48
|
+
* loop's absorb-and-recap behavior, and a caller with no later migration step
|
|
49
|
+
* (a `--run-migration` run) passes 'manual'.
|
|
34
50
|
*
|
|
35
51
|
* A `sink` collects the output for a caller sharing the terminal with an
|
|
36
52
|
* agent, and the commit then runs without the terminal.
|
|
37
53
|
*/
|
|
38
|
-
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [],
|
|
54
|
+
async function commitMigrationIfRequested(root, migration, shouldCreateCommits, commitPrefix, installDepsIfChanged, pendingMigrations = [], recovery = 'later-step', sink) {
|
|
39
55
|
if (!shouldCreateCommits)
|
|
40
56
|
return { status: 'disabled' };
|
|
41
57
|
const out = sink ?? deferred_output_1.terminalOutput;
|
|
@@ -59,7 +75,7 @@ async function commitMigrationIfRequested(root, migration, shouldCreateCommits,
|
|
|
59
75
|
}
|
|
60
76
|
catch (err) {
|
|
61
77
|
const reason = err instanceof Error ? err.message : String(err);
|
|
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. ${
|
|
78
|
+
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. ${commitFailureGuidance(recovery, sink !== undefined)}`);
|
|
63
79
|
return { status: 'failed', reason };
|
|
64
80
|
}
|
|
65
81
|
}
|
|
@@ -120,11 +136,6 @@ function commitCheckpointBeforeMigrations(root, commitPrefix) {
|
|
|
120
136
|
});
|
|
121
137
|
}
|
|
122
138
|
}
|
|
123
|
-
/**
|
|
124
|
-
* `agenticHasDiffContext` gates the agent prompt: without per-migration commits
|
|
125
|
-
* to isolate a migration's diff, the prompt embeds a file list instead of
|
|
126
|
-
* pointing at git.
|
|
127
|
-
*/
|
|
128
139
|
function resolveCreateCommits(args) {
|
|
129
140
|
const { createCommits, mode, isGitRepo, commitPrefixIsCustom } = args;
|
|
130
141
|
// The orchestrator forces the agentic defaults without the `--agentic` flag,
|
|
@@ -134,7 +145,6 @@ function resolveCreateCommits(args) {
|
|
|
134
145
|
if (createCommits === true && !isGitRepo) {
|
|
135
146
|
return {
|
|
136
147
|
effective: false,
|
|
137
|
-
agenticHasDiffContext: false,
|
|
138
148
|
error: '`--create-commits` requires a git repository. Run `git init` first, or omit the flag.',
|
|
139
149
|
};
|
|
140
150
|
}
|
|
@@ -142,7 +152,6 @@ function resolveCreateCommits(args) {
|
|
|
142
152
|
if (createCommits === false) {
|
|
143
153
|
return {
|
|
144
154
|
effective: false,
|
|
145
|
-
agenticHasDiffContext: false,
|
|
146
155
|
warning: (orchestrated
|
|
147
156
|
? "--no-create-commits was passed, but orchestrated migrate runs create per-migration commits by default. Without them, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review."
|
|
148
157
|
: "--no-create-commits was passed alongside --agentic. Without per-migration commits, the agent can't isolate the current migration's changes from earlier migrations in this run. Drop --no-create-commits for accurate per-migration review.") +
|
|
@@ -156,7 +165,6 @@ function resolveCreateCommits(args) {
|
|
|
156
165
|
if (!isGitRepo) {
|
|
157
166
|
return {
|
|
158
167
|
effective: false,
|
|
159
|
-
agenticHasDiffContext: false,
|
|
160
168
|
warning: (orchestrated
|
|
161
169
|
? 'Orchestrated migrate runs create per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.'
|
|
162
170
|
: '`--agentic` enables per-migration commits by default, but the workspace is not a git repository. Continuing without commits, so the agent will not receive per-file diff context. Run `git init` to enable.') +
|
|
@@ -165,11 +173,10 @@ function resolveCreateCommits(args) {
|
|
|
165
173
|
: ''),
|
|
166
174
|
};
|
|
167
175
|
}
|
|
168
|
-
return { effective: true
|
|
176
|
+
return { effective: true };
|
|
169
177
|
}
|
|
170
178
|
return {
|
|
171
179
|
effective: createCommits === true,
|
|
172
|
-
agenticHasDiffContext: false,
|
|
173
180
|
warning: commitPrefixIsCustom && createCommits !== true
|
|
174
181
|
? 'A custom migrate commit prefix is configured, but commits are not enabled for this run, so it has no effect. Set `migrate.createCommits` to `true` (or pass `--create-commits`) to create a commit per migration.'
|
|
175
182
|
: undefined,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
3
3
|
* the single-migration worker). Shared glyph vocabulary:
|
|
4
|
-
* `→` start,
|
|
4
|
+
* `→` start, `↷` skipped, `ℹ` info, `─` boundary
|
|
5
5
|
*
|
|
6
6
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
7
7
|
* stays decoupled from the migration executor in migrate.ts.
|
|
@@ -18,11 +18,6 @@ export declare function resetSgrAfterAgent(): void;
|
|
|
18
18
|
* each migration with the migration index and identity.
|
|
19
19
|
*/
|
|
20
20
|
export declare function logMigrationBoundary(index: number, total: number, pkg: string, name: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Logs the outcome line that closes an agentic phase. Vocabulary:
|
|
23
|
-
* ✓ <label>[ (<sha>)]: <summary>
|
|
24
|
-
*/
|
|
25
|
-
export declare function logAgenticSuccessOutcome(label: string, sha: string | null, summary: string): void;
|
|
26
21
|
/**
|
|
27
22
|
* Callers must already know an agentic step was owed; this only picks which one
|
|
28
23
|
* the waiver dropped. The dropped-`agentContext` note is aimed at the migration
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resetSgrAfterAgent = resetSgrAfterAgent;
|
|
4
4
|
exports.logMigrationBoundary = logMigrationBoundary;
|
|
5
|
-
exports.logAgenticSuccessOutcome = logAgenticSuccessOutcome;
|
|
6
5
|
exports.logWaivedAgenticStep = logWaivedAgenticStep;
|
|
7
6
|
exports.countLandedCommits = countLandedCommits;
|
|
8
7
|
exports.countWaivedAgenticSteps = countWaivedAgenticSteps;
|
|
@@ -19,7 +18,7 @@ const migration_shape_1 = require("./migration-shape");
|
|
|
19
18
|
/**
|
|
20
19
|
* Pure presentation helpers for the migrate run phase (`--run-migrations` and
|
|
21
20
|
* the single-migration worker). Shared glyph vocabulary:
|
|
22
|
-
* `→` start,
|
|
21
|
+
* `→` start, `↷` skipped, `ℹ` info, `─` boundary
|
|
23
22
|
*
|
|
24
23
|
* Inputs are typed structurally (e.g. `{ name: string }[]`) so this module
|
|
25
24
|
* stays decoupled from the migration executor in migrate.ts.
|
|
@@ -43,14 +42,6 @@ function logMigrationBoundary(index, total, pkg, name) {
|
|
|
43
42
|
const dashes = Math.max(3, targetWidth - label.length);
|
|
44
43
|
logger_1.logger.info(`${label}${'─'.repeat(dashes)}`);
|
|
45
44
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Logs the outcome line that closes an agentic phase. Vocabulary:
|
|
48
|
-
* ✓ <label>[ (<sha>)]: <summary>
|
|
49
|
-
*/
|
|
50
|
-
function logAgenticSuccessOutcome(label, sha, summary) {
|
|
51
|
-
const shaPart = sha ? ` (${sha})` : '';
|
|
52
|
-
logger_1.logger.info(`${pc.green('✓')} ${label}${shaPart}: ${summary}`);
|
|
53
|
-
}
|
|
54
45
|
/**
|
|
55
46
|
* Callers must already know an agentic step was owed; this only picks which one
|
|
56
47
|
* the waiver dropped. The dropped-`agentContext` note is aimed at the migration
|
|
@@ -81,6 +81,7 @@ export declare class Migrator {
|
|
|
81
81
|
prompt?: string;
|
|
82
82
|
requires?: Record<string, string>;
|
|
83
83
|
documentation?: string;
|
|
84
|
+
optionalUpdate?: boolean;
|
|
84
85
|
package: string;
|
|
85
86
|
name: string;
|
|
86
87
|
}[];
|
|
@@ -111,6 +112,8 @@ export declare class Migrator {
|
|
|
111
112
|
private addPackageUpdate;
|
|
112
113
|
private areRequirementsMet;
|
|
113
114
|
private areIncompatiblePackagesPresent;
|
|
115
|
+
private shouldCollectMigration;
|
|
116
|
+
private areRequirementsMetAfterUpdates;
|
|
114
117
|
private areMigrationRequirementsMet;
|
|
115
118
|
private isMigrationForHigherVersionThanWhatIsInstalled;
|
|
116
119
|
private wasMigrationSkipped;
|
|
@@ -153,8 +153,8 @@ class Migrator {
|
|
|
153
153
|
addToPackageJson: false,
|
|
154
154
|
});
|
|
155
155
|
await this.applyPendingPackageJsonUpdates();
|
|
156
|
-
this.applyIncludeFilter();
|
|
157
|
-
const { migrations, promptContents } = await this.createMigrateJson();
|
|
156
|
+
const requiredPackageUpdates = this.applyIncludeFilter();
|
|
157
|
+
const { migrations, promptContents } = await this.createMigrateJson(requiredPackageUpdates);
|
|
158
158
|
return {
|
|
159
159
|
packageUpdates: this.packageUpdates,
|
|
160
160
|
migrations,
|
|
@@ -162,17 +162,10 @@ class Migrator {
|
|
|
162
162
|
minVersionWithSkippedUpdates: this.minVersionWithSkippedUpdates,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
async createMigrateJson() {
|
|
165
|
+
async createMigrateJson(requiredPackageUpdates) {
|
|
166
166
|
const promptContents = {};
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
return [];
|
|
170
|
-
}
|
|
171
|
-
const currentVersion = this.getPkgVersion(packageName);
|
|
172
|
-
if (currentVersion === null)
|
|
173
|
-
return [];
|
|
174
|
-
const { version } = this.packageUpdates[packageName];
|
|
175
|
-
const { generators: migrationEntries, resolvedPromptFiles } = await this.fetchMigrationConfig(packageName, version);
|
|
167
|
+
const collect = async (packageName, metadataVersion, fromVersion, toVersion) => {
|
|
168
|
+
const { generators: migrationEntries, resolvedPromptFiles } = await this.fetchMigrationConfig(packageName, metadataVersion);
|
|
176
169
|
if (!migrationEntries)
|
|
177
170
|
return [];
|
|
178
171
|
if (resolvedPromptFiles) {
|
|
@@ -182,15 +175,34 @@ class Migrator {
|
|
|
182
175
|
}
|
|
183
176
|
return Object.entries(migrationEntries)
|
|
184
177
|
.filter(([, migration]) => migration.version &&
|
|
185
|
-
this.gt(migration.version,
|
|
186
|
-
this.lte(migration.version,
|
|
187
|
-
this.
|
|
178
|
+
this.gt(migration.version, fromVersion) &&
|
|
179
|
+
this.lte(migration.version, toVersion) &&
|
|
180
|
+
this.shouldCollectMigration(packageName, migration))
|
|
188
181
|
.map(([migrationName, migration]) => ({
|
|
189
182
|
...migration,
|
|
190
183
|
package: packageName,
|
|
191
184
|
name: migrationName,
|
|
192
185
|
}));
|
|
193
|
-
}
|
|
186
|
+
};
|
|
187
|
+
const migrations = await Promise.all([
|
|
188
|
+
...Object.entries(this.packageUpdates).map(async ([packageName, { version, ignoreMigrations }]) => {
|
|
189
|
+
if (ignoreMigrations)
|
|
190
|
+
return [];
|
|
191
|
+
const currentVersion = this.getPkgVersion(packageName);
|
|
192
|
+
if (currentVersion === null)
|
|
193
|
+
return [];
|
|
194
|
+
return collect(packageName, version, currentVersion, version);
|
|
195
|
+
}),
|
|
196
|
+
// The optional pass keeps required packages at their installed version,
|
|
197
|
+
// and the runner resolves migrations from there. An older target caps the
|
|
198
|
+
// range.
|
|
199
|
+
...Object.entries(requiredPackageUpdates).map(async ([packageName, { version, ignoreMigrations }]) => {
|
|
200
|
+
const installedVersion = this.getInstalledPackageVersion(packageName);
|
|
201
|
+
if (ignoreMigrations || !installedVersion)
|
|
202
|
+
return [];
|
|
203
|
+
return collect(packageName, installedVersion, '0.0.0', this.lt(version, installedVersion) ? version : installedVersion);
|
|
204
|
+
}),
|
|
205
|
+
]);
|
|
194
206
|
return { migrations: migrations.flat(), promptContents };
|
|
195
207
|
}
|
|
196
208
|
async buildPackageJsonUpdates(targetPackage, target) {
|
|
@@ -432,8 +444,9 @@ class Migrator {
|
|
|
432
444
|
return false;
|
|
433
445
|
}
|
|
434
446
|
applyIncludeFilter() {
|
|
447
|
+
const requiredPackageUpdates = {};
|
|
435
448
|
if (this.include !== 'optional') {
|
|
436
|
-
return;
|
|
449
|
+
return requiredPackageUpdates;
|
|
437
450
|
}
|
|
438
451
|
// Cascade walks through the required packages so cross-plugin optional
|
|
439
452
|
// deps (e.g. typescript managed by @nx/js but used by @nx/angular) get
|
|
@@ -441,9 +454,11 @@ class Migrator {
|
|
|
441
454
|
// optional updates land in package.json.
|
|
442
455
|
for (const name of Object.keys(this.packageUpdates)) {
|
|
443
456
|
if (this.requiredPackages.has(name)) {
|
|
457
|
+
requiredPackageUpdates[name] = this.packageUpdates[name];
|
|
444
458
|
delete this.packageUpdates[name];
|
|
445
459
|
}
|
|
446
460
|
}
|
|
461
|
+
return requiredPackageUpdates;
|
|
447
462
|
}
|
|
448
463
|
shouldApplyPackageUpdate(packageUpdate, packageName, dependencies) {
|
|
449
464
|
return ((!packageUpdate.ifPackageInstalled ||
|
|
@@ -493,6 +508,35 @@ class Migrator {
|
|
|
493
508
|
}));
|
|
494
509
|
});
|
|
495
510
|
}
|
|
511
|
+
shouldCollectMigration(packageName, migration) {
|
|
512
|
+
if (this.include === 'required') {
|
|
513
|
+
return (migration.optionalUpdate !== true &&
|
|
514
|
+
this.areMigrationRequirementsMet(packageName, migration));
|
|
515
|
+
}
|
|
516
|
+
if (this.include === 'optional' &&
|
|
517
|
+
this.requiredPackages.has(packageName)) {
|
|
518
|
+
// Every past migration of a required package is in range here. Collect
|
|
519
|
+
// only those that apply an optional update or were skipped.
|
|
520
|
+
return ((migration.optionalUpdate === true ||
|
|
521
|
+
this.wasMigrationSkipped(migration.requires)) &&
|
|
522
|
+
this.areRequirementsMetAfterUpdates(migration.requires));
|
|
523
|
+
}
|
|
524
|
+
return this.areMigrationRequirementsMet(packageName, migration);
|
|
525
|
+
}
|
|
526
|
+
// Counts only updates above the installed version. The optional walk also
|
|
527
|
+
// collects stale pins below it, which are never written.
|
|
528
|
+
areRequirementsMetAfterUpdates(requirements) {
|
|
529
|
+
return Object.entries(requirements ?? {}).every(([pkgName, versionRange]) => {
|
|
530
|
+
const installedVersion = this.getInstalledPackageVersion(pkgName);
|
|
531
|
+
const update = this.packageUpdates[pkgName];
|
|
532
|
+
const version = update &&
|
|
533
|
+
(!installedVersion || this.gt(update.version, installedVersion))
|
|
534
|
+
? cleanSemver(update.version)
|
|
535
|
+
: installedVersion;
|
|
536
|
+
return (!!version &&
|
|
537
|
+
(0, semver_1.satisfies)(version, versionRange, { includePrerelease: true }));
|
|
538
|
+
});
|
|
539
|
+
}
|
|
496
540
|
areMigrationRequirementsMet(packageName, migration) {
|
|
497
541
|
if (!this.excludeAppliedMigrations) {
|
|
498
542
|
return this.areRequirementsMet(migration.requires);
|
|
@@ -2009,15 +2053,11 @@ agentic) {
|
|
|
2009
2053
|
};
|
|
2010
2054
|
}
|
|
2011
2055
|
const CONTINUE_NEEDS_ORCHESTRATION = `'--run-id' continues an orchestrated migrate run, and this invocation is not orchestrated. Orchestration needs an enabled agent, or an AI agent running nx outside CI; --agentic=false and the WASM build turn it off.`;
|
|
2012
|
-
const ID_PROBLEM_LABELS = {
|
|
2013
|
-
'not-shell-safe': 'not shell-safe',
|
|
2014
|
-
duplicate: 'listed more than once',
|
|
2015
|
-
};
|
|
2016
2056
|
// The classic loop records no run, so it must not run over an active one. The
|
|
2017
2057
|
// run is reported or asked about before the default-branch prompt; a start
|
|
2018
2058
|
// fresh is checked there too, and the caller deletes the run only after it.
|
|
2019
2059
|
async function settleActiveRunForClassic(root, opts, migrations) {
|
|
2020
|
-
const { activeRunForClassic, checkRunForStartFresh, renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } = require('./run');
|
|
2060
|
+
const { activeRunForClassic, checkRunForStartFresh, isHeld, renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } = require('./run');
|
|
2021
2061
|
const active = activeRunForClassic(root, migrations.map((m) => `${m.package}:${m.name}`));
|
|
2022
2062
|
// With no active run left, the check refuses as init does: the run
|
|
2023
2063
|
// completed after the pre-install check, so its plan already ran.
|
|
@@ -2032,7 +2072,7 @@ async function settleActiveRunForClassic(root, opts, migrations) {
|
|
|
2032
2072
|
const { runId, facts } = active;
|
|
2033
2073
|
// Start fresh refuses while another process holds the run, so a held run
|
|
2034
2074
|
// leaves nothing to ask; an agent cannot answer a prompt.
|
|
2035
|
-
const held = facts.otherHolders
|
|
2075
|
+
const held = isHeld(facts.otherHolders);
|
|
2036
2076
|
if (opts.startFresh !== true &&
|
|
2037
2077
|
!held &&
|
|
2038
2078
|
(0, safe_prompt_1.canPrompt)(opts.interactive) &&
|
|
@@ -2111,6 +2151,12 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2111
2151
|
const { activeRunToReplace } = require('./run');
|
|
2112
2152
|
activeRunToReplace(root, opts.runId);
|
|
2113
2153
|
}
|
|
2154
|
+
else {
|
|
2155
|
+
// Before the install as well: it would act on the in-progress edits of a
|
|
2156
|
+
// live run that init wouldn't report.
|
|
2157
|
+
const { refuseNewRunAlongsideLiveRun } = require('./run');
|
|
2158
|
+
refuseNewRunAlongsideLiveRun(root);
|
|
2159
|
+
}
|
|
2114
2160
|
if (!shouldSkipInstall && !process.env.NX_MIGRATE_SKIP_INSTALL) {
|
|
2115
2161
|
// The run must resume while the cause of a step's failed install persists.
|
|
2116
2162
|
const failedInstallSteps = continued?.steps.filter((s) => s.installFailed === true) ?? [];
|
|
@@ -2200,7 +2246,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2200
2246
|
const idProblems = isContinue || opts.startFresh === true
|
|
2201
2247
|
? []
|
|
2202
2248
|
: require('./run').migrationIdProblems(migrations);
|
|
2203
|
-
const
|
|
2249
|
+
const { dropUnsupportedAgent, idProblemLines, resolveAgentic } = require('./agentic/select');
|
|
2204
2250
|
// An outer agent drives the loop, so hand off to the orchestrator instead of
|
|
2205
2251
|
// the classic loop: init starts a fresh run or reports an already-active
|
|
2206
2252
|
// one; `--run-id` continues that run. Bare `--run-id` reconciles are
|
|
@@ -2270,7 +2316,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2270
2316
|
output_1.output.warn({
|
|
2271
2317
|
title: 'Running the migrations without an orchestrated run: orchestrated runs need each migration id to be shell-safe (letters, digits and @/:._-) and listed once, and these are not:',
|
|
2272
2318
|
bodyLines: [
|
|
2273
|
-
...idProblemLines,
|
|
2319
|
+
...idProblemLines(idProblems),
|
|
2274
2320
|
'No run is recorded, so --run-id cannot continue this one. Prompt work is listed as next steps for the AI agent driving this run, and no validation runs.',
|
|
2275
2321
|
],
|
|
2276
2322
|
});
|
|
@@ -2279,7 +2325,6 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2279
2325
|
createCommits: shouldCreateCommits ?? false,
|
|
2280
2326
|
migrationCount: migrations.length,
|
|
2281
2327
|
});
|
|
2282
|
-
const { resolveAgentic } = require('./agentic/select');
|
|
2283
2328
|
let agentic;
|
|
2284
2329
|
try {
|
|
2285
2330
|
agentic = await resolveAgentic({
|
|
@@ -2293,23 +2338,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2293
2338
|
throw e;
|
|
2294
2339
|
}
|
|
2295
2340
|
// Resolved before the commit policy, which defaults on only for an agent.
|
|
2296
|
-
|
|
2297
|
-
output_1.output.warn({
|
|
2298
|
-
title: 'Skipping the agentic flow: it needs the native nx binary, and this run loaded the WASM build.',
|
|
2299
|
-
bodyLines: ['Continuing the migration without the agentic flow.'],
|
|
2300
|
-
});
|
|
2301
|
-
agentic = { kind: 'disabled' };
|
|
2302
|
-
}
|
|
2303
|
-
if (agentic.kind === 'enabled' && idProblems.length > 0) {
|
|
2304
|
-
output_1.output.warn({
|
|
2305
|
-
title: 'Skipping the agentic flow: it needs each migration id to be shell-safe (letters, digits and @/:._-) and listed once, and these are not:',
|
|
2306
|
-
bodyLines: [
|
|
2307
|
-
...idProblemLines,
|
|
2308
|
-
'Continuing the migration without the agentic flow. Generators still run. Prompt-only migrations and the prompt part of hybrid migrations are skipped and listed as next steps, and no AI validation runs.',
|
|
2309
|
-
],
|
|
2310
|
-
});
|
|
2311
|
-
agentic = { kind: 'disabled' };
|
|
2312
|
-
}
|
|
2341
|
+
agentic = dropUnsupportedAgent(agentic, idProblems);
|
|
2313
2342
|
const { effective: effectiveCreateCommits, warning: createCommitsWarning, error: createCommitsError, } = (0, migrate_commits_1.resolveCreateCommits)({
|
|
2314
2343
|
createCommits: shouldCreateCommits,
|
|
2315
2344
|
mode: agentic.kind,
|
|
@@ -2735,6 +2764,10 @@ async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
|
|
|
2735
2764
|
if (opts.runId === undefined &&
|
|
2736
2765
|
!shouldSkipInstall &&
|
|
2737
2766
|
!process.env.NX_MIGRATE_SKIP_INSTALL) {
|
|
2767
|
+
// The worker's refusals come after the install, which would act on the
|
|
2768
|
+
// in-progress edits of a run another process works on.
|
|
2769
|
+
const { checkRunsForSingleMigration } = require('./run');
|
|
2770
|
+
checkRunsForSingleMigration(root);
|
|
2738
2771
|
await (0, execute_migration_1.runInstall)(undefined, 'pre-migration', (0, execute_migration_1.formatSingleMigrationRerunCommand)(opts.runMigration));
|
|
2739
2772
|
}
|
|
2740
2773
|
if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
|
|
@@ -2756,7 +2789,7 @@ async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
|
|
|
2756
2789
|
// Lazy-load run/ so plain migrate and repair runs don't pay for the agentic
|
|
2757
2790
|
// selection chain its barrel pulls in eagerly.
|
|
2758
2791
|
const { runSingleMigrationWorker } = require('./run');
|
|
2759
|
-
await runSingleMigrationWorker({
|
|
2792
|
+
return await runSingleMigrationWorker({
|
|
2760
2793
|
root,
|
|
2761
2794
|
runMigration: opts.runMigration,
|
|
2762
2795
|
runId: opts.runId,
|
|
@@ -16,6 +16,7 @@ export interface AgentMessage {
|
|
|
16
16
|
export declare function safeLines(lines: readonly string[]): string[];
|
|
17
17
|
export declare function logToAgent(message: AgentMessage): void;
|
|
18
18
|
export declare function warnToAgent(message: AgentMessage): void;
|
|
19
|
+
export declare function errorToAgent(message: AgentMessage): void;
|
|
19
20
|
export declare function logLineToAgent(line: string): void;
|
|
20
21
|
export declare function emitStepBlock(runId: string, stepId: string, action: string, payload: object): void;
|
|
21
22
|
export declare function emitPromptBlock(migrationId: string, payload: object): void;
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.safeLines = safeLines;
|
|
14
14
|
exports.logToAgent = logToAgent;
|
|
15
15
|
exports.warnToAgent = warnToAgent;
|
|
16
|
+
exports.errorToAgent = errorToAgent;
|
|
16
17
|
exports.logLineToAgent = logLineToAgent;
|
|
17
18
|
exports.emitStepBlock = emitStepBlock;
|
|
18
19
|
exports.emitPromptBlock = emitPromptBlock;
|
|
@@ -42,6 +43,9 @@ function logToAgent(message) {
|
|
|
42
43
|
function warnToAgent(message) {
|
|
43
44
|
output_1.output.warn(safe(message));
|
|
44
45
|
}
|
|
46
|
+
function errorToAgent(message) {
|
|
47
|
+
output_1.output.error(safe(message));
|
|
48
|
+
}
|
|
45
49
|
function logLineToAgent(line) {
|
|
46
50
|
logger_1.logger.info((0, text_1.singleLine)(line));
|
|
47
51
|
}
|
|
@@ -562,7 +562,7 @@ class MigrateCommitBroker {
|
|
|
562
562
|
return { kind: 'installed', output: output.render('drop') };
|
|
563
563
|
}
|
|
564
564
|
const absorbedStepIds = (0, state_machine_1.uncoveredFailedStepIds)(state).filter((id) => id !== step.id);
|
|
565
|
-
const result = await (0, migrate_commits_1.commitMigrationIfRequested)(this.root, { name: (0, state_machine_1.commitNameForStep)(step) }, true, state.commitPrefix, install, (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds),
|
|
565
|
+
const result = await (0, migrate_commits_1.commitMigrationIfRequested)(this.root, { name: (0, state_machine_1.commitNameForStep)(step) }, true, state.commitPrefix, install, (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), (0, util_1.commitFailureRecovery)(state), output);
|
|
566
566
|
return {
|
|
567
567
|
kind: 'commit',
|
|
568
568
|
result,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CommitResult } from '../migrate-commits';
|
|
1
|
+
import { type CommitFailureRecovery, type CommitResult } from '../migrate-commits';
|
|
2
2
|
import type { MigrateOutputSink } from '../deferred-output';
|
|
3
3
|
import type { TreeLease } from './broker';
|
|
4
4
|
import { type MigrateRunState, type MigrateStep } from './run-state';
|
|
@@ -25,7 +25,8 @@ export interface GiveUpInput {
|
|
|
25
25
|
export declare function giveUpWithCommit(input: GiveUpInput): Promise<GiveUpOutcome>;
|
|
26
26
|
/**
|
|
27
27
|
* Mints the issue that carries a given-up step's failure and points the step
|
|
28
|
-
* at it, on state where the step is already unresolved.
|
|
28
|
+
* at it, on state where the step is already unresolved. A single run keeps no
|
|
29
|
+
* issue ledger, so its state comes back unchanged. The archive file is
|
|
29
30
|
* best-effort: run.json is authoritative, and undoing the transition for a
|
|
30
31
|
* lost detail file would make the agent re-issue an action the run already
|
|
31
32
|
* took.
|
|
@@ -38,4 +39,4 @@ export declare function warnUnresolvedNotArchived(label: string, archiveError: s
|
|
|
38
39
|
/** What the reconcile owes the agent for a give-up that went through. */
|
|
39
40
|
export declare function warnAboutGiveUp(step: MigrateStep, outcome: Extract<GiveUpOutcome, {
|
|
40
41
|
kind: 'given-up';
|
|
41
|
-
}
|
|
42
|
+
}>, recovery: CommitFailureRecovery): void;
|
|
@@ -36,7 +36,7 @@ async function giveUpWithCommit(input) {
|
|
|
36
36
|
let commit;
|
|
37
37
|
let entry;
|
|
38
38
|
try {
|
|
39
|
-
const result = await (0, migrate_commits_1.commitMigrationIfRequested)(root, { name: (0, state_machine_1.unresolvedCommitName)(step) }, true, state.commitPrefix, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, step, input.skipInstall, input.reconcileCommand, input.output), (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds),
|
|
39
|
+
const result = await (0, migrate_commits_1.commitMigrationIfRequested)(root, { name: (0, state_machine_1.unresolvedCommitName)(step) }, true, state.commitPrefix, () => (0, util_1.installDepsChangedSinceDispense)(root, dir, step, input.skipInstall, input.reconcileCommand, input.output), (0, state_machine_1.stepsToPendingMigrations)(state, absorbedStepIds), (0, util_1.commitFailureRecovery)(state), input.output);
|
|
40
40
|
commit = result;
|
|
41
41
|
entry = (0, state_machine_1.commitResultToLedgerEntry)(result, step.id, absorbedStepIds);
|
|
42
42
|
}
|
|
@@ -91,12 +91,15 @@ async function giveUpWithCommit(input) {
|
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Mints the issue that carries a given-up step's failure and points the step
|
|
94
|
-
* at it, on state where the step is already unresolved.
|
|
94
|
+
* at it, on state where the step is already unresolved. A single run keeps no
|
|
95
|
+
* issue ledger, so its state comes back unchanged. The archive file is
|
|
95
96
|
* best-effort: run.json is authoritative, and undoing the transition for a
|
|
96
97
|
* lost detail file would make the agent re-issue an action the run already
|
|
97
98
|
* took.
|
|
98
99
|
*/
|
|
99
100
|
function recordUnresolvedIssue(dir, state, stepId) {
|
|
101
|
+
if (state.singleMigration === true)
|
|
102
|
+
return { state };
|
|
100
103
|
// Minted from the transitioned step: a died one only gains its failure in
|
|
101
104
|
// the transition.
|
|
102
105
|
const minted = (0, issues_1.mintUnresolvedIssue)(state, state.steps.find((s) => s.id === stepId));
|
|
@@ -124,14 +127,14 @@ function warnUnresolvedNotArchived(label, archiveError) {
|
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
/** What the reconcile owes the agent for a give-up that went through. */
|
|
127
|
-
function warnAboutGiveUp(step, outcome) {
|
|
130
|
+
function warnAboutGiveUp(step, outcome, recovery) {
|
|
128
131
|
const name = (0, state_machine_1.unresolvedCommitName)(step);
|
|
129
132
|
switch (outcome.commit.status) {
|
|
130
133
|
case 'install-failed':
|
|
131
|
-
(0, util_1.warnCommitFailed)(name, outcome.commit.reason);
|
|
134
|
+
(0, util_1.warnCommitFailed)(name, recovery, outcome.commit.reason);
|
|
132
135
|
break;
|
|
133
136
|
case 'failed':
|
|
134
|
-
(0, util_1.warnCommitFailed)(name);
|
|
137
|
+
(0, util_1.warnCommitFailed)(name, recovery);
|
|
135
138
|
break;
|
|
136
139
|
case 'committed':
|
|
137
140
|
case 'no-changes':
|
|
@@ -4,10 +4,11 @@ export { applyStepEvent, completionSummaryLines, hasPendingCommitDebt, latestRou
|
|
|
4
4
|
export { hasUnresolvedIssues } from './issues';
|
|
5
5
|
export type { StepAction, StepEvent, ApplyStepEventResult, } from './state-machine';
|
|
6
6
|
export { createRunId } from './run-id';
|
|
7
|
+
export { isHeld } from './state-lock';
|
|
7
8
|
export { pmInstallCommand } from './util';
|
|
8
9
|
export { runSingleMigrationWorker } from './worker';
|
|
9
10
|
export type { RunSingleMigrationWorkerInput } from './worker';
|
|
10
|
-
export { activeRunForClassic, activeRunToReplace, checkRunForStartFresh, completionWarnings, deleteRunForStartFresh, holdRunToContinue, releaseRunToHandOff, runOrchestratorInit, runOrchestratorReconcile, runOrchestratorResume, } from './orchestrator';
|
|
11
|
+
export { activeRunForClassic, activeRunToReplace, checkRunForStartFresh, checkRunsForSingleMigration, completionWarnings, deleteRunForStartFresh, holdRunToContinue, refuseNewRunAlongsideLiveRun, releaseRunToHandOff, runOrchestratorInit, runOrchestratorReconcile, runOrchestratorResume, } from './orchestrator';
|
|
11
12
|
export type { OrchestratorInitResult, RunOrchestratorInitInput, RunOrchestratorReconcileInput, } from './orchestrator';
|
|
12
13
|
export { renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } from './existing-run-report';
|
|
13
14
|
export { BROKER_ENV_VAR, COMMIT_INSTALLS_FIRST, formatElapsed, MigrateCommitBroker, commitsStep, treeOperationLabel, } from './broker';
|
|
@@ -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.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;
|
|
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.refuseNewRunAlongsideLiveRun = exports.holdRunToContinue = exports.deleteRunForStartFresh = exports.completionWarnings = exports.checkRunsForSingleMigration = exports.checkRunForStartFresh = exports.activeRunToReplace = exports.activeRunForClassic = exports.runSingleMigrationWorker = exports.pmInstallCommand = exports.isHeld = 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; } });
|
|
@@ -25,6 +25,8 @@ var issues_1 = require("./issues");
|
|
|
25
25
|
Object.defineProperty(exports, "hasUnresolvedIssues", { enumerable: true, get: function () { return issues_1.hasUnresolvedIssues; } });
|
|
26
26
|
var run_id_1 = require("./run-id");
|
|
27
27
|
Object.defineProperty(exports, "createRunId", { enumerable: true, get: function () { return run_id_1.createRunId; } });
|
|
28
|
+
var state_lock_1 = require("./state-lock");
|
|
29
|
+
Object.defineProperty(exports, "isHeld", { enumerable: true, get: function () { return state_lock_1.isHeld; } });
|
|
28
30
|
var util_1 = require("./util");
|
|
29
31
|
Object.defineProperty(exports, "pmInstallCommand", { enumerable: true, get: function () { return util_1.pmInstallCommand; } });
|
|
30
32
|
var worker_1 = require("./worker");
|
|
@@ -33,9 +35,11 @@ var orchestrator_1 = require("./orchestrator");
|
|
|
33
35
|
Object.defineProperty(exports, "activeRunForClassic", { enumerable: true, get: function () { return orchestrator_1.activeRunForClassic; } });
|
|
34
36
|
Object.defineProperty(exports, "activeRunToReplace", { enumerable: true, get: function () { return orchestrator_1.activeRunToReplace; } });
|
|
35
37
|
Object.defineProperty(exports, "checkRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.checkRunForStartFresh; } });
|
|
38
|
+
Object.defineProperty(exports, "checkRunsForSingleMigration", { enumerable: true, get: function () { return orchestrator_1.checkRunsForSingleMigration; } });
|
|
36
39
|
Object.defineProperty(exports, "completionWarnings", { enumerable: true, get: function () { return orchestrator_1.completionWarnings; } });
|
|
37
40
|
Object.defineProperty(exports, "deleteRunForStartFresh", { enumerable: true, get: function () { return orchestrator_1.deleteRunForStartFresh; } });
|
|
38
41
|
Object.defineProperty(exports, "holdRunToContinue", { enumerable: true, get: function () { return orchestrator_1.holdRunToContinue; } });
|
|
42
|
+
Object.defineProperty(exports, "refuseNewRunAlongsideLiveRun", { enumerable: true, get: function () { return orchestrator_1.refuseNewRunAlongsideLiveRun; } });
|
|
39
43
|
Object.defineProperty(exports, "releaseRunToHandOff", { enumerable: true, get: function () { return orchestrator_1.releaseRunToHandOff; } });
|
|
40
44
|
Object.defineProperty(exports, "runOrchestratorInit", { enumerable: true, get: function () { return orchestrator_1.runOrchestratorInit; } });
|
|
41
45
|
Object.defineProperty(exports, "runOrchestratorReconcile", { enumerable: true, get: function () { return orchestrator_1.runOrchestratorReconcile; } });
|
|
@@ -75,9 +75,14 @@ function quoted(value) {
|
|
|
75
75
|
*/
|
|
76
76
|
function parseHandoffIssues(extras, state, reportingStep) {
|
|
77
77
|
if (extras !== undefined) {
|
|
78
|
-
|
|
78
|
+
// A single run keeps no issue ledger: nx prints its handoff summary when
|
|
79
|
+
// the run ends, and deletes the run's record.
|
|
80
|
+
const singleMigration = state.singleMigration === true;
|
|
81
|
+
const unknown = unknownKey(extras, singleMigration ? ['outcome'] : ['outcome', 'issues', 'issueUpdates']);
|
|
79
82
|
if (unknown !== undefined) {
|
|
80
|
-
return invalid(`the handoff has an unrecognized field ${quoted(unknown)};
|
|
83
|
+
return invalid(`the handoff has an unrecognized field ${quoted(unknown)}; ${singleMigration
|
|
84
|
+
? `a --run-migration run accepts only "outcome" next to "status" and "summary", and its problems go in "summary"`
|
|
85
|
+
: `the fields accepted next to "status" and "summary" are "outcome", "issues" and "issueUpdates"`}`);
|
|
81
86
|
}
|
|
82
87
|
if (extras['outcome'] !== undefined && extras['outcome'] !== 'skipped') {
|
|
83
88
|
return invalid(`the handoff has an unrecognized "outcome" value ${quoted(extras['outcome'])}; the only accepted value is "skipped"`);
|