@impractical-ai/motion 0.1.1 → 0.1.3

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/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  ApiError,
4
4
  invoke,
5
+ invokeAt,
5
6
  jobStatus,
6
7
  loadConfig,
7
8
  requireConfig,
@@ -10,7 +11,7 @@ import {
10
11
  studioLink,
11
12
  waitForJobs,
12
13
  withMeteredCall
13
- } from "./chunk-2RJVXP4V.js";
14
+ } from "./chunk-G56RK3HD.js";
14
15
 
15
16
  // src/index.ts
16
17
  import { parseArgs } from "node:util";
@@ -1213,20 +1214,28 @@ async function login(flags) {
1213
1214
  if (key) patch.apiKey = key;
1214
1215
  if (supabaseUrl) patch.supabaseUrl = supabaseUrl;
1215
1216
  if (appUrl) patch.appUrl = appUrl;
1216
- if (Object.keys(patch).length) saveConfig(patch);
1217
- const config = loadConfig();
1217
+ const config = { ...loadConfig(), ...patch };
1218
1218
  if (!config.apiKey || !config.supabaseUrl) {
1219
1219
  out("Missing API key. Run: npx --yes @impractical-ai/motion setup --claude");
1220
1220
  process.exitCode = 1;
1221
1221
  return;
1222
1222
  }
1223
- await whoami({});
1223
+ const snapshot = await invokeAt(
1224
+ config.supabaseUrl,
1225
+ "workspace-bootstrap",
1226
+ {},
1227
+ config.apiKey
1228
+ );
1229
+ if (Object.keys(patch).length) saveConfig(patch);
1230
+ out(`org: ${snapshot.orgId}`);
1231
+ out(`plan: ${snapshot.plan} (access: ${snapshot.hasAccess ? "yes" : "no"})`);
1232
+ if (snapshot.accessUntil) out(`access until: ${snapshot.accessUntil}`);
1224
1233
  out("Logged in. Credentials stored in ~/.impractical/config.json");
1225
1234
  }
1226
1235
  async function whoami(_flags) {
1227
1236
  const snapshot = await invoke("workspace-bootstrap");
1228
1237
  out(`org: ${snapshot.orgId}`);
1229
- out(`plan: ${snapshot.status} (access: ${snapshot.hasAccess ? "yes" : "no"})`);
1238
+ out(`plan: ${snapshot.plan} (access: ${snapshot.hasAccess ? "yes" : "no"})`);
1230
1239
  if (snapshot.accessUntil) out(`access until: ${snapshot.accessUntil}`);
1231
1240
  }
1232
1241
  async function keys(positional, flags) {
@@ -1463,6 +1472,32 @@ async function brand(positional, flags) {
1463
1472
  }
1464
1473
  throw new Error(`Unknown brand action "${action}" (use: extract, list, get)`);
1465
1474
  }
1475
+ function validateMeteredCommand(command, positional, flags) {
1476
+ if (command === "generate" && !flagString(flags, "value-prop")) {
1477
+ throw new Error('Usage: impractical generate --value-prop "..." [--wait]');
1478
+ }
1479
+ if (command === "status" && !flagString(flags, "project") && !flagString(flags, "jobs")) {
1480
+ throw new Error("Usage: impractical status --project <id> | --jobs <id,id> [--wait]");
1481
+ }
1482
+ if (command === "export" && !positional[0]) {
1483
+ throw new Error("Usage: impractical export <draftId> [--wait] [--out video.mp4]");
1484
+ }
1485
+ if (command === "upload" && (!positional[0] || !flagString(flags, "project") || !flagString(flags, "draft"))) {
1486
+ throw new Error("Usage: impractical upload <file> --project <projectId> --draft <draftId>");
1487
+ }
1488
+ if (command === "brand") {
1489
+ const action = positional[0];
1490
+ if (action === "extract" && !positional[1]) {
1491
+ throw new Error("Usage: impractical brand extract <url> [--wait]");
1492
+ }
1493
+ if (action === "get" && !positional[1]) {
1494
+ throw new Error("Usage: impractical brand get <slug>");
1495
+ }
1496
+ if (action && !["extract", "list", "get"].includes(action)) {
1497
+ throw new Error(`Unknown brand action "${action}" (use: extract, list, get)`);
1498
+ }
1499
+ }
1500
+ }
1466
1501
 
1467
1502
  // src/index.ts
1468
1503
  var HELP = `impractical \u2014 Impractical Motion from your terminal (and your coding agent)
@@ -1539,7 +1574,7 @@ async function main() {
1539
1574
  if (rest[0] === "wizard") return setup2(flags);
1540
1575
  break;
1541
1576
  case "mcp": {
1542
- const { runStdioServer } = await import("./stdio-PNR6LK5Q.js");
1577
+ const { runStdioServer } = await import("./stdio-VWTZOK6D.js");
1543
1578
  return runStdioServer();
1544
1579
  }
1545
1580
  case "login":
@@ -1549,8 +1584,10 @@ async function main() {
1549
1584
  case "keys":
1550
1585
  return keys(rest, flags);
1551
1586
  case "generate":
1587
+ validateMeteredCommand("generate", rest, flags);
1552
1588
  return withMeteredCall("cli_generate", () => generate(flags));
1553
1589
  case "status":
1590
+ validateMeteredCommand("status", rest, flags);
1554
1591
  return withMeteredCall("cli_status", () => status(flags));
1555
1592
  case "pull":
1556
1593
  case "push":
@@ -1559,12 +1596,15 @@ async function main() {
1559
1596
  npx --yes @impractical-ai/motion setup --claude`
1560
1597
  );
1561
1598
  case "export":
1599
+ validateMeteredCommand("export", rest, flags);
1562
1600
  return withMeteredCall("cli_export", () => exportDraft(rest, flags));
1563
1601
  case "upload":
1602
+ validateMeteredCommand("upload", rest, flags);
1564
1603
  return withMeteredCall("cli_upload", () => upload(rest, flags));
1565
1604
  case "link":
1566
1605
  return link(rest, flags);
1567
1606
  case "brand":
1607
+ validateMeteredCommand("brand", rest, flags);
1568
1608
  return withMeteredCall("cli_brand", () => brand(rest, flags));
1569
1609
  default:
1570
1610
  console.log(HELP);