Skip to content

Commit 0ffae34

Browse files
chore: remove backwards compatibility shims (#263)
1 parent 830698d commit 0ffae34

16 files changed

Lines changed: 26 additions & 214 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "resend-cli",
3-
"version": "1.11.0",
3+
"version": "2.0.0",
44
"description": "The official CLI for Resend",
55
"license": "MIT",
66
"repository": {

skills/resend-cli/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: >
1111
license: MIT
1212
metadata:
1313
author: resend
14-
version: "1.12.0"
14+
version: "2.0.0"
1515
homepage: https://resend.com/docs/cli-agents
1616
source: https://github.com/resend/resend-cli
1717
openclaw:

src/cli.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { eventsCommand } from './commands/events/index';
1919
import { logsCommand } from './commands/logs/index';
2020
import { openCommand } from './commands/open';
2121
import { segmentsCommand } from './commands/segments/index';
22-
import { teamsDeprecatedCommand } from './commands/teams-deprecated';
2322
import { templatesCommand } from './commands/templates/index';
2423
import { topicsCommand } from './commands/topics/index';
2524
import { updateCommand } from './commands/update';
@@ -58,7 +57,6 @@ const program = new Command()
5857
)
5958
.option('--api-key <key>', 'Resend API key (overrides env/config)')
6059
.option('-p, --profile <name>', 'Profile to use (overrides RESEND_PROFILE)')
61-
.option('--team <name>', 'Deprecated: use --profile instead')
6260
.option('--json', 'Force JSON output')
6361
.option('-q, --quiet', 'Suppress spinners and status output (implies --json)')
6462
.option(
@@ -149,7 +147,6 @@ ${pc.gray('Examples:')}
149147
.addCommand(openCommand)
150148
.addCommand(docsCommand)
151149
.addCommand(updateCommand)
152-
.addCommand(teamsDeprecatedCommand)
153150
.addCommand(listCommandsCommand)
154151
.addCommand(completionCommand);
155152

@@ -167,12 +164,6 @@ telemetryCommand
167164

168165
program.addCommand(telemetryCommand, { hidden: true });
169166

170-
// Hide the deprecated --team option from help
171-
const teamOption = program.options.find((o) => o.long === '--team');
172-
if (teamOption) {
173-
teamOption.hidden = true;
174-
}
175-
176167
program
177168
.parseAsync()
178169
.then(() => {

src/commands/auth/login.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ export const loginCommand = new Command('login')
157157
);
158158
}
159159

160-
let profileName =
161-
(globalOpts.profile ?? globalOpts.team)?.trim() || undefined;
160+
let profileName = globalOpts.profile?.trim() || undefined;
162161

163162
if (profileName) {
164163
const profileError = validateProfileName(profileName);

src/commands/auth/logout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ If no credentials file exists, exits cleanly with no error.`,
5353
return;
5454
}
5555

56-
const profileFlag = globalOpts.profile ?? globalOpts.team;
56+
const profileFlag = globalOpts.profile;
5757
const logoutAll = !profileFlag;
5858
const profileLabel = profileFlag || resolveProfileName();
5959

src/commands/doctor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ export const doctorCommand = new Command('doctor')
238238
...(!usingSecure &&
239239
process.env.RESEND_CREDENTIAL_STORE !== 'file' &&
240240
(creds?.storage === 'secure_storage' ||
241-
process.env.RESEND_CREDENTIAL_STORE === 'secure_storage' ||
242-
process.env.RESEND_CREDENTIAL_STORE === 'keychain')
241+
process.env.RESEND_CREDENTIAL_STORE === 'secure_storage')
243242
? {
244243
detail:
245244
'Secure backend unavailable despite secure storage preference — falling back to plaintext',

src/commands/teams-deprecated.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/commands/whoami.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Shows which profile is active and where the API key comes from.`,
3131
)
3232
.action(async (_opts, cmd) => {
3333
const globalOpts = cmd.optsWithGlobals() as GlobalOpts;
34-
const profileFlag = globalOpts.profile ?? globalOpts.team;
34+
const profileFlag = globalOpts.profile;
3535
const resolved = await resolveApiKeyAsync(globalOpts.apiKey, profileFlag);
3636

3737
if (!resolved) {
@@ -40,8 +40,7 @@ Shows which profile is active and where the API key comes from.`,
4040
: resolveProfileName(profileFlag);
4141
const profiles = listProfiles();
4242
const profileExists = profiles.some((p) => p.name === requestedProfile);
43-
const explicitProfile =
44-
profileFlag || process.env.RESEND_PROFILE || process.env.RESEND_TEAM;
43+
const explicitProfile = profileFlag || process.env.RESEND_PROFILE;
4544

4645
// If a specific profile was requested but doesn't exist, show a targeted error
4746
const message =

src/lib/client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export type GlobalOpts = {
1313
json?: boolean;
1414
quiet?: boolean;
1515
profile?: string;
16-
/** @deprecated Use `profile` instead */
17-
team?: string;
1816
};
1917

2018
export type RequireClientOpts = {
@@ -59,7 +57,7 @@ export async function requireClient(
5957
opts: GlobalOpts,
6058
clientOpts?: RequireClientOpts,
6159
): Promise<Resend> {
62-
const profileName = opts.profile ?? opts.team;
60+
const profileName = opts.profile;
6361

6462
try {
6563
const resolved = await resolveApiKeyAsync(opts.apiKey, profileName);

src/lib/config.ts

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export type CredentialsFile = {
3434
profiles: Record<string, Profile>;
3535
};
3636

37-
/** @deprecated Use `Profile` instead */
38-
export type TeamProfile = Profile;
39-
4037
export function getConfigDir(): string {
4138
if (process.env.XDG_CONFIG_HOME) {
4239
return join(process.env.XDG_CONFIG_HOME, 'resend');
@@ -54,30 +51,13 @@ export function getCredentialsPath(): string {
5451
export function readCredentials(): CredentialsFile | null {
5552
try {
5653
const data = JSON.parse(readFileSync(getCredentialsPath(), 'utf-8'));
57-
// Support legacy format: { api_key: "re_xxx" }
58-
if (data.api_key && !data.profiles && !data.teams) {
59-
return {
60-
active_profile: 'default',
61-
profiles: { default: { api_key: data.api_key } },
62-
};
63-
}
64-
// New format: { profiles, active_profile }
6554
if (data.profiles) {
66-
const storage =
67-
data.storage === 'keychain' ? 'secure_storage' : data.storage;
6855
return {
6956
active_profile: data.active_profile ?? 'default',
70-
...(storage ? { storage } : {}),
57+
...(data.storage ? { storage: data.storage } : {}),
7158
profiles: data.profiles,
7259
};
7360
}
74-
// Old format: { teams, active_team }
75-
if (data.teams) {
76-
return {
77-
active_profile: data.active_team ?? 'default',
78-
profiles: data.teams,
79-
};
80-
}
8161
return null;
8262
} catch {
8363
return null;
@@ -102,8 +82,7 @@ export function resolveProfileName(flagValue?: string): string {
10282
return flagValue;
10383
}
10484

105-
// Check RESEND_PROFILE first, fall back to deprecated RESEND_TEAM
106-
const envProfile = process.env.RESEND_PROFILE || process.env.RESEND_TEAM;
85+
const envProfile = process.env.RESEND_PROFILE;
10786
if (envProfile) {
10887
return envProfile;
10988
}
@@ -116,9 +95,6 @@ export function resolveProfileName(flagValue?: string): string {
11695
return 'default';
11796
}
11897

119-
/** @deprecated Use `resolveProfileName` instead */
120-
export const resolveTeamName = resolveProfileName;
121-
12298
export function resolveApiKey(
12399
flagValue?: string,
124100
profileName?: string,
@@ -190,7 +166,7 @@ export function removeApiKey(profileName?: string): string {
190166
if (!existsSync(configPath)) {
191167
throw new Error('No credentials file found.');
192168
}
193-
// Try to delete legacy file
169+
// File exists but is not valid credentials — delete it
194170
unlinkSync(configPath);
195171
return configPath;
196172
}
@@ -237,9 +213,6 @@ export function setActiveProfile(profileName: string): void {
237213
writeCredentials(creds);
238214
}
239215

240-
/** @deprecated Use `setActiveProfile` instead */
241-
export const setActiveTeam = setActiveProfile;
242-
243216
export function listProfiles(): Array<{ name: string; active: boolean }> {
244217
const creds = readCredentials();
245218
if (!creds) {
@@ -251,9 +224,6 @@ export function listProfiles(): Array<{ name: string; active: boolean }> {
251224
}));
252225
}
253226

254-
/** @deprecated Use `listProfiles` instead */
255-
export const listTeams = listProfiles;
256-
257227
export function validateProfileName(name: string): string | undefined {
258228
if (!name || name.length === 0) {
259229
return 'Profile name must not be empty';
@@ -267,9 +237,6 @@ export function validateProfileName(name: string): string | undefined {
267237
return undefined;
268238
}
269239

270-
/** @deprecated Use `validateProfileName` instead */
271-
export const validateTeamName = validateProfileName;
272-
273240
export function renameProfile(oldName: string, newName: string): void {
274241
if (oldName === newName) {
275242
return;
@@ -324,7 +291,6 @@ export async function resolveApiKeyAsync(
324291
const profile =
325292
profileName ||
326293
process.env.RESEND_PROFILE ||
327-
process.env.RESEND_TEAM ||
328294
creds?.active_profile ||
329295
'default';
330296

@@ -337,27 +303,10 @@ export async function resolveApiKeyAsync(
337303
}
338304
}
339305

340-
// File-based storage (or unmigrated profile in mixed state)
306+
// File-based storage
341307
if (creds) {
342308
const entry = creds.profiles[profile];
343309
if (entry?.api_key) {
344-
// Auto-migrate: move plaintext key to secure storage if available
345-
const backend = await getCredentialBackend();
346-
if (backend.isSecure) {
347-
try {
348-
await backend.set(SERVICE_NAME, profile, entry.api_key);
349-
creds.profiles[profile] = {
350-
...(entry.permission && { permission: entry.permission }),
351-
};
352-
creds.storage = 'secure_storage';
353-
writeCredentials(creds);
354-
process.stderr.write(
355-
`Notice: API key for profile "${profile}" has been moved to ${backend.name}\n`,
356-
);
357-
} catch {
358-
// Non-fatal — plaintext key still works
359-
}
360-
}
361310
return {
362311
key: entry.api_key,
363312
source: 'config',
@@ -417,7 +366,6 @@ export async function removeApiKeyAsync(profileName?: string): Promise<string> {
417366
const profile =
418367
profileName ||
419368
process.env.RESEND_PROFILE ||
420-
process.env.RESEND_TEAM ||
421369
creds?.active_profile ||
422370
'default';
423371

0 commit comments

Comments
 (0)