@tscircuit/cli 0.1.223 → 0.1.224
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/main.js +43 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -63256,7 +63256,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
63256
63256
|
import { execSync as execSync2 } from "node:child_process";
|
|
63257
63257
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
63258
63258
|
// package.json
|
|
63259
|
-
var version = "0.1.
|
|
63259
|
+
var version = "0.1.223";
|
|
63260
63260
|
var package_default = {
|
|
63261
63261
|
name: "@tscircuit/cli",
|
|
63262
63262
|
version,
|
|
@@ -72357,6 +72357,47 @@ var registerAuthSetToken = (program3) => {
|
|
|
72357
72357
|
});
|
|
72358
72358
|
};
|
|
72359
72359
|
|
|
72360
|
+
// cli/auth/whoami/register.ts
|
|
72361
|
+
var registerAuthWhoami = (program3) => {
|
|
72362
|
+
program3.commands.find((c) => c.name() === "auth").command("whoami").description("Show information about the current authenticated user").action(async () => {
|
|
72363
|
+
const sessionToken = getSessionToken();
|
|
72364
|
+
if (!sessionToken) {
|
|
72365
|
+
console.log("You need to log in to access this.");
|
|
72366
|
+
return;
|
|
72367
|
+
}
|
|
72368
|
+
const ky2 = getRegistryApiKy({ sessionToken });
|
|
72369
|
+
const githubUsernameFromConfig = cliConfig.get("githubUsername");
|
|
72370
|
+
const accountIdFromConfig = cliConfig.get("accountId");
|
|
72371
|
+
let account;
|
|
72372
|
+
if (githubUsernameFromConfig && !accountIdFromConfig) {
|
|
72373
|
+
const tryFetchAccount = async (username) => {
|
|
72374
|
+
try {
|
|
72375
|
+
const { account: account2 } = await ky2.post("accounts/get", {
|
|
72376
|
+
json: { github_username: username }
|
|
72377
|
+
}).json();
|
|
72378
|
+
return account2;
|
|
72379
|
+
} catch {
|
|
72380
|
+
return;
|
|
72381
|
+
}
|
|
72382
|
+
};
|
|
72383
|
+
account = await tryFetchAccount(githubUsernameFromConfig);
|
|
72384
|
+
if (!account && process.env.TSCI_TEST_MODE === "true") {
|
|
72385
|
+
const sanitized = githubUsernameFromConfig.replace(/[^a-zA-Z0-9]/g, "");
|
|
72386
|
+
if (sanitized && sanitized !== githubUsernameFromConfig) {
|
|
72387
|
+
account = await tryFetchAccount(sanitized);
|
|
72388
|
+
}
|
|
72389
|
+
}
|
|
72390
|
+
}
|
|
72391
|
+
const githubUsername = account?.github_username ?? githubUsernameFromConfig ?? "(unknown)";
|
|
72392
|
+
const accountId = account?.account_id ?? accountIdFromConfig ?? "(unknown)";
|
|
72393
|
+
console.log("Currently logged in user:");
|
|
72394
|
+
console.log(` GitHub Username: ${githubUsername}`);
|
|
72395
|
+
console.log(` Account ID: ${accountId}`);
|
|
72396
|
+
const sessionId = cliConfig.get("sessionId");
|
|
72397
|
+
console.log(` Session ID: ${sessionId ?? "(unknown)"}`);
|
|
72398
|
+
});
|
|
72399
|
+
};
|
|
72400
|
+
|
|
72360
72401
|
// cli/push/register.ts
|
|
72361
72402
|
var registerPush = (program3) => {
|
|
72362
72403
|
program3.command("push").description("Save snippet code to Registry API").argument("[file]", "Path to the snippet file").option("--private", "Make the snippet private").action(async (filePath, options = {}) => {
|
|
@@ -179740,6 +179781,7 @@ registerAuthLogin(program2);
|
|
|
179740
179781
|
registerAuthLogout(program2);
|
|
179741
179782
|
registerAuthPrintToken(program2);
|
|
179742
179783
|
registerAuthSetToken(program2);
|
|
179784
|
+
registerAuthWhoami(program2);
|
|
179743
179785
|
registerConfig(program2);
|
|
179744
179786
|
registerConfigPrint(program2);
|
|
179745
179787
|
registerConfigSet(program2);
|