fix(3610): replace resolved prompt actions and keep explicit block path
This commit is contained in:
@@ -217,10 +217,17 @@ function resolveInstallerMigrationPromptsForNonTty(result, options = {}) {
|
|||||||
|
|
||||||
if (choice) {
|
if (choice) {
|
||||||
const resolved = materializeResolution(action, choice);
|
const resolved = materializeResolution(action, choice);
|
||||||
// Inject the concrete action into plan.actions so the apply
|
// Replace the original prompt-user action in-place when present so
|
||||||
// step picks it up.
|
// applyInstallerMigrationPlan never sees an unsupported action type.
|
||||||
|
// Fallback to append only when the blocked action did not originate
|
||||||
|
// from plan.actions (defensive).
|
||||||
if (result.plan && Array.isArray(result.plan.actions)) {
|
if (result.plan && Array.isArray(result.plan.actions)) {
|
||||||
result.plan.actions.push(resolved);
|
const idx = result.plan.actions.indexOf(action);
|
||||||
|
if (idx >= 0) {
|
||||||
|
result.plan.actions[idx] = resolved;
|
||||||
|
} else {
|
||||||
|
result.plan.actions.push(resolved);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resolutions.push({
|
resolutions.push({
|
||||||
relPath: action.relPath,
|
relPath: action.relPath,
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ describe('installer migration install integration', { concurrency: false }, () =
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('blocks install before materialization when baseline needs explicit user choice', () => {
|
test('blocks install before materialization when baseline needs explicit user choice', () => {
|
||||||
writeFile(codexHome, 'hooks/gsd-retired-hook.js', 'old gsd hook\n');
|
writeFile(codexHome, 'hooks/gsd-retired-hook.txt', 'old gsd hook\n');
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => captureConsole(() =>
|
() => captureConsole(() =>
|
||||||
@@ -315,7 +315,7 @@ describe('installer migration install integration', { concurrency: false }, () =
|
|||||||
/installer migration blocked/
|
/installer migration blocked/
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(fs.readFileSync(path.join(codexHome, 'hooks/gsd-retired-hook.js'), 'utf8'), 'old gsd hook\n');
|
assert.equal(fs.readFileSync(path.join(codexHome, 'hooks/gsd-retired-hook.txt'), 'utf8'), 'old gsd hook\n');
|
||||||
assert.equal(fs.existsSync(path.join(codexHome, 'skills')), false);
|
assert.equal(fs.existsSync(path.join(codexHome, 'skills')), false);
|
||||||
assert.equal(fs.existsSync(path.join(codexHome, 'get-shit-done', 'VERSION')), false);
|
assert.equal(fs.existsSync(path.join(codexHome, 'get-shit-done', 'VERSION')), false);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user