caflip 0.4.0 → 0.4.1
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/README.md +3 -0
- package/dist/cli.js +23 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,6 +158,9 @@ Codex display labels use provider metadata conservatively:
|
|
|
158
158
|
- `free` shows `email · free`
|
|
159
159
|
- alias is the primary human-readable name when you need your own team label
|
|
160
160
|
|
|
161
|
+
Claude display labels keep custom organization names, but the default personal name
|
|
162
|
+
`<email>'s Organization` is simplified to `email · Personal`.
|
|
163
|
+
|
|
161
164
|
`add`, `remove`, and `login` can be used without a provider prefix. In that case, caflip asks you to choose Claude or Codex first, then continues the normal command flow.
|
|
162
165
|
|
|
163
166
|
`remove` target accepts email only. Omit it to choose from the interactive picker after selecting a provider.
|
package/dist/cli.js
CHANGED
|
@@ -721,7 +721,7 @@ function validateAlias(alias) {
|
|
|
721
721
|
// package.json
|
|
722
722
|
var package_default = {
|
|
723
723
|
name: "caflip",
|
|
724
|
-
version: "0.4.
|
|
724
|
+
version: "0.4.1",
|
|
725
725
|
type: "module",
|
|
726
726
|
bin: {
|
|
727
727
|
caflip: "bin/caflip"
|
|
@@ -3662,6 +3662,22 @@ async function registerCurrentActiveAccount(options) {
|
|
|
3662
3662
|
email: currentEmail
|
|
3663
3663
|
};
|
|
3664
3664
|
}
|
|
3665
|
+
async function refreshCurrentManagedBackup(currentAccountNum, currentEmail, credentialsDir, configsDir) {
|
|
3666
|
+
if (currentEmail === "none" || !currentAccountNum) {
|
|
3667
|
+
return currentAccountNum;
|
|
3668
|
+
}
|
|
3669
|
+
const currentCreds = await activeProvider.readActiveAuth();
|
|
3670
|
+
if (currentCreds) {
|
|
3671
|
+
await activeProvider.writeAccountAuth(currentAccountNum, currentEmail, currentCreds, credentialsDir);
|
|
3672
|
+
}
|
|
3673
|
+
if (activeProvider.usesAccountConfig) {
|
|
3674
|
+
const currentConfig = await activeProvider.readActiveConfig();
|
|
3675
|
+
if (currentConfig) {
|
|
3676
|
+
await activeProvider.writeAccountConfig(currentAccountNum, currentEmail, currentConfig, configsDir);
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
return currentAccountNum;
|
|
3680
|
+
}
|
|
3665
3681
|
function getLoginPassthroughArgs(args) {
|
|
3666
3682
|
const passthroughIdx = args.indexOf("--");
|
|
3667
3683
|
if (passthroughIdx === -1) {
|
|
@@ -3707,18 +3723,7 @@ async function performSwitch(seq, targetAccount, options) {
|
|
|
3707
3723
|
if (currentEmail !== "none" && !sanitizeEmailForFilename(currentEmail)) {
|
|
3708
3724
|
throw new Error("Current account email is not safe for storage");
|
|
3709
3725
|
}
|
|
3710
|
-
|
|
3711
|
-
const currentCreds = await activeProvider.readActiveAuth();
|
|
3712
|
-
if (currentCreds) {
|
|
3713
|
-
await activeProvider.writeAccountAuth(currentAccount, currentEmail, currentCreds, credentialsDir);
|
|
3714
|
-
}
|
|
3715
|
-
if (activeProvider.usesAccountConfig) {
|
|
3716
|
-
const currentConfig = await activeProvider.readActiveConfig();
|
|
3717
|
-
if (currentConfig) {
|
|
3718
|
-
await activeProvider.writeAccountConfig(currentAccount, currentEmail, currentConfig, configsDir);
|
|
3719
|
-
}
|
|
3720
|
-
}
|
|
3721
|
-
}
|
|
3726
|
+
await refreshCurrentManagedBackup(currentAccount, currentEmail, credentialsDir, configsDir);
|
|
3722
3727
|
const targetCreds = await activeProvider.readAccountAuth(targetAccount, targetEmail, credentialsDir);
|
|
3723
3728
|
const targetConfig = activeProvider.readAccountConfig(targetAccount, targetEmail, configsDir);
|
|
3724
3729
|
if (!targetCreds) {
|
|
@@ -3791,14 +3796,12 @@ async function getManagedAccountLinesForActiveProvider() {
|
|
|
3791
3796
|
});
|
|
3792
3797
|
}
|
|
3793
3798
|
async function cmdAdd(alias) {
|
|
3794
|
-
const result = await registerCurrentActiveAccount({ alias, updateIfExists:
|
|
3795
|
-
if (result.action === "unchanged") {
|
|
3796
|
-
return;
|
|
3797
|
-
}
|
|
3799
|
+
const result = await registerCurrentActiveAccount({ alias, updateIfExists: true });
|
|
3798
3800
|
const seq = await loadSequence(activeSequenceFile);
|
|
3799
3801
|
const displayLabel = getDisplayAccountLabel(seq, result.accountNum);
|
|
3800
3802
|
const aliasStr = alias ? ` [${alias}]` : "";
|
|
3801
|
-
|
|
3803
|
+
const verb = result.action === "updated" ? "Updated" : "Added";
|
|
3804
|
+
console.log(`${verb} ${displayLabel}: ${result.email}${aliasStr}`);
|
|
3802
3805
|
}
|
|
3803
3806
|
async function cmdLogin(args) {
|
|
3804
3807
|
const passthroughArgs = getLoginPassthroughArgs(args);
|
|
@@ -4105,7 +4108,8 @@ Examples:
|
|
|
4105
4108
|
|
|
4106
4109
|
Alias targets:
|
|
4107
4110
|
<account> can be a list number, an existing alias, or an email when it matches exactly one managed account.
|
|
4108
|
-
Codex labels show workspace plans as email \xB7 plan(orgShortId); free shows email \xB7 free
|
|
4111
|
+
Codex labels show workspace plans as email \xB7 plan(orgShortId); free shows email \xB7 free.
|
|
4112
|
+
Claude simplifies the default personal label to email \xB7 Personal.`);
|
|
4109
4113
|
}
|
|
4110
4114
|
async function executeProviderCommand(command, args, provider, runWithLock) {
|
|
4111
4115
|
switch (command) {
|