Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/npx-cli/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,7 @@ async function runInstallCommandInner(options: InstallOptions, summary: InstallS
}
writeInstallMarker(cacheDir, version, bunVersion, uvVersion);
}
writeInstallMarker(join(marketplaceDirectory(), 'plugin'), version, bunVersion, uvVersion);
return `Runtime ready (Bun ${bunVersion}, uv ${uvVersion}) ${pc.green('OK')}`;
},
},
Expand Down
19 changes: 2 additions & 17 deletions src/services/integrations/CodexCliInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ function runCodex(args: string[]): void {
}
}

function runCodexBestEffort(args: string[], successMessage: string, failureMessage: string): boolean {
try {
runCodex(args);
console.log(` ${successMessage}`);
return true;
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.warn(` ${failureMessage}: ${message}`);
return false;
}
}

function isMarketplaceDifferentSourceError(error: unknown): boolean {
const message = error instanceof Error ? error.message : String(error);
return message.includes(`marketplace '${MARKETPLACE_NAME}' is already added from a different source`)
Expand Down Expand Up @@ -419,11 +407,8 @@ export async function installCodexCli(marketplaceRootOverride?: string): Promise
console.log(` Registering Codex plugin marketplace: ${marketplaceRoot}`);
registerCodexMarketplace(marketplaceRoot);
enableCodexPluginConfig();
runCodexBestEffort(
['plugin', 'marketplace', 'upgrade', MARKETPLACE_NAME],
'Refreshed Codex marketplace and installed plugin cache.',
'Could not refresh Codex marketplace cache; reinstall or upgrade claude-mem from /plugins if Codex still uses old MCP config',
);
runCodex(['plugin', 'add', CODEX_PLUGIN_ID]);
console.log(' Installed Codex plugin cache.');
if (!cleanupLegacyCodexAgentsMdContext()) {
console.warn(` Native Codex hooks registered, but failed to remove legacy AGENTS.md context from ${CODEX_AGENTS_MD_PATH}.`);
}
Expand Down
16 changes: 13 additions & 3 deletions tests/install-non-tty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,23 @@ describe('Install Non-TTY Support', () => {
expect(installSource).toContain('installCodexCli(marketplaceDirectory())');
});

it('refreshes Codex marketplace cache after registration', () => {
it('installs the Codex plugin cache after local marketplace registration', () => {
const installRegion = codexInstallerSource.slice(
codexInstallerSource.indexOf('export async function installCodexCli'),
codexInstallerSource.indexOf('export function uninstallCodexCli'),
);
expect(installRegion).toContain("['plugin', 'marketplace', 'upgrade', MARKETPLACE_NAME]");
expect(installRegion).toContain('installed plugin cache');
expect(installRegion).toContain("runCodex(['plugin', 'add', CODEX_PLUGIN_ID])");
expect(installRegion).toContain('Installed Codex plugin cache.');
expect(installRegion).not.toContain('runCodexBestEffort(');
expect(installRegion).not.toContain("['plugin', 'marketplace', 'upgrade', MARKETPLACE_NAME]");
});

it('copies the install marker into the bundled marketplace plugin before Codex installs it', () => {
const runtimeSetupRegion = installSource.slice(
installSource.indexOf("title: 'Setting up runtime"),
installSource.indexOf("return `Runtime ready"),
);
expect(runtimeSetupRegion).toContain("writeInstallMarker(join(marketplaceDirectory(), 'plugin'), version, bunVersion, uvVersion)");
});

it('replaces stale Codex marketplace registrations from a different source', () => {
Expand Down