content-grade 1.0.10 → 1.0.11
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/content-grade.js +28 -2
- package/bin/telemetry.js +3 -6
- package/package.json +1 -1
package/bin/content-grade.js
CHANGED
|
@@ -1187,7 +1187,32 @@ async function cmdMetrics() {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
blank();
|
|
1189
1189
|
|
|
1190
|
-
// 2.
|
|
1190
|
+
// 2. GitHub repository stats (public API, no auth)
|
|
1191
|
+
console.log(` ${B}GitHub${R}`);
|
|
1192
|
+
const ghData = await new Promise((resolve) => {
|
|
1193
|
+
const req = httpsGet(
|
|
1194
|
+
'https://api.github.com/repos/StanislavBG/Content-Grade',
|
|
1195
|
+
{ headers: { 'User-Agent': `content-grade-cli/${_version}` }, timeout: 5000 },
|
|
1196
|
+
(res) => {
|
|
1197
|
+
let data = '';
|
|
1198
|
+
res.on('data', (c) => data += c);
|
|
1199
|
+
res.on('end', () => { try { resolve(JSON.parse(data)); } catch { resolve(null); } });
|
|
1200
|
+
}
|
|
1201
|
+
);
|
|
1202
|
+
req.on('error', () => resolve(null));
|
|
1203
|
+
req.on('timeout', () => { req.destroy(); resolve(null); });
|
|
1204
|
+
});
|
|
1205
|
+
if (ghData?.stargazers_count != null) {
|
|
1206
|
+
console.log(` ${D}Stars: ${R}${B}${ghData.stargazers_count.toLocaleString()}${R}`);
|
|
1207
|
+
console.log(` ${D}Forks: ${R}${B}${ghData.forks_count.toLocaleString()}${R}`);
|
|
1208
|
+
console.log(` ${D}Open issues: ${R}${B}${ghData.open_issues_count.toLocaleString()}${R}`);
|
|
1209
|
+
console.log(` ${D}Watchers: ${R}${B}${ghData.watchers_count.toLocaleString()}${R}`);
|
|
1210
|
+
} else {
|
|
1211
|
+
console.log(` ${D}Unavailable (offline or rate limited)${R}`);
|
|
1212
|
+
}
|
|
1213
|
+
blank();
|
|
1214
|
+
|
|
1215
|
+
// 3. Local telemetry summary
|
|
1191
1216
|
console.log(` ${B}Local Usage${R}`);
|
|
1192
1217
|
const eventsFile = join(homedir(), '.content-grade', 'events.jsonl');
|
|
1193
1218
|
try {
|
|
@@ -1470,7 +1495,8 @@ async function cmdDemo() {
|
|
|
1470
1495
|
|
|
1471
1496
|
// Show telemetry notice after user has seen value (first run only)
|
|
1472
1497
|
if (_showTelemNotice) {
|
|
1473
|
-
console.log(` ${D}
|
|
1498
|
+
console.log(` ${D}Help improve ContentGrade — enable anonymous usage analytics: ${CY}content-grade telemetry on${R}`);
|
|
1499
|
+
console.log(` ${D}No PII, no file contents. View what's collected: ${CY}content-grade telemetry${R}`);
|
|
1474
1500
|
blank();
|
|
1475
1501
|
}
|
|
1476
1502
|
|
package/bin/telemetry.js
CHANGED
|
@@ -72,18 +72,15 @@ export function initTelemetry() {
|
|
|
72
72
|
return { installId: cfg.installId, isNew: false, optedOut: false };
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// First run — generate anonymous install ID
|
|
75
|
+
// First run — generate anonymous install ID, opt-IN by default (off until user enables)
|
|
76
76
|
const installId = generateId();
|
|
77
77
|
saveConfig({
|
|
78
78
|
installId,
|
|
79
79
|
installedAt: new Date().toISOString(),
|
|
80
|
-
telemetryEnabled:
|
|
80
|
+
telemetryEnabled: false,
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
_write({ event: 'install', installId, platform: process.platform, nodeVersion: process.version });
|
|
85
|
-
|
|
86
|
-
return { installId, isNew: true, optedOut: false };
|
|
83
|
+
return { installId, isNew: true, optedOut: true };
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
/**
|
package/package.json
CHANGED