@movp/cli 1.0.0 → 1.0.1

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/bin/cli.js +8 -3
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -94,6 +94,11 @@ function sleep(ms) {
94
94
  return new Promise((resolve) => setTimeout(resolve, ms));
95
95
  }
96
96
 
97
+ // BFF wraps all /api/* responses in { data: ... }
98
+ function unwrap(body) {
99
+ return (body && typeof body === "object" && "data" in body) ? body.data : body;
100
+ }
101
+
97
102
  function postJSON(baseUrl, urlPath, body, extraHeaders = {}) {
98
103
  return new Promise((resolve, reject) => {
99
104
  const data = JSON.stringify(body);
@@ -606,7 +611,7 @@ async function runInit(forcedTool, { noRules = false } = {}) {
606
611
  "X-Tenant-ID": tenantId,
607
612
  });
608
613
  if (res.status === 200 || res.status === 201) {
609
- apiKey = res.body.api_key || res.body.apiKey || "";
614
+ apiKey = unwrap(res.body).api_key || unwrap(res.body).apiKey || "";
610
615
  if (apiKey) {
611
616
  console.log(" Agent source created.");
612
617
  // Persist api_key to credentials file
@@ -863,7 +868,7 @@ async function runLogin() {
863
868
  }
864
869
 
865
870
  const { device_code, user_code, verification_uri_complete, expires_in, interval } =
866
- authorizeRes.body;
871
+ unwrap(authorizeRes.body);
867
872
 
868
873
  console.log(` Your verification code: ${user_code}`);
869
874
  console.log(`\n Open this URL to approve:\n`);
@@ -900,7 +905,7 @@ async function runLogin() {
900
905
  }
901
906
 
902
907
  if (tokenRes.status === 200) {
903
- const { status, user_id, tenant_id } = tokenRes.body;
908
+ const { status, user_id, tenant_id } = unwrap(tokenRes.body);
904
909
  if (status === "authorized") {
905
910
  console.log("\n\n Login successful!\n");
906
911
  const credPath = writeCredentials(bffUrl, user_id, tenant_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movp/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MoVP CLI — configure AI coding tools with the MoVP control plane (PostToolUse hook + MCP setup)",
5
5
  "main": "hook.js",
6
6
  "bin": {