nx 24.0.0-beta.2 → 24.0.0-beta.3
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/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.js +16 -27
- 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/nx-json.d.ts +8 -5
- package/dist/src/config/workspace-json-project-json.d.ts +12 -9
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-exports.d.ts +4 -0
- package/dist/src/devkit-exports.js +6 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +4 -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 +3 -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/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/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/readiness/probes.js +30 -1
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +31 -10
- package/dist/src/tasks-runner/readiness/ready-when.js +178 -41
- package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -0
- package/dist/src/tasks-runner/task-orchestrator.js +113 -38
- 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/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/nx-schema.json +17 -11
- package/schemas/project-schema.json +8 -7
- 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
|
@@ -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
|
|
@@ -2009,15 +2009,11 @@ agentic) {
|
|
|
2009
2009
|
};
|
|
2010
2010
|
}
|
|
2011
2011
|
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
2012
|
// The classic loop records no run, so it must not run over an active one. The
|
|
2017
2013
|
// run is reported or asked about before the default-branch prompt; a start
|
|
2018
2014
|
// fresh is checked there too, and the caller deletes the run only after it.
|
|
2019
2015
|
async function settleActiveRunForClassic(root, opts, migrations) {
|
|
2020
|
-
const { activeRunForClassic, checkRunForStartFresh, renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } = require('./run');
|
|
2016
|
+
const { activeRunForClassic, checkRunForStartFresh, isHeld, renderContinueCommand, renderExistingRunCommands, renderExistingRunReport, } = require('./run');
|
|
2021
2017
|
const active = activeRunForClassic(root, migrations.map((m) => `${m.package}:${m.name}`));
|
|
2022
2018
|
// With no active run left, the check refuses as init does: the run
|
|
2023
2019
|
// completed after the pre-install check, so its plan already ran.
|
|
@@ -2032,7 +2028,7 @@ async function settleActiveRunForClassic(root, opts, migrations) {
|
|
|
2032
2028
|
const { runId, facts } = active;
|
|
2033
2029
|
// Start fresh refuses while another process holds the run, so a held run
|
|
2034
2030
|
// leaves nothing to ask; an agent cannot answer a prompt.
|
|
2035
|
-
const held = facts.otherHolders
|
|
2031
|
+
const held = isHeld(facts.otherHolders);
|
|
2036
2032
|
if (opts.startFresh !== true &&
|
|
2037
2033
|
!held &&
|
|
2038
2034
|
(0, safe_prompt_1.canPrompt)(opts.interactive) &&
|
|
@@ -2111,6 +2107,12 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2111
2107
|
const { activeRunToReplace } = require('./run');
|
|
2112
2108
|
activeRunToReplace(root, opts.runId);
|
|
2113
2109
|
}
|
|
2110
|
+
else {
|
|
2111
|
+
// Before the install as well: it would act on the in-progress edits of a
|
|
2112
|
+
// live run that init wouldn't report.
|
|
2113
|
+
const { refuseNewRunAlongsideLiveRun } = require('./run');
|
|
2114
|
+
refuseNewRunAlongsideLiveRun(root);
|
|
2115
|
+
}
|
|
2114
2116
|
if (!shouldSkipInstall && !process.env.NX_MIGRATE_SKIP_INSTALL) {
|
|
2115
2117
|
// The run must resume while the cause of a step's failed install persists.
|
|
2116
2118
|
const failedInstallSteps = continued?.steps.filter((s) => s.installFailed === true) ?? [];
|
|
@@ -2200,7 +2202,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2200
2202
|
const idProblems = isContinue || opts.startFresh === true
|
|
2201
2203
|
? []
|
|
2202
2204
|
: require('./run').migrationIdProblems(migrations);
|
|
2203
|
-
const
|
|
2205
|
+
const { dropUnsupportedAgent, idProblemLines, resolveAgentic } = require('./agentic/select');
|
|
2204
2206
|
// An outer agent drives the loop, so hand off to the orchestrator instead of
|
|
2205
2207
|
// the classic loop: init starts a fresh run or reports an already-active
|
|
2206
2208
|
// one; `--run-id` continues that run. Bare `--run-id` reconciles are
|
|
@@ -2270,7 +2272,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2270
2272
|
output_1.output.warn({
|
|
2271
2273
|
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
2274
|
bodyLines: [
|
|
2273
|
-
...idProblemLines,
|
|
2275
|
+
...idProblemLines(idProblems),
|
|
2274
2276
|
'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
2277
|
],
|
|
2276
2278
|
});
|
|
@@ -2279,7 +2281,6 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2279
2281
|
createCommits: shouldCreateCommits ?? false,
|
|
2280
2282
|
migrationCount: migrations.length,
|
|
2281
2283
|
});
|
|
2282
|
-
const { resolveAgentic } = require('./agentic/select');
|
|
2283
2284
|
let agentic;
|
|
2284
2285
|
try {
|
|
2285
2286
|
agentic = await resolveAgentic({
|
|
@@ -2293,23 +2294,7 @@ async function runMigrations(root, opts, args, isVerbose, shouldCreateCommits, c
|
|
|
2293
2294
|
throw e;
|
|
2294
2295
|
}
|
|
2295
2296
|
// 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
|
-
}
|
|
2297
|
+
agentic = dropUnsupportedAgent(agentic, idProblems);
|
|
2313
2298
|
const { effective: effectiveCreateCommits, warning: createCommitsWarning, error: createCommitsError, } = (0, migrate_commits_1.resolveCreateCommits)({
|
|
2314
2299
|
createCommits: shouldCreateCommits,
|
|
2315
2300
|
mode: agentic.kind,
|
|
@@ -2735,6 +2720,10 @@ async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
|
|
|
2735
2720
|
if (opts.runId === undefined &&
|
|
2736
2721
|
!shouldSkipInstall &&
|
|
2737
2722
|
!process.env.NX_MIGRATE_SKIP_INSTALL) {
|
|
2723
|
+
// The worker's refusals come after the install, which would act on the
|
|
2724
|
+
// in-progress edits of a run another process works on.
|
|
2725
|
+
const { checkRunsForSingleMigration } = require('./run');
|
|
2726
|
+
checkRunsForSingleMigration(root);
|
|
2738
2727
|
await (0, execute_migration_1.runInstall)(undefined, 'pre-migration', (0, execute_migration_1.formatSingleMigrationRerunCommand)(opts.runMigration));
|
|
2739
2728
|
}
|
|
2740
2729
|
if (!__dirname.startsWith(workspace_root_1.workspaceRoot)) {
|
|
@@ -2756,7 +2745,7 @@ async function runSingleMigrationFromCli(root, opts, args, mergedArgs) {
|
|
|
2756
2745
|
// Lazy-load run/ so plain migrate and repair runs don't pay for the agentic
|
|
2757
2746
|
// selection chain its barrel pulls in eagerly.
|
|
2758
2747
|
const { runSingleMigrationWorker } = require('./run');
|
|
2759
|
-
await runSingleMigrationWorker({
|
|
2748
|
+
return await runSingleMigrationWorker({
|
|
2760
2749
|
root,
|
|
2761
2750
|
runMigration: opts.runMigration,
|
|
2762
2751
|
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"`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MigrateRunPolicy, type MigrateRunState } from './run-state';
|
|
1
|
+
import { type MigrateCommitLedgerEntry, type MigrateRunPolicy, type MigrateRunState, type MigrateStep } from './run-state';
|
|
2
2
|
import { type StepAction } from './state-machine';
|
|
3
3
|
import { type PlannedMigration } from '../migration-shape';
|
|
4
4
|
import { type ExistingRunFacts } from './existing-run-report';
|
|
@@ -19,6 +19,7 @@ export interface RunOrchestratorInitInput {
|
|
|
19
19
|
onExistingRun?: 'report' | 'start-fresh';
|
|
20
20
|
replaceRunId?: string;
|
|
21
21
|
confirmStart?: () => Promise<boolean>;
|
|
22
|
+
singleMigration?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export type OrchestratorInitResult = {
|
|
24
25
|
kind: 'ready';
|
|
@@ -54,9 +55,9 @@ export declare function runOrchestratorResume(input: RunOrchestratorResumeInput)
|
|
|
54
55
|
* Holds the active run `runId` names and returns its state. A continue calls
|
|
55
56
|
* this before the install and the agent selection: a concurrent start-fresh
|
|
56
57
|
* must not delete the run meanwhile. Throws when the id names no run or a
|
|
57
|
-
* finished one, and while another process holds the run
|
|
58
|
-
* open a second session over a live one.
|
|
59
|
-
* holder refuses.
|
|
58
|
+
* finished one, and while another process holds the run or works on a
|
|
59
|
+
* different run: continuing would open a second session over a live one.
|
|
60
|
+
* Under WASM nothing is held and no holder refuses.
|
|
60
61
|
*/
|
|
61
62
|
export declare function holdRunToContinue(root: string, runId: string): MigrateRunState;
|
|
62
63
|
export declare function activeRunToReplace(root: string, runId: string | undefined): {
|
|
@@ -90,7 +91,42 @@ export declare function checkRunForStartFresh(root: string, runId: string): void
|
|
|
90
91
|
* records no run of its own afterwards.
|
|
91
92
|
*/
|
|
92
93
|
export declare function deleteRunForStartFresh(root: string, runId: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Throws while another process works on a run that init wouldn't report: a
|
|
96
|
+
* `--run-migration` run, a run being started, or a run nx can't read. A new
|
|
97
|
+
* run would install and commit over its in-progress edits. An active
|
|
98
|
+
* `--run-migrations` run is reported instead, except to a `--run-migration`
|
|
99
|
+
* run, and records no process holds block nothing.
|
|
100
|
+
*/
|
|
101
|
+
export declare function refuseNewRunAlongsideLiveRun(root: string, singleMigration?: boolean): void;
|
|
102
|
+
/**
|
|
103
|
+
* The refusals of prepareSingleMigrationRun alone, for the CLI to make before
|
|
104
|
+
* its install. Removes and warns about nothing.
|
|
105
|
+
*/
|
|
106
|
+
export declare function checkRunsForSingleMigration(root: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* The check every `--run-migration` run without a run id makes before it runs
|
|
109
|
+
* anything. Throws while another nx migrate process works on a run, removes
|
|
110
|
+
* `--run-migration` records no process holds, and warns about idle active
|
|
111
|
+
* runs, which do not record this migration.
|
|
112
|
+
*/
|
|
113
|
+
export declare function prepareSingleMigrationRun(root: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Removes a `--run-migration` run's record. Call under the creation lock. Kept
|
|
116
|
+
* while another process still works on the run, such as a worker the agent
|
|
117
|
+
* left running: other runs refuse alongside it, and the next
|
|
118
|
+
* `--run-migration` removes it once none does. Otherwise best effort: what is
|
|
119
|
+
* left blocks nothing.
|
|
120
|
+
*/
|
|
121
|
+
export declare function removeSingleMigrationRun(root: string, runId: string): void;
|
|
93
122
|
export declare function runOrchestratorReconcile(input: RunOrchestratorReconcileInput): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Dispenses a `--run-migration` run's step without a response: the parent
|
|
125
|
+
* runs the step's first attempt itself, and an agent it starts afterwards
|
|
126
|
+
* gets the step from the "next" command.
|
|
127
|
+
*/
|
|
128
|
+
export declare function dispenseSingleMigrationStep(root: string, runId: string): void;
|
|
129
|
+
export declare function lastCoveringLandedEntry(state: MigrateRunState, step: MigrateStep): MigrateCommitLedgerEntry | null;
|
|
94
130
|
/**
|
|
95
131
|
* What a completed run leaves behind for whoever reads its summary, one line
|
|
96
132
|
* group per warning: commit debt, uninstalled dependency changes, unresolved
|