@dreamor/atlas-cli 0.7.5 → 0.7.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.
@@ -7,7 +7,6 @@ const _require = createRequire(import.meta.url);
7
7
  const BANMA_HOST = 'banma-yuntu.alibaba-inc.com';
8
8
  // 白名单:只保存 getBanmaIdentity 真正需要的 cookies,避免整域 cookies 落盘
9
9
  const WANT_COOKIES = new Set(['access_token', 'buc_username', 'buc_userinfo']);
10
- const EMP_ID_NAMES = new Set(['emp_id', 'empId', 'employeeId']);
11
10
  /**
12
11
  * 动态加载 playwright。顶层静态 import 会让单文件 bundle 在未安装 playwright 的
13
12
  * 环境下无法启动(连 --version 都 require 失败),故改为运行时动态 import + try/catch
@@ -99,10 +98,11 @@ export async function loginStatus() {
99
98
  try {
100
99
  const daemonCookies = await fetchCookiesFromDaemon();
101
100
  if (daemonCookies && daemonCookies.length > 0) {
102
- const empIdCookie = daemonCookies.find((c) => EMP_ID_NAMES.has(c.name));
101
+ const { getBanmaIdentity } = await import('./session.js');
102
+ const identity = getBanmaIdentity(daemonCookies);
103
103
  return {
104
104
  loggedIn: true,
105
- account: empIdCookie?.value ?? 'via-daemon',
105
+ account: identity?.staffId || identity?.user || 'via-daemon',
106
106
  mode: 'daemon',
107
107
  };
108
108
  }
@@ -113,10 +113,11 @@ export async function loginStatus() {
113
113
  // Check local cookies
114
114
  const cookies = await readCookies();
115
115
  if (cookies && cookies.length > 0) {
116
- const empIdCookie = cookies.find((c) => EMP_ID_NAMES.has(c.name));
116
+ const { getBanmaIdentity } = await import('./session.js');
117
+ const identity = getBanmaIdentity(cookies);
117
118
  return {
118
119
  loggedIn: true,
119
- account: empIdCookie?.value ?? 'cookies-present',
120
+ account: identity?.staffId || identity?.user || '已登录',
120
121
  mode: 'local',
121
122
  };
122
123
  }
@@ -1 +1 @@
1
- export const ATLAS_VERSION = '0.7.5';
1
+ export const ATLAS_VERSION = '0.7.6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamor/atlas-cli",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "Atlas CLI - 斑马云图人力基线管理工具",
5
5
  "type": "module",
6
6
  "bin": {