@aidalinfo/aegis-agent 0.1.0 → 0.1.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/dist/bin.js +19 -3
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -126,13 +126,20 @@ async function collectTemperature() {
126
126
  }
127
127
 
128
128
  // src/collector.ts
129
+ import { type as osType, release as osRelease, uptime as osUptime } from "os";
129
130
  async function collectMetrics(config) {
130
131
  const [cpu, memory, disks] = await Promise.all([
131
132
  collectCpu(),
132
133
  collectMemory(),
133
134
  collectDisk()
134
135
  ]);
135
- const metrics = { cpu, memory, disks };
136
+ const metrics = {
137
+ cpu,
138
+ memory,
139
+ disks,
140
+ os: `${osType()} ${osRelease()}`,
141
+ uptimeSeconds: Math.round(osUptime())
142
+ };
136
143
  if (config.mode === "full") {
137
144
  const [network, swap, topProcesses, temperature] = await Promise.all([
138
145
  collectNetwork(),
@@ -264,9 +271,18 @@ var install = defineCommand({
264
271
  async run({ args }) {
265
272
  let binaryPath;
266
273
  try {
267
- binaryPath = execSync2("which aegis-agent").toString().trim();
274
+ binaryPath = execSync2("which aegis-agent", { stdio: "pipe" }).toString().trim();
268
275
  } catch {
269
- binaryPath = process.argv[1];
276
+ console.log("[aegis-agent] Not found in PATH \u2014 installing globally via npm...");
277
+ try {
278
+ execSync2("npm install -g @aidalinfo/aegis-agent", { stdio: "inherit" });
279
+ binaryPath = execSync2("which aegis-agent", { stdio: "pipe" }).toString().trim();
280
+ } catch {
281
+ console.error(
282
+ "[aegis-agent] Global install failed.\nRun manually: npm install -g @aidalinfo/aegis-agent\nThen: aegis-agent install ..."
283
+ );
284
+ process.exit(1);
285
+ }
270
286
  }
271
287
  const config = ConfigSchema.parse({
272
288
  endpoint: args.endpoint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidalinfo/aegis-agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Lightweight monitoring agent for Linux machines — pushes system metrics to Aegis",
5
5
  "license": "MIT",
6
6
  "type": "module",