@kevisual/cli 0.1.7 → 0.1.8

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.
@@ -66013,7 +66013,7 @@ function filter(data, query) {
66013
66013
  return executor.execute(ast, data);
66014
66014
  }
66015
66015
 
66016
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
66016
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
66017
66017
  var initApi = async (opts) => {
66018
66018
  const router = opts?.router;
66019
66019
  const item = opts?.item;
@@ -80749,52 +80749,41 @@ class AssistantApp extends Manager2 {
80749
80749
  }
80750
80750
  }
80751
80751
  async checkLocalUser() {
80752
- const config4 = this.config.getConfig();
80753
- const auth = config4?.auth;
80754
- let checkCNB = false;
80755
- if (!auth?.username) {
80756
- checkCNB = true;
80757
- } else {
80758
- let temp = await assistantQuery.queryLogin.getToken();
80759
- if (temp) {
80760
- const isExpired = await assistantQuery.queryLogin.checkTokenValid();
80761
- console.log("Token 是否过期", isExpired);
80762
- }
80763
- logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
80764
- }
80765
- const cnbToken = useKey2("CNB_TOKEN");
80766
- if (!checkCNB && cnbToken) {
80767
- const res = await assistantQuery.query.post({
80768
- path: "user",
80769
- key: "cnb-login",
80770
- payload: {
80771
- data: {
80772
- cnbToken
80773
- }
80774
- }
80752
+ return checkLocalUser({ assistantApp: this });
80753
+ }
80754
+ }
80755
+ var checkLocalUser = async (opts) => {
80756
+ const { assistantApp } = opts;
80757
+ const config4 = assistantApp.config.getConfig();
80758
+ const auth = config4?.auth;
80759
+ let checkCNB = false;
80760
+ if (!auth?.username) {
80761
+ checkCNB = true;
80762
+ } else {
80763
+ let temp = await assistantQuery.getToken();
80764
+ logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
80765
+ }
80766
+ const cnbToken = useKey2("CNB_TOKEN");
80767
+ if (!checkCNB && cnbToken) {
80768
+ const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
80769
+ if (res.code === 200) {
80770
+ logger.info("CNB登录成功,用户信息已更新");
80771
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
80772
+ auth.username = userInfo.username;
80773
+ auth.share = "protected";
80774
+ const app = config4?.app || {};
80775
+ if (!app?.id) {
80776
+ app.id = "dev-cnb";
80777
+ }
80778
+ assistantApp.config.setConfig({
80779
+ auth,
80780
+ app
80775
80781
  });
80776
- if (res.code === 200) {
80777
- logger.info("CNB登录成功,用户信息已更新");
80778
- const resUser = await assistantQuery.queryLogin.beforeSetLoginUser(res.data);
80779
- if (resUser.code === 200) {
80780
- const userInfo = resUser.data;
80781
- auth.username = userInfo.username;
80782
- auth.share = "protected";
80783
- const app = config4?.app || {};
80784
- if (!app?.id) {
80785
- app.id = "dev-cnb";
80786
- }
80787
- this.config.setConfig({
80788
- auth,
80789
- app
80790
- });
80791
- } else {
80792
- console.error("CNB登录失败,无法获取用户信息", resUser);
80793
- }
80794
- }
80782
+ } else {
80783
+ console.error("CNB登录失败,无法获取用户信息", res);
80795
80784
  }
80796
80785
  }
80797
- }
80786
+ };
80798
80787
  // ../node_modules/.pnpm/@kevisual+query@0.0.49/node_modules/@kevisual/query/dist/query.js
80799
80788
  var isTextForContentType2 = (contentType) => {
80800
80789
  if (!contentType)
@@ -81083,7 +81072,7 @@ class Query2 {
81083
81072
  }
81084
81073
  }
81085
81074
 
81086
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
81075
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
81087
81076
  import { homedir as homedir2 } from "node:os";
81088
81077
  import { join, dirname } from "node:path";
81089
81078
  import fs13 from "node:fs";
@@ -82042,6 +82031,21 @@ class QueryLogin extends BaseQuery {
82042
82031
  }
82043
82032
  return res;
82044
82033
  }
82034
+ async loginByCnb(data) {
82035
+ const res = await this.post({
82036
+ path: "user",
82037
+ key: "cnb-login",
82038
+ payload: {
82039
+ data
82040
+ }
82041
+ });
82042
+ if (res.code === 200) {
82043
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
82044
+ this.storage.setItem("token", accessToken || "");
82045
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn });
82046
+ }
82047
+ return res;
82048
+ }
82045
82049
  async checkWechat({ onSuccess, onError }) {
82046
82050
  const url4 = new URL(window.location.href);
82047
82051
  const code = url4.searchParams.get("code");
@@ -82081,8 +82085,17 @@ class QueryLogin extends BaseQuery {
82081
82085
  message: "登录失败"
82082
82086
  };
82083
82087
  }
82088
+ async refreshLoginUser(refreshToken) {
82089
+ const res = await this.queryRefreshToken(refreshToken);
82090
+ if (res.code === 200) {
82091
+ const { accessToken, refreshToken: refreshToken2, accessTokenExpiresIn } = res?.data || {};
82092
+ this.storage.setItem("token", accessToken || "");
82093
+ await this.beforeSetLoginUser({ accessToken, refreshToken: refreshToken2, accessTokenExpiresIn, check401: false });
82094
+ }
82095
+ return res;
82096
+ }
82084
82097
  async queryRefreshToken(refreshToken) {
82085
- const _refreshToken = refreshToken || this.cacheStore.getRefreshToken();
82098
+ const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
82086
82099
  let data = { refreshToken: _refreshToken };
82087
82100
  if (!_refreshToken) {
82088
82101
  await this.cacheStore.clearCurrentUser();
@@ -82181,7 +82194,19 @@ class QueryLogin extends BaseQuery {
82181
82194
  return !!token;
82182
82195
  }
82183
82196
  async checkTokenValid() {
82184
- return this.cacheStore.getIsExpired();
82197
+ const token = this.storage.getItem("token");
82198
+ if (!token) {
82199
+ return null;
82200
+ }
82201
+ const isExpired = await this.cacheStore.getIsExpired();
82202
+ if (isExpired) {
82203
+ const res = await this.refreshLoginUser();
82204
+ if (res.code === 200) {
82205
+ return res.data?.accessToken || null;
82206
+ }
82207
+ return null;
82208
+ }
82209
+ return token;
82185
82210
  }
82186
82211
  async getToken() {
82187
82212
  const token = this.storage.getItem("token");
@@ -82507,8 +82532,14 @@ class AssistantQuery {
82507
82532
  get(body, options) {
82508
82533
  return this.query.get(body, options);
82509
82534
  }
82510
- getToken() {
82511
- return this.queryLogin.getToken();
82535
+ async getToken() {
82536
+ const token = await this.queryLogin.getToken();
82537
+ if (!token)
82538
+ return "";
82539
+ const isExpired = await this.queryLogin.checkTokenValid();
82540
+ console.log("Token 是否过期", isExpired, token);
82541
+ console.log("info", this.queryLogin.cacheStore.cacheData);
82542
+ return token;
82512
82543
  }
82513
82544
  }
82514
82545
  // ../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
@@ -106007,7 +106007,7 @@ function filter(data, query) {
106007
106007
  return executor.execute(ast, data);
106008
106008
  }
106009
106009
 
106010
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
106010
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
106011
106011
  var initApi = async (opts) => {
106012
106012
  const router = opts?.router;
106013
106013
  const item = opts?.item;
@@ -120161,52 +120161,41 @@ class AssistantApp extends Manager2 {
120161
120161
  }
120162
120162
  }
120163
120163
  async checkLocalUser() {
120164
- const config4 = this.config.getConfig();
120165
- const auth = config4?.auth;
120166
- let checkCNB = false;
120167
- if (!auth?.username) {
120168
- checkCNB = true;
120169
- } else {
120170
- let temp = await assistantQuery.queryLogin.getToken();
120171
- if (temp) {
120172
- const isExpired = await assistantQuery.queryLogin.checkTokenValid();
120173
- console.log("Token 是否过期", isExpired);
120174
- }
120175
- logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
120176
- }
120177
- const cnbToken = useKey("CNB_TOKEN");
120178
- if (!checkCNB && cnbToken) {
120179
- const res = await assistantQuery.query.post({
120180
- path: "user",
120181
- key: "cnb-login",
120182
- payload: {
120183
- data: {
120184
- cnbToken
120185
- }
120186
- }
120164
+ return checkLocalUser({ assistantApp: this });
120165
+ }
120166
+ }
120167
+ var checkLocalUser = async (opts) => {
120168
+ const { assistantApp } = opts;
120169
+ const config4 = assistantApp.config.getConfig();
120170
+ const auth = config4?.auth;
120171
+ let checkCNB = false;
120172
+ if (!auth?.username) {
120173
+ checkCNB = true;
120174
+ } else {
120175
+ let temp = await assistantQuery.getToken();
120176
+ logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
120177
+ }
120178
+ const cnbToken = useKey("CNB_TOKEN");
120179
+ if (!checkCNB && cnbToken) {
120180
+ const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
120181
+ if (res.code === 200) {
120182
+ logger.info("CNB登录成功,用户信息已更新");
120183
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
120184
+ auth.username = userInfo.username;
120185
+ auth.share = "protected";
120186
+ const app = config4?.app || {};
120187
+ if (!app?.id) {
120188
+ app.id = "dev-cnb";
120189
+ }
120190
+ assistantApp.config.setConfig({
120191
+ auth,
120192
+ app
120187
120193
  });
120188
- if (res.code === 200) {
120189
- logger.info("CNB登录成功,用户信息已更新");
120190
- const resUser = await assistantQuery.queryLogin.beforeSetLoginUser(res.data);
120191
- if (resUser.code === 200) {
120192
- const userInfo = resUser.data;
120193
- auth.username = userInfo.username;
120194
- auth.share = "protected";
120195
- const app = config4?.app || {};
120196
- if (!app?.id) {
120197
- app.id = "dev-cnb";
120198
- }
120199
- this.config.setConfig({
120200
- auth,
120201
- app
120202
- });
120203
- } else {
120204
- console.error("CNB登录失败,无法获取用户信息", resUser);
120205
- }
120206
- }
120194
+ } else {
120195
+ console.error("CNB登录失败,无法获取用户信息", res);
120207
120196
  }
120208
120197
  }
120209
- }
120198
+ };
120210
120199
  // ../node_modules/.pnpm/@kevisual+query@0.0.49/node_modules/@kevisual/query/dist/query.js
120211
120200
  var isTextForContentType2 = (contentType) => {
120212
120201
  if (!contentType)
@@ -120495,7 +120484,7 @@ class Query2 {
120495
120484
  }
120496
120485
  }
120497
120486
 
120498
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
120487
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
120499
120488
  import { homedir as homedir2 } from "node:os";
120500
120489
  import { join, dirname } from "node:path";
120501
120490
  import fs15 from "node:fs";
@@ -121454,6 +121443,21 @@ class QueryLogin extends BaseQuery {
121454
121443
  }
121455
121444
  return res;
121456
121445
  }
121446
+ async loginByCnb(data) {
121447
+ const res = await this.post({
121448
+ path: "user",
121449
+ key: "cnb-login",
121450
+ payload: {
121451
+ data
121452
+ }
121453
+ });
121454
+ if (res.code === 200) {
121455
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
121456
+ this.storage.setItem("token", accessToken || "");
121457
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn });
121458
+ }
121459
+ return res;
121460
+ }
121457
121461
  async checkWechat({ onSuccess, onError }) {
121458
121462
  const url4 = new URL(window.location.href);
121459
121463
  const code = url4.searchParams.get("code");
@@ -121493,8 +121497,17 @@ class QueryLogin extends BaseQuery {
121493
121497
  message: "登录失败"
121494
121498
  };
121495
121499
  }
121500
+ async refreshLoginUser(refreshToken) {
121501
+ const res = await this.queryRefreshToken(refreshToken);
121502
+ if (res.code === 200) {
121503
+ const { accessToken, refreshToken: refreshToken2, accessTokenExpiresIn } = res?.data || {};
121504
+ this.storage.setItem("token", accessToken || "");
121505
+ await this.beforeSetLoginUser({ accessToken, refreshToken: refreshToken2, accessTokenExpiresIn, check401: false });
121506
+ }
121507
+ return res;
121508
+ }
121496
121509
  async queryRefreshToken(refreshToken) {
121497
- const _refreshToken = refreshToken || this.cacheStore.getRefreshToken();
121510
+ const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
121498
121511
  let data = { refreshToken: _refreshToken };
121499
121512
  if (!_refreshToken) {
121500
121513
  await this.cacheStore.clearCurrentUser();
@@ -121593,7 +121606,19 @@ class QueryLogin extends BaseQuery {
121593
121606
  return !!token;
121594
121607
  }
121595
121608
  async checkTokenValid() {
121596
- return this.cacheStore.getIsExpired();
121609
+ const token = this.storage.getItem("token");
121610
+ if (!token) {
121611
+ return null;
121612
+ }
121613
+ const isExpired = await this.cacheStore.getIsExpired();
121614
+ if (isExpired) {
121615
+ const res = await this.refreshLoginUser();
121616
+ if (res.code === 200) {
121617
+ return res.data?.accessToken || null;
121618
+ }
121619
+ return null;
121620
+ }
121621
+ return token;
121597
121622
  }
121598
121623
  async getToken() {
121599
121624
  const token = this.storage.getItem("token");
@@ -121919,8 +121944,14 @@ class AssistantQuery {
121919
121944
  get(body, options) {
121920
121945
  return this.query.get(body, options);
121921
121946
  }
121922
- getToken() {
121923
- return this.queryLogin.getToken();
121947
+ async getToken() {
121948
+ const token = await this.queryLogin.getToken();
121949
+ if (!token)
121950
+ return "";
121951
+ const isExpired = await this.queryLogin.checkTokenValid();
121952
+ console.log("Token 是否过期", isExpired, token);
121953
+ console.log("info", this.queryLogin.cacheStore.cacheData);
121954
+ return token;
121924
121955
  }
121925
121956
  }
121926
121957
  // ../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
package/dist/assistant.js CHANGED
@@ -51106,7 +51106,7 @@ function filter(data, query) {
51106
51106
  return executor.execute(ast, data);
51107
51107
  }
51108
51108
 
51109
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
51109
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-proxy/router-api-proxy.ts
51110
51110
  var initApi = async (opts) => {
51111
51111
  const router = opts?.router;
51112
51112
  const item = opts?.item;
@@ -71237,7 +71237,7 @@ ${line}`;
71237
71237
  }
71238
71238
  }
71239
71239
 
71240
- // ../node_modules/.pnpm/@kevisual+api@0.0.57_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
71240
+ // ../node_modules/.pnpm/@kevisual+api@0.0.58_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/dist/query-login-node.js
71241
71241
  import { homedir as homedir2 } from "node:os";
71242
71242
  import { join, dirname } from "node:path";
71243
71243
  import fs12 from "node:fs";
@@ -72196,6 +72196,21 @@ class QueryLogin extends BaseQuery {
72196
72196
  }
72197
72197
  return res;
72198
72198
  }
72199
+ async loginByCnb(data) {
72200
+ const res = await this.post({
72201
+ path: "user",
72202
+ key: "cnb-login",
72203
+ payload: {
72204
+ data
72205
+ }
72206
+ });
72207
+ if (res.code === 200) {
72208
+ const { accessToken, refreshToken, accessTokenExpiresIn } = res?.data || {};
72209
+ this.storage.setItem("token", accessToken || "");
72210
+ await this.beforeSetLoginUser({ accessToken, refreshToken, accessTokenExpiresIn });
72211
+ }
72212
+ return res;
72213
+ }
72199
72214
  async checkWechat({ onSuccess, onError }) {
72200
72215
  const url4 = new URL(window.location.href);
72201
72216
  const code = url4.searchParams.get("code");
@@ -72235,8 +72250,17 @@ class QueryLogin extends BaseQuery {
72235
72250
  message: "登录失败"
72236
72251
  };
72237
72252
  }
72253
+ async refreshLoginUser(refreshToken) {
72254
+ const res = await this.queryRefreshToken(refreshToken);
72255
+ if (res.code === 200) {
72256
+ const { accessToken, refreshToken: refreshToken2, accessTokenExpiresIn } = res?.data || {};
72257
+ this.storage.setItem("token", accessToken || "");
72258
+ await this.beforeSetLoginUser({ accessToken, refreshToken: refreshToken2, accessTokenExpiresIn, check401: false });
72259
+ }
72260
+ return res;
72261
+ }
72238
72262
  async queryRefreshToken(refreshToken) {
72239
- const _refreshToken = refreshToken || this.cacheStore.getRefreshToken();
72263
+ const _refreshToken = refreshToken || await this.cacheStore.getRefreshToken();
72240
72264
  let data = { refreshToken: _refreshToken };
72241
72265
  if (!_refreshToken) {
72242
72266
  await this.cacheStore.clearCurrentUser();
@@ -72335,7 +72359,19 @@ class QueryLogin extends BaseQuery {
72335
72359
  return !!token;
72336
72360
  }
72337
72361
  async checkTokenValid() {
72338
- return this.cacheStore.getIsExpired();
72362
+ const token = this.storage.getItem("token");
72363
+ if (!token) {
72364
+ return null;
72365
+ }
72366
+ const isExpired = await this.cacheStore.getIsExpired();
72367
+ if (isExpired) {
72368
+ const res = await this.refreshLoginUser();
72369
+ if (res.code === 200) {
72370
+ return res.data?.accessToken || null;
72371
+ }
72372
+ return null;
72373
+ }
72374
+ return token;
72339
72375
  }
72340
72376
  async getToken() {
72341
72377
  const token = this.storage.getItem("token");
@@ -72661,8 +72697,14 @@ class AssistantQuery {
72661
72697
  get(body, options) {
72662
72698
  return this.query.get(body, options);
72663
72699
  }
72664
- getToken() {
72665
- return this.queryLogin.getToken();
72700
+ async getToken() {
72701
+ const token = await this.queryLogin.getToken();
72702
+ if (!token)
72703
+ return "";
72704
+ const isExpired = await this.queryLogin.checkTokenValid();
72705
+ console.log("Token 是否过期", isExpired, token);
72706
+ console.log("info", this.queryLogin.cacheStore.cacheData);
72707
+ return token;
72666
72708
  }
72667
72709
  }
72668
72710
 
@@ -87264,52 +87306,41 @@ class AssistantApp extends Manager2 {
87264
87306
  }
87265
87307
  }
87266
87308
  async checkLocalUser() {
87267
- const config5 = this.config.getConfig();
87268
- const auth = config5?.auth;
87269
- let checkCNB = false;
87270
- if (!auth?.username) {
87271
- checkCNB = true;
87272
- } else {
87273
- let temp = await assistantQuery.queryLogin.getToken();
87274
- if (temp) {
87275
- const isExpired = await assistantQuery.queryLogin.checkTokenValid();
87276
- console.log("Token 是否过期", isExpired);
87277
- }
87278
- logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
87279
- }
87280
- const cnbToken = useKey2("CNB_TOKEN");
87281
- if (!checkCNB && cnbToken) {
87282
- const res = await assistantQuery.query.post({
87283
- path: "user",
87284
- key: "cnb-login",
87285
- payload: {
87286
- data: {
87287
- cnbToken
87288
- }
87289
- }
87309
+ return checkLocalUser({ assistantApp: this });
87310
+ }
87311
+ }
87312
+ var checkLocalUser = async (opts) => {
87313
+ const { assistantApp } = opts;
87314
+ const config5 = assistantApp.config.getConfig();
87315
+ const auth = config5?.auth;
87316
+ let checkCNB = false;
87317
+ if (!auth?.username) {
87318
+ checkCNB = true;
87319
+ } else {
87320
+ let temp = await assistantQuery.getToken();
87321
+ logger.info("[assistant] 当前登录用户", auth.username, "token有效性检查结果", !!temp);
87322
+ }
87323
+ const cnbToken = useKey2("CNB_TOKEN");
87324
+ if (!checkCNB && cnbToken) {
87325
+ const res = await assistantQuery.queryLogin.loginByCnb({ cnbToken });
87326
+ if (res.code === 200) {
87327
+ logger.info("CNB登录成功,用户信息已更新");
87328
+ const userInfo = await assistantQuery.queryLogin.checkLocalUser();
87329
+ auth.username = userInfo.username;
87330
+ auth.share = "protected";
87331
+ const app2 = config5?.app || {};
87332
+ if (!app2?.id) {
87333
+ app2.id = "dev-cnb";
87334
+ }
87335
+ assistantApp.config.setConfig({
87336
+ auth,
87337
+ app: app2
87290
87338
  });
87291
- if (res.code === 200) {
87292
- logger.info("CNB登录成功,用户信息已更新");
87293
- const resUser = await assistantQuery.queryLogin.beforeSetLoginUser(res.data);
87294
- if (resUser.code === 200) {
87295
- const userInfo = resUser.data;
87296
- auth.username = userInfo.username;
87297
- auth.share = "protected";
87298
- const app2 = config5?.app || {};
87299
- if (!app2?.id) {
87300
- app2.id = "dev-cnb";
87301
- }
87302
- this.config.setConfig({
87303
- auth,
87304
- app: app2
87305
- });
87306
- } else {
87307
- console.error("CNB登录失败,无法获取用户信息", resUser);
87308
- }
87309
- }
87339
+ } else {
87340
+ console.error("CNB登录失败,无法获取用户信息", res);
87310
87341
  }
87311
87342
  }
87312
- }
87343
+ };
87313
87344
  // src/config.ts
87314
87345
  var _configDir2 = parseHomeArg(configDir).configDir;
87315
87346
  var configDir3 = AssistantConfig.detectConfigDir(_configDir2);
@@ -109221,7 +109252,7 @@ program.addCommand(pluginCommand);
109221
109252
  var me = new Command("me").description("查看当前用户信息").action(async () => {
109222
109253
  const aq = new AssistantQuery(assistantConfig3);
109223
109254
  await aq.init();
109224
- const info = await aq.queryLogin.checkLocalUser();
109255
+ const info = await aq.getToken();
109225
109256
  logger.info(info);
109226
109257
  });
109227
109258
  program.addCommand(me);