linchpin-cli 0.2.0 → 0.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.
- package/dist/src/commands/check.js +35 -0
- package/package.json +1 -1
|
@@ -144,6 +144,41 @@ async function checkCommand(options = {}) {
|
|
|
144
144
|
else if ((0, npm_1.isUsingCloudApi)()) {
|
|
145
145
|
console.log(chalk_1.default.gray('\n ☁️ Connected to Linchpin cloud.'));
|
|
146
146
|
}
|
|
147
|
+
// Sync scan results to cloud if logged in
|
|
148
|
+
if ((0, npm_1.isUsingCloudApi)()) {
|
|
149
|
+
const scanResults = packageData.map(({ name, current, latest }) => {
|
|
150
|
+
const upgradeType = getUpgradeType(current, latest);
|
|
151
|
+
const riskLevel = upgradeType === 'MAJOR' ? 'critical' : upgradeType === 'MINOR' ? 'warning' : 'safe';
|
|
152
|
+
const risk = riskMap.get(name);
|
|
153
|
+
return {
|
|
154
|
+
name,
|
|
155
|
+
current,
|
|
156
|
+
latest,
|
|
157
|
+
riskLevel,
|
|
158
|
+
reason: risk?.risk || '',
|
|
159
|
+
aiRisk: risk?.risk,
|
|
160
|
+
safeVersion: risk?.safeVersion,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const total = packageData.length;
|
|
164
|
+
const safeCount = total - majorCount - minorCount - patchCount;
|
|
165
|
+
const healthScore = total > 0
|
|
166
|
+
? Math.round(((safeCount * 100) + (patchCount * 80) + (minorCount * 50) + (majorCount * 0)) / total)
|
|
167
|
+
: 100;
|
|
168
|
+
// Fire and forget - don't block CLI output
|
|
169
|
+
(0, npm_1.apiRequest)('/api/cli/scan', {
|
|
170
|
+
healthScore,
|
|
171
|
+
packagesCount: total,
|
|
172
|
+
criticalCount: majorCount,
|
|
173
|
+
warningCount: minorCount,
|
|
174
|
+
scanResults,
|
|
175
|
+
deepAnalysis: isDeep,
|
|
176
|
+
}).then(result => {
|
|
177
|
+
if (result.error && process.env.DEBUG) {
|
|
178
|
+
console.error('Failed to sync scan:', result.error);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
147
182
|
// Action hints
|
|
148
183
|
console.log(chalk_1.default.gray('\n 💡 Actions:'));
|
|
149
184
|
if (!isDeep && useAI) {
|