@glasshome/widget-cli 0.4.11 → 0.4.12

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/bin/cli.ts CHANGED
@@ -66,7 +66,12 @@ const { values: flags, positionals } = parseArgs({
66
66
  strict: false,
67
67
  });
68
68
 
69
- const explicitDir = flags.dir;
69
+ // strict:false widens every flag to string | boolean | undefined; a bare
70
+ // `--flag` with no value parses as `true`, which no string option accepts.
71
+ const str = (v: string | boolean | undefined): string | undefined =>
72
+ typeof v === "string" ? v : undefined;
73
+
74
+ const explicitDir = str(flags.dir);
70
75
  const [command, ...args] = positionals;
71
76
 
72
77
  if (command === "help" || flags.help) {
@@ -144,9 +149,9 @@ switch (effectiveCommand) {
144
149
  const hubUrlArg = args[0];
145
150
  const { runPublish } = await import("../src/commands/publish");
146
151
  await runPublish(resolveWidgetDir(), hubUrlArg, {
147
- name: flags.name,
148
- bump: flags.bump as "keep" | "patch" | "minor" | "major" | undefined,
149
- scope: flags.scope,
152
+ name: str(flags.name),
153
+ bump: str(flags.bump) as "keep" | "patch" | "minor" | "major" | undefined,
154
+ scope: str(flags.scope),
150
155
  });
151
156
  outro("Done");
152
157
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-cli",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "description": "CLI for creating and managing GlassHome widgets",
5
5
  "type": "module",
6
6
  "bin": {
@@ -216,19 +216,19 @@ export async function runConnect(apiUrl: string, cwd: string): Promise<void> {
216
216
  });
217
217
 
218
218
  if (res.ok) {
219
- // better-auth's device-authorization plugin returns a
220
- // first-party session, not an OIDC token bundle. The bearer is
221
- // session.token; expiry is session.expiresAt (ISO/epoch/Date).
219
+ // better-auth's device-authorization plugin returns an OAuth-style
220
+ // bundle: { access_token, token_type, expires_in, scope }. The
221
+ // access_token IS the first-party session token.
222
222
  const data = (await res.json()) as {
223
- session?: { token: string; expiresAt: string | number | Date };
224
- user?: unknown;
223
+ access_token?: string;
224
+ expires_in?: number;
225
225
  };
226
- if (!data.session?.token) {
226
+ if (!data.access_token) {
227
227
  s.stop("Auth response missing session token");
228
228
  break;
229
229
  }
230
- token = data.session.token;
231
- const tokenExpiresAt = new Date(data.session.expiresAt).getTime();
230
+ token = data.access_token;
231
+ const tokenExpiresAt = Date.now() + (data.expires_in ?? 0) * 1000;
232
232
  storeHostToken(host, token, tokenExpiresAt);
233
233
  break;
234
234
  }