@baclet/cli 0.1.3 → 0.1.4

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 CHANGED
@@ -26,12 +26,13 @@ Node.js 18 or later is required.
26
26
  | --- | --- |
27
27
  | `baclet login [--qr\|--link]` | Authorize this machine with a QR code, a link, or both. |
28
28
  | `baclet logout` | Remove local credentials and revoke the CLI token. |
29
- | `baclet whoami` | Show the authorized account. |
29
+ | `baclet whoami` | Show the authorized user's name and email. |
30
30
  | `baclet init [--publishable-key KEY]` | Create `baclet.config.ts`, selecting a project when logged in. |
31
31
  | `baclet projects list` | List projects you can access. |
32
32
  | `baclet db status` | Print the schema diff without applying it. |
33
33
  | `baclet db push [--yes]` | Apply the schema diff after confirmation. |
34
34
  | `baclet db migrate [--yes]` | Alias for `db push`. |
35
+ | `baclet --version` | Print the CLI version. |
35
36
 
36
37
  ## Login
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baclet/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "BACLET command line tool for authentication and schema pushes",
5
5
  "type": "module",
6
6
  "bin": {
@@ -74,6 +74,6 @@ export async function whoami() {
74
74
  const creds = await requireCredentials();
75
75
  const payload = await request({ method: "GET", path: "/api/v1/me", token: creds.accessToken });
76
76
  const profile = payload.user || payload;
77
- console.log(`${profile.fullName || profile.email} <${profile.email}>`);
78
- console.log(`User ID: ${profile.id}`);
77
+ const name = profile.full_name || profile.fullName || profile.email;
78
+ console.log(name === profile.email ? profile.email : `${name} <${profile.email}>`);
79
79
  }
package/src/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
2
3
  import { login, logout, whoami } from "./commands/auth.js";
3
4
  import { init, listProjects, dbStatus, dbPush } from "./commands/project.js";
4
5
 
6
+ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
7
+
5
8
  const help = `BACLET CLI
6
9
 
7
10
  Usage:
@@ -13,11 +16,8 @@ Usage:
13
16
  baclet db status Show the schema diff without applying it
14
17
  baclet db push [--yes] Apply the schema to your project database
15
18
  baclet db migrate [--yes] Alias for db push
19
+ baclet --version Print the CLI version
16
20
  baclet --help Show this message
17
-
18
- Environment:
19
- BACLET_API_URL API base URL (default https://api.baclet.app)
20
- BACLET_DASHBOARD_URL Dashboard URL (default https://baclet.app)
21
21
  `;
22
22
 
23
23
  async function main() {
@@ -34,6 +34,10 @@ async function main() {
34
34
  if (args[0] === "status") return dbStatus();
35
35
  if (args[0] === "push" || args[0] === "migrate") return dbPush(args.slice(1));
36
36
  throw new Error("Usage: baclet db status|push|migrate");
37
+ case "--version":
38
+ case "-v":
39
+ process.stdout.write(`${version}\n`);
40
+ return;
37
41
  case "--help":
38
42
  case "-h":
39
43
  case undefined: