smashspace 0.1.5 → 0.1.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.
Files changed (2) hide show
  1. package/dist/smash.mjs +22 -0
  2. package/package.json +1 -1
package/dist/smash.mjs CHANGED
@@ -4531,8 +4531,30 @@ program2.command("login").description(
4531
4531
  ).option(
4532
4532
  "--token <token>",
4533
4533
  "Skip the browser flow and save the provided token directly"
4534
+ ).option(
4535
+ "-f, --force",
4536
+ "Re-issue a token even if a valid one is already saved"
4534
4537
  ).action(async (opts) => {
4535
4538
  const baseUrl = resolveBaseUrl();
4539
+ if (!opts.token && !opts.force) {
4540
+ const existing = await resolveToken(baseUrl);
4541
+ if (existing) {
4542
+ const check = await fetch(new URL("/api/usage/me", baseUrl), {
4543
+ headers: { Authorization: `Bearer ${existing}` }
4544
+ }).catch(() => null);
4545
+ if (check?.ok) {
4546
+ const me2 = await check.json();
4547
+ show(
4548
+ { baseUrl, userId: me2.userId, alreadySignedIn: true },
4549
+ [
4550
+ `\u2713 already signed in as ${me2.userId} on ${baseUrl} \u2014 saved token is valid, nothing to do.`,
4551
+ ` (use 'smash login --force' to re-issue)`
4552
+ ]
4553
+ );
4554
+ return;
4555
+ }
4556
+ }
4557
+ }
4536
4558
  let token = opts.token?.trim();
4537
4559
  if (!token) {
4538
4560
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smashspace",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "SmashSpace CLI + MCP — operate SmashSpace boards from your terminal, Claude Code, Cursor, and Codex.",
5
5
  "type": "module",
6
6
  "bin": {