@barekey/cli 0.5.5 → 0.5.6
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/dist/commands/auth.js +1 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/output/avatar.d.ts +2 -1
- package/dist/output/avatar.js +27 -4
- package/package.json +1 -1
- package/src/commands/auth.ts +1 -0
- package/src/contracts/index.ts +1 -0
- package/src/output/avatar.ts +35 -4
package/dist/commands/auth.js
CHANGED
|
@@ -54,6 +54,7 @@ export declare const CliSessionResponseSchema: Schema.Struct<{
|
|
|
54
54
|
displayName: Schema.NullOr<typeof Schema.String>;
|
|
55
55
|
email: Schema.NullOr<typeof Schema.String>;
|
|
56
56
|
imageUrl: Schema.NullOr<typeof Schema.String>;
|
|
57
|
+
plan: Schema.NullOr<Schema.Literal<["free", "pro", "max"]>>;
|
|
57
58
|
orgId: typeof Schema.String;
|
|
58
59
|
orgSlug: typeof Schema.String;
|
|
59
60
|
source: Schema.Literal<["clerk", "cli"]>;
|
package/dist/contracts/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export const CliSessionResponseSchema = Schema.Struct({
|
|
|
56
56
|
displayName: Schema.NullOr(Schema.String),
|
|
57
57
|
email: Schema.NullOr(Schema.String),
|
|
58
58
|
imageUrl: Schema.NullOr(Schema.String),
|
|
59
|
+
plan: Schema.NullOr(Schema.Literal("free", "pro", "max")),
|
|
59
60
|
orgId: Schema.String,
|
|
60
61
|
orgSlug: Schema.String,
|
|
61
62
|
source: Schema.Literal("clerk", "cli"),
|
package/dist/output/avatar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Builds the terminal `whoami` output with a tiny ANSI avatar when supported.
|
|
3
3
|
*
|
|
4
|
-
* @param input The display name, email, and optional avatar image URL.
|
|
4
|
+
* @param input The display name, email, plan, and optional avatar image URL.
|
|
5
5
|
* @returns The formatted `whoami` string ready for stdout.
|
|
6
6
|
* @remarks Non-TTY terminals and avatar failures fall back to plain text without throwing.
|
|
7
7
|
* @lastModified 2026-03-19
|
|
@@ -10,5 +10,6 @@
|
|
|
10
10
|
export declare function formatWhoamiWithAvatar(input: {
|
|
11
11
|
displayName: string;
|
|
12
12
|
email: string | null;
|
|
13
|
+
plan: "free" | "pro" | "max" | null;
|
|
13
14
|
imageUrl: string | null;
|
|
14
15
|
}): Promise<string>;
|
package/dist/output/avatar.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Jimp } from "jimp";
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
const DEFAULT_AVATAR_COLUMNS = 10;
|
|
4
|
+
const DEFAULT_AVATAR_ROWS = 5;
|
|
4
5
|
function supportsAnsiAvatar() {
|
|
5
6
|
if (!process.stdout.isTTY) {
|
|
6
7
|
return false;
|
|
@@ -93,17 +94,39 @@ function joinAvatarAndText(avatarLines, textLines) {
|
|
|
93
94
|
}
|
|
94
95
|
return renderedRows.join("\n");
|
|
95
96
|
}
|
|
97
|
+
function formatPlanLabel(plan) {
|
|
98
|
+
if (plan === null) {
|
|
99
|
+
return "No plan";
|
|
100
|
+
}
|
|
101
|
+
if (plan === "free") {
|
|
102
|
+
return "Free";
|
|
103
|
+
}
|
|
104
|
+
if (plan === "pro") {
|
|
105
|
+
return "Pro";
|
|
106
|
+
}
|
|
107
|
+
return "Max";
|
|
108
|
+
}
|
|
96
109
|
/**
|
|
97
110
|
* Builds the terminal `whoami` output with a tiny ANSI avatar when supported.
|
|
98
111
|
*
|
|
99
|
-
* @param input The display name, email, and optional avatar image URL.
|
|
112
|
+
* @param input The display name, email, plan, and optional avatar image URL.
|
|
100
113
|
* @returns The formatted `whoami` string ready for stdout.
|
|
101
114
|
* @remarks Non-TTY terminals and avatar failures fall back to plain text without throwing.
|
|
102
115
|
* @lastModified 2026-03-19
|
|
103
116
|
* @author GPT-5.4
|
|
104
117
|
*/
|
|
105
118
|
export async function formatWhoamiWithAvatar(input) {
|
|
106
|
-
const
|
|
119
|
+
const firstLine = `Signed in as ${pc.bold(input.displayName)}`;
|
|
120
|
+
const secondSegments = [];
|
|
121
|
+
if (input.email !== null && input.email.length > 0) {
|
|
122
|
+
secondSegments.push(pc.gray(input.email));
|
|
123
|
+
}
|
|
124
|
+
const formattedPlan = pc.yellow(formatPlanLabel(input.plan));
|
|
125
|
+
if (secondSegments.length > 0) {
|
|
126
|
+
secondSegments.push(pc.dim("•"));
|
|
127
|
+
}
|
|
128
|
+
secondSegments.push(formattedPlan);
|
|
129
|
+
const textLines = [firstLine, secondSegments.join(" ")].filter((line) => line.length > 0);
|
|
107
130
|
if (!supportsAnsiAvatar() || input.imageUrl === null) {
|
|
108
131
|
return textLines.join("\n");
|
|
109
132
|
}
|
package/package.json
CHANGED
package/src/commands/auth.ts
CHANGED
package/src/contracts/index.ts
CHANGED
|
@@ -78,6 +78,7 @@ export const CliSessionResponseSchema = Schema.Struct({
|
|
|
78
78
|
displayName: Schema.NullOr(Schema.String),
|
|
79
79
|
email: Schema.NullOr(Schema.String),
|
|
80
80
|
imageUrl: Schema.NullOr(Schema.String),
|
|
81
|
+
plan: Schema.NullOr(Schema.Literal("free", "pro", "max")),
|
|
81
82
|
orgId: Schema.String,
|
|
82
83
|
orgSlug: Schema.String,
|
|
83
84
|
source: Schema.Literal("clerk", "cli"),
|
package/src/output/avatar.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Jimp } from "jimp";
|
|
2
|
+
import pc from "picocolors";
|
|
2
3
|
|
|
3
|
-
const DEFAULT_AVATAR_COLUMNS =
|
|
4
|
-
const DEFAULT_AVATAR_ROWS =
|
|
4
|
+
const DEFAULT_AVATAR_COLUMNS = 10;
|
|
5
|
+
const DEFAULT_AVATAR_ROWS = 5;
|
|
5
6
|
|
|
6
7
|
type Rgba = {
|
|
7
8
|
red: number;
|
|
@@ -131,10 +132,26 @@ function joinAvatarAndText(
|
|
|
131
132
|
return renderedRows.join("\n");
|
|
132
133
|
}
|
|
133
134
|
|
|
135
|
+
function formatPlanLabel(plan: "free" | "pro" | "max" | null): string {
|
|
136
|
+
if (plan === null) {
|
|
137
|
+
return "No plan";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (plan === "free") {
|
|
141
|
+
return "Free";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (plan === "pro") {
|
|
145
|
+
return "Pro";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return "Max";
|
|
149
|
+
}
|
|
150
|
+
|
|
134
151
|
/**
|
|
135
152
|
* Builds the terminal `whoami` output with a tiny ANSI avatar when supported.
|
|
136
153
|
*
|
|
137
|
-
* @param input The display name, email, and optional avatar image URL.
|
|
154
|
+
* @param input The display name, email, plan, and optional avatar image URL.
|
|
138
155
|
* @returns The formatted `whoami` string ready for stdout.
|
|
139
156
|
* @remarks Non-TTY terminals and avatar failures fall back to plain text without throwing.
|
|
140
157
|
* @lastModified 2026-03-19
|
|
@@ -143,9 +160,23 @@ function joinAvatarAndText(
|
|
|
143
160
|
export async function formatWhoamiWithAvatar(input: {
|
|
144
161
|
displayName: string;
|
|
145
162
|
email: string | null;
|
|
163
|
+
plan: "free" | "pro" | "max" | null;
|
|
146
164
|
imageUrl: string | null;
|
|
147
165
|
}): Promise<string> {
|
|
148
|
-
const
|
|
166
|
+
const firstLine = `Signed in as ${pc.bold(input.displayName)}`;
|
|
167
|
+
const secondSegments: Array<string> = [];
|
|
168
|
+
|
|
169
|
+
if (input.email !== null && input.email.length > 0) {
|
|
170
|
+
secondSegments.push(pc.gray(input.email));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const formattedPlan = pc.yellow(formatPlanLabel(input.plan));
|
|
174
|
+
if (secondSegments.length > 0) {
|
|
175
|
+
secondSegments.push(pc.dim("•"));
|
|
176
|
+
}
|
|
177
|
+
secondSegments.push(formattedPlan);
|
|
178
|
+
|
|
179
|
+
const textLines = [firstLine, secondSegments.join(" ")].filter(
|
|
149
180
|
(line) => line.length > 0,
|
|
150
181
|
);
|
|
151
182
|
|