ops-toolkit 1.1.0 → 1.2.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.
@@ -9,7 +9,16 @@ const execAsync = promisify(exec);
9
9
  // 系统工具函数
10
10
  export class SystemUtils {
11
11
  // 获取系统信息
12
- static async getSystemInfo() {
12
+ static async getSystemInfo(): Promise<{
13
+ hostname: string;
14
+ platform: string;
15
+ arch: string;
16
+ uptime: number;
17
+ loadAverage: number[];
18
+ totalMemory: number;
19
+ freeMemory: number;
20
+ cpus: os.CpuInfo[];
21
+ }> {
13
22
  const info = {
14
23
  hostname: os.hostname(),
15
24
  platform: os.platform(),
@@ -136,7 +145,15 @@ export class SystemUtils {
136
145
  }
137
146
 
138
147
  // 获取进程列表
139
- static async getProcessList(): Promise<any[]> {
148
+ static async getProcessList(): Promise<
149
+ Array<{
150
+ pid: number;
151
+ user: string;
152
+ cpu: number;
153
+ memory: number;
154
+ command: string;
155
+ }>
156
+ > {
140
157
  try {
141
158
  const platform = os.platform();
142
159
  let command = '';
@@ -159,7 +176,13 @@ export class SystemUtils {
159
176
  }
160
177
  }
161
178
 
162
- private static parseProcessList(output: string): any[] {
179
+ private static parseProcessList(output: string): Array<{
180
+ pid: number;
181
+ user: string;
182
+ cpu: number;
183
+ memory: number;
184
+ command: string;
185
+ }> {
163
186
  const lines = output.split('\n').slice(1); // 跳过标题行
164
187
  const processes = [];
165
188