cnagent 2.0.6 → 2.0.7
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.
- package/bin/cn +21 -2
- package/package.json +1 -1
package/bin/cn
CHANGED
|
@@ -11,7 +11,7 @@ const { execSync, spawn } = require('child_process');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
|
|
14
|
-
const VERSION = '2.0.
|
|
14
|
+
const VERSION = '2.0.7';
|
|
15
15
|
|
|
16
16
|
// Colors (respects NO_COLOR)
|
|
17
17
|
const noColor = process.env.NO_COLOR !== undefined;
|
|
@@ -291,15 +291,34 @@ function writeRuntimeMd(hubPath, cnVersion) {
|
|
|
291
291
|
}).trim();
|
|
292
292
|
} catch {}
|
|
293
293
|
|
|
294
|
+
// Gather runtime info
|
|
295
|
+
const nodeVersion = process.version;
|
|
296
|
+
const platform = `${process.platform} ${process.arch}`;
|
|
297
|
+
const hubName = deriveName(hubPath);
|
|
298
|
+
|
|
299
|
+
let peerCount = 0;
|
|
300
|
+
try {
|
|
301
|
+
const peersPath = path.join(hubPath, 'state', 'peers.md');
|
|
302
|
+
if (fs.existsSync(peersPath)) {
|
|
303
|
+
const content = fs.readFileSync(peersPath, 'utf8');
|
|
304
|
+
peerCount = (content.match(/- name:/g) || []).length;
|
|
305
|
+
}
|
|
306
|
+
} catch {}
|
|
307
|
+
|
|
294
308
|
const content = `# Runtime State
|
|
295
309
|
|
|
296
310
|
Auto-generated by \`cn update\`. Do not edit manually.
|
|
297
311
|
|
|
298
312
|
\`\`\`yaml
|
|
299
313
|
session_start: ${new Date().toISOString()}
|
|
314
|
+
cn_version: ${cnVersion}
|
|
300
315
|
template_version: ${templateVersion}
|
|
301
316
|
template_commit: ${templateCommit}
|
|
302
|
-
|
|
317
|
+
node_version: ${nodeVersion}
|
|
318
|
+
platform: ${platform}
|
|
319
|
+
hub_name: ${hubName}
|
|
320
|
+
hub_path: ${hubPath}
|
|
321
|
+
peer_count: ${peerCount}
|
|
303
322
|
\`\`\`
|
|
304
323
|
`;
|
|
305
324
|
|