fix(#2644): deduplicate Cursor slash menu (#2812)

* fix(#2644): deduplicate Cursor slash menu

* fix: preserve installer executable mode

* chore: add changeset for PR #2812

* test(#2644): acknowledge Cursor emission changes

* test(#2644): drop spent emitted drift acknowledgments

* fix(#2644): remove retired Cursor command converter

---------

Co-authored-by: clezcoding <clezcoding@users.noreply.github.com>
Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
𝚌𝚕𝚎𝚣𝚌𝚘𝚍𝚒𝚗𝚐
2026-08-03 18:05:45 +02:00
committed by GitHub
parent 067a4d1c6c
commit 88f6d9bd1b
29 changed files with 727 additions and 360 deletions

View File

@@ -1682,6 +1682,9 @@ test('shipped installer-migration checksums are locked to a committed baseline (
// never manifest-recorded — so the action declares its own classification.
'2026-07-28-retire-config-root-commonjs-marker':
'sha256:8f2140cbe8f2dd8f7dfd52a0f6957c5edfe966c52d7e6e4d74ec7366930e0e1d',
// Migration 008: retire Cursor's duplicate commands/ surface (#2644).
'2026-07-29-cursor-retire-commands-surface':
'sha256:d0b2b812a3f752650f2518b48280f74a5937c80ec8412bac493382dfa3db083f',
};
const { DEFAULT_MIGRATIONS_DIR, migrationChecksum: computeChecksum } = require('../gsd-core/bin/lib/installer-migrations.cjs');
@@ -1794,6 +1797,76 @@ test('reconciles a drifted applied-migration checksum into install state on appl
});
// ---------------------------------------------------------------------------
// Cursor duplicate commands-surface retirement (#2644)
// ---------------------------------------------------------------------------
{
const cursorCommandsMigration = require('../gsd-core/bin/lib/installer-migrations/008-cursor-retire-commands-surface.cjs');
test('migration 008 plans only manifest-managed gsd-*.md command files', (t) => {
const configDir = createTempInstall();
t.after(() => cleanup(configDir));
writeFile(configDir, 'commands/gsd-help.md', '# help\n');
writeFile(configDir, 'commands/gsd-custom.md', '# custom\n');
writeFile(configDir, 'commands/not-gsd.md', '# other\n');
const actions = cursorCommandsMigration.plan({
configDir,
classifyArtifact(relPath) {
if (relPath === 'commands/gsd-help.md') return { classification: 'managed-pristine' };
return { classification: 'unknown' };
},
});
assert.deepEqual(actions.map((action) => [action.type, action.relPath]), [
['remove-managed', 'commands/gsd-help.md'],
]);
});
test('migration 008 backs up a modified managed command and preserves an unknown neighbor', (t) => {
const configDir = createTempInstall();
t.after(() => cleanup(configDir));
writeFile(configDir, 'commands/gsd-help.md', '# locally modified help\n');
writeFile(configDir, 'commands/gsd-custom.md', '# user command\n');
writeManifest(configDir, {
'commands/gsd-help.md': sha256('# original generated help\n'),
});
const result = runInstallerMigrations({
configDir, runtime: 'cursor', scope: 'global', migrations: [cursorCommandsMigration],
now: () => '2026-07-29T00:00:00.000Z',
});
assert.equal(result.plan.actions[0].type, 'backup-and-remove');
assert.ok(!fs.existsSync(path.join(configDir, 'commands', 'gsd-help.md')));
assert.ok(fs.existsSync(path.join(configDir, 'commands', 'gsd-custom.md')),
'unmanifested user command must be preserved');
const journal = JSON.parse(fs.readFileSync(path.join(configDir, result.journalRelPath), 'utf8'));
assert.equal(
fs.readFileSync(path.join(configDir, journal.actions[0].backupRelPath), 'utf8'),
'# locally modified help\n',
);
});
test('migration 008 is scoped to Cursor for both global and local installs', (t) => {
for (const scope of ['global', 'local']) {
const configDir = createTempInstall();
t.after(() => cleanup(configDir));
writeFile(configDir, 'commands/gsd-help.md', '# help\n');
writeManifest(configDir, { 'commands/gsd-help.md': sha256('# help\n') });
const result = runInstallerMigrations({
configDir, runtime: 'cursor', scope, migrations: [cursorCommandsMigration],
now: () => `2026-07-29T00:00:0${scope === 'global' ? '0' : '1'}.000Z`,
});
assert.ok(!fs.existsSync(path.join(configDir, 'commands', 'gsd-help.md')),
`${scope} Cursor install must retire the duplicate command`);
assert.deepEqual(result.appliedMigrationIds, ['2026-07-29-cursor-retire-commands-surface']);
}
});
}
// ────────────────────────────────────────────────────────────────────────
// Folded from tests/bug-3357-codex-legacy-hooks-json-migration.test.cjs — consolidation epic #1969 (B5 #1974)
// ────────────────────────────────────────────────────────────────────────