@rigstate/cli 0.7.13 → 0.7.15
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 +4 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/factory.ts +2 -3
- package/src/utils/config.ts +3 -63
package/dist/index.cjs
CHANGED
|
@@ -51,7 +51,6 @@ var config_exports = {};
|
|
|
51
51
|
__export(config_exports, {
|
|
52
52
|
clearConfig: () => clearConfig,
|
|
53
53
|
config: () => config,
|
|
54
|
-
discoverApiUrl: () => discoverApiUrl,
|
|
55
54
|
getApiKey: () => getApiKey,
|
|
56
55
|
getApiUrl: () => getApiUrl,
|
|
57
56
|
getProjectId: () => getProjectId,
|
|
@@ -87,43 +86,6 @@ function getApiUrl() {
|
|
|
87
86
|
}
|
|
88
87
|
return "https://app.rigstate.com";
|
|
89
88
|
}
|
|
90
|
-
async function discoverApiUrl() {
|
|
91
|
-
const configuredUrl = getApiUrl();
|
|
92
|
-
const { default: axios22 } = await import("axios");
|
|
93
|
-
const { default: chalk34 } = await import("chalk");
|
|
94
|
-
console.log(chalk34.gray(`\u{1F50D} Discovering local Rigstate API URL... Configured: ${configuredUrl}`));
|
|
95
|
-
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
96
|
-
console.log(chalk34.gray(` Configured URL is not localhost, trusting: ${configuredUrl}`));
|
|
97
|
-
return configuredUrl;
|
|
98
|
-
}
|
|
99
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
100
|
-
for (const port of ports) {
|
|
101
|
-
const url = `http://localhost:${port}`;
|
|
102
|
-
try {
|
|
103
|
-
console.log(chalk34.gray(` Attempting to connect to ${url}/api/v1/system/health...`));
|
|
104
|
-
await axios22.get(`${url}/api/v1/system/health`, { timeout: 800 });
|
|
105
|
-
console.log(chalk34.green(` \u2705 Found Rigstate API at ${url}`));
|
|
106
|
-
if (url !== configuredUrl) {
|
|
107
|
-
console.log(chalk34.gray(` Updating stored API URL from ${configuredUrl} to ${url}`));
|
|
108
|
-
setApiUrl(url);
|
|
109
|
-
}
|
|
110
|
-
return url;
|
|
111
|
-
} catch (e) {
|
|
112
|
-
if (axios22.isAxiosError(e) && e.response && e.response.status === 404) {
|
|
113
|
-
console.log(chalk34.yellow(` \u26A0\uFE0F ${url} responded with 404, but might still be a Rigstate server. Skipping for now.`));
|
|
114
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNABORTED") {
|
|
115
|
-
console.log(chalk34.gray(` Connection to ${url} timed out.`));
|
|
116
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNREFUSED") {
|
|
117
|
-
console.log(chalk34.gray(` Connection to ${url} refused.`));
|
|
118
|
-
} else {
|
|
119
|
-
console.log(chalk34.gray(` Failed to connect to ${url}: ${e.message}`));
|
|
120
|
-
}
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
console.log(chalk34.yellow(` \u274C No local Rigstate API found on scanned ports. Falling back to Rigstate Cloud.`));
|
|
125
|
-
return "https://app.rigstate.com";
|
|
126
|
-
}
|
|
127
89
|
function setApiUrl(url) {
|
|
128
90
|
config.set("apiUrl", url);
|
|
129
91
|
}
|
|
@@ -139,7 +101,7 @@ var init_config = __esm({
|
|
|
139
101
|
config = new import_conf.default({
|
|
140
102
|
projectName: "rigstate-cli",
|
|
141
103
|
defaults: {
|
|
142
|
-
apiUrl: "
|
|
104
|
+
apiUrl: "https://app.rigstate.com"
|
|
143
105
|
}
|
|
144
106
|
});
|
|
145
107
|
}
|
|
@@ -1881,9 +1843,9 @@ function createLinkCommand() {
|
|
|
1881
1843
|
console.log("");
|
|
1882
1844
|
console.log(import_chalk6.default.bold("\u{1F916} Rigstate Automation Detected"));
|
|
1883
1845
|
console.log("");
|
|
1884
|
-
const { getApiKey: getApiKey2, getApiUrl:
|
|
1846
|
+
const { getApiKey: getApiKey2, getApiUrl: getApiUrl2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
1885
1847
|
const apiKey = getApiKey2();
|
|
1886
|
-
const apiUrl =
|
|
1848
|
+
const apiUrl = getApiUrl2();
|
|
1887
1849
|
if (apiKey) {
|
|
1888
1850
|
console.log(import_chalk6.default.blue("\u{1F510} Checking Vault for secrets..."));
|
|
1889
1851
|
const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
|
|
@@ -3906,7 +3868,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
3906
3868
|
// src/daemon/factory.ts
|
|
3907
3869
|
init_config();
|
|
3908
3870
|
async function createDaemon(options) {
|
|
3909
|
-
const apiUrl =
|
|
3871
|
+
const apiUrl = getApiUrl();
|
|
3910
3872
|
let projectId = options.project;
|
|
3911
3873
|
if (!projectId) {
|
|
3912
3874
|
const manifest = await loadManifest();
|