install

// Menu: Copy GitHub user name
// Description: Copies a GitHub user's first name, fallback to @login
// Author: Gregor Martynus
// Twitter: @gr2m
const { Octokit } = await npm("octokit");
const { createOAuthDeviceAuth } = await npm("@octokit/auth-oauth-device");
// set GitHub Token unless it's already set
let octokit;
if (env.GITHUB_TOKEN_NO_SCOPES) {
octokit = new Octokit({
auth: env.GITHUB_TOKEN_NO_SCOPES,
});
} else {
const auth = createOAuthDeviceAuth({
clientType: "oauth-app",
clientId: "34e4eac44e03b0daa82b",
onVerification(verification) {
copy(verification.user_code);
arg({
placeholder: `Press <enter> after granting permissions`,
ignoreBlur: true,
hint: `
Open <a href="${verification.verification_uri}">${verification.verification_uri}</a>, paste code from clipboard
`,
});
},
});
const { token } = await auth({
type: "oauth",
});
octokit = new Octokit({
auth: token,
});
await cli("set-env-var", "GITHUB_TOKEN_NO_SCOPES", token);
}
const { data: me } = await octokit.rest.users.getAuthenticated();
const username = await arg("Enter a GitHub username:");
let { data: user } = await octokit.rest.users.getByUsername({ username });
const userFirstNameOrUsername = user.name.trim()
? user.name.trim().split(/\s+/)[0]
: `@${user.login}`;
copy(userFirstNameOrUsername);
setPlaceholder(`"${userFirstNameOrUsername}" copied to your clipboard`);
setIgnoreBlur(false);
setHint(`Press esc to close this prompt`);

PS: I tried to publish via the built-in publish feature, but it doesn't work for me: https://github.com/johnlindquist/kit/issues/219. I created the install link above manually based on your link here: https://github.com/johnlindquist/kit/discussions/217