@rigstate/cli 0.7.10 → 0.7.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/dist/index.cjs +20 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/guardian-monitor.ts +25 -0
package/dist/index.js
CHANGED
|
@@ -3586,6 +3586,26 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3586
3586
|
return;
|
|
3587
3587
|
}
|
|
3588
3588
|
} catch (error) {
|
|
3589
|
+
if (apiUrl.includes("localhost") || apiUrl.includes("127.0.0.1")) {
|
|
3590
|
+
const cloudUrl = "https://app.rigstate.com";
|
|
3591
|
+
console.log(chalk17.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3592
|
+
try {
|
|
3593
|
+
const cloudResponse = await axios12.get(`${cloudUrl}/api/v1/guardian/rules`, {
|
|
3594
|
+
params: { project_id: projectId },
|
|
3595
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3596
|
+
timeout: 5e3
|
|
3597
|
+
});
|
|
3598
|
+
if (cloudResponse.data.success && cloudResponse.data.data.rules) {
|
|
3599
|
+
rules = cloudResponse.data.data.rules;
|
|
3600
|
+
console.log(chalk17.green(` \u2705 Successfully loaded rules from Rigstate Cloud!`));
|
|
3601
|
+
lastFetch = Date.now();
|
|
3602
|
+
await saveCachedRules2(projectId, rules);
|
|
3603
|
+
return;
|
|
3604
|
+
}
|
|
3605
|
+
} catch (cloudError) {
|
|
3606
|
+
console.error(chalk17.red(` \u274C Cloud Fallback failed: ${cloudError.message}`));
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3589
3609
|
console.error(chalk17.red(` \u26A0\uFE0F Failed to fetch rules from API: ${error.message}`));
|
|
3590
3610
|
if (error.response) {
|
|
3591
3611
|
console.error(chalk17.red(` Status: ${error.response.status} - ${JSON.stringify(error.response.data)}`));
|