@rigstate/cli 0.7.12 → 0.7.14
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 +82 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +76 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/core.ts +6 -1
- package/src/utils/config.ts +16 -35
package/dist/index.cjs
CHANGED
|
@@ -89,39 +89,23 @@ function getApiUrl() {
|
|
|
89
89
|
}
|
|
90
90
|
async function discoverApiUrl() {
|
|
91
91
|
const configuredUrl = getApiUrl();
|
|
92
|
-
const
|
|
93
|
-
const { default: chalk34 } = await import("chalk");
|
|
94
|
-
console.log(chalk34.gray(`\u{1F50D} Discovering local Rigstate API URL... Configured: ${configuredUrl}`));
|
|
92
|
+
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
95
93
|
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
96
|
-
console.log(chalk34.gray(` Configured URL is not localhost, trusting: ${configuredUrl}`));
|
|
97
94
|
return configuredUrl;
|
|
98
95
|
}
|
|
99
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
100
96
|
for (const port of ports) {
|
|
101
97
|
const url = `http://localhost:${port}`;
|
|
102
98
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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}`));
|
|
99
|
+
const res = await import_axios.default.get(`${url}/api/v1/system/health`, { timeout: 200 });
|
|
100
|
+
if (res.data?.status === "healthy") {
|
|
101
|
+
if (url !== configuredUrl) {
|
|
102
|
+
setApiUrl(url);
|
|
103
|
+
}
|
|
104
|
+
return url;
|
|
120
105
|
}
|
|
121
|
-
|
|
106
|
+
} catch (e) {
|
|
122
107
|
}
|
|
123
108
|
}
|
|
124
|
-
console.log(chalk34.yellow(` \u274C No local Rigstate API found on scanned ports. Falling back to Rigstate Cloud.`));
|
|
125
109
|
return "https://app.rigstate.com";
|
|
126
110
|
}
|
|
127
111
|
function setApiUrl(url) {
|
|
@@ -130,12 +114,13 @@ function setApiUrl(url) {
|
|
|
130
114
|
function clearConfig() {
|
|
131
115
|
config.clear();
|
|
132
116
|
}
|
|
133
|
-
var import_conf, config;
|
|
117
|
+
var import_conf, import_axios, config;
|
|
134
118
|
var init_config = __esm({
|
|
135
119
|
"src/utils/config.ts"() {
|
|
136
120
|
"use strict";
|
|
137
121
|
init_cjs_shims();
|
|
138
122
|
import_conf = __toESM(require("conf"), 1);
|
|
123
|
+
import_axios = __toESM(require("axios"), 1);
|
|
139
124
|
config = new import_conf.default({
|
|
140
125
|
projectName: "rigstate-cli",
|
|
141
126
|
defaults: {
|
|
@@ -161,7 +146,7 @@ async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
|
161
146
|
}
|
|
162
147
|
const spinner = (0, import_ora.default)("Fetching secrets from Vault...").start();
|
|
163
148
|
try {
|
|
164
|
-
const response = await
|
|
149
|
+
const response = await import_axios2.default.post(`${apiUrl}/api/v1/vault/sync`, {
|
|
165
150
|
project_id: projectId
|
|
166
151
|
}, {
|
|
167
152
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -265,7 +250,7 @@ function createEnvPullCommand() {
|
|
|
265
250
|
});
|
|
266
251
|
return envPull;
|
|
267
252
|
}
|
|
268
|
-
var import_commander2, import_chalk2, import_ora, import_promises, import_path,
|
|
253
|
+
var import_commander2, import_chalk2, import_ora, import_promises, import_path, import_axios2;
|
|
269
254
|
var init_env = __esm({
|
|
270
255
|
"src/commands/env.ts"() {
|
|
271
256
|
"use strict";
|
|
@@ -276,7 +261,7 @@ var init_env = __esm({
|
|
|
276
261
|
import_promises = __toESM(require("fs/promises"), 1);
|
|
277
262
|
import_path = __toESM(require("path"), 1);
|
|
278
263
|
init_config();
|
|
279
|
-
|
|
264
|
+
import_axios2 = __toESM(require("axios"), 1);
|
|
280
265
|
}
|
|
281
266
|
});
|
|
282
267
|
|
|
@@ -291,7 +276,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
291
276
|
let success = true;
|
|
292
277
|
try {
|
|
293
278
|
spinner.text = "Fetching project info...";
|
|
294
|
-
const projectRes = await
|
|
279
|
+
const projectRes = await import_axios3.default.get(`${apiUrl}/api/v1/projects`, {
|
|
295
280
|
params: { project_id: projectId },
|
|
296
281
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
297
282
|
});
|
|
@@ -304,7 +289,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
304
289
|
spinner.succeed(import_chalk3.default.yellow(` [DRY-RUN] Would sync: ${project.name}`));
|
|
305
290
|
return true;
|
|
306
291
|
}
|
|
307
|
-
const syncResponse = await
|
|
292
|
+
const syncResponse = await import_axios3.default.post(`${apiUrl}/api/v1/rules/sync`, {
|
|
308
293
|
project_id: project.id
|
|
309
294
|
}, {
|
|
310
295
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -358,7 +343,7 @@ function createSyncRulesCommand() {
|
|
|
358
343
|
});
|
|
359
344
|
return syncRules;
|
|
360
345
|
}
|
|
361
|
-
var import_commander3, import_chalk3, import_ora2,
|
|
346
|
+
var import_commander3, import_chalk3, import_ora2, import_axios3;
|
|
362
347
|
var init_sync_rules = __esm({
|
|
363
348
|
"src/commands/sync-rules.ts"() {
|
|
364
349
|
"use strict";
|
|
@@ -367,7 +352,7 @@ var init_sync_rules = __esm({
|
|
|
367
352
|
import_chalk3 = __toESM(require("chalk"), 1);
|
|
368
353
|
import_ora2 = __toESM(require("ora"), 1);
|
|
369
354
|
init_config();
|
|
370
|
-
|
|
355
|
+
import_axios3 = __toESM(require("axios"), 1);
|
|
371
356
|
}
|
|
372
357
|
});
|
|
373
358
|
|
|
@@ -378,7 +363,7 @@ __export(suggest_exports, {
|
|
|
378
363
|
});
|
|
379
364
|
async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
380
365
|
try {
|
|
381
|
-
const response = await
|
|
366
|
+
const response = await import_axios4.default.get(`${apiUrl}/api/v1/roadmap/chunks`, {
|
|
382
367
|
params: {
|
|
383
368
|
project_id: projectId,
|
|
384
369
|
status: "PENDING",
|
|
@@ -410,13 +395,13 @@ async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
|
410
395
|
} catch (e) {
|
|
411
396
|
}
|
|
412
397
|
}
|
|
413
|
-
var import_chalk4,
|
|
398
|
+
var import_chalk4, import_axios4;
|
|
414
399
|
var init_suggest = __esm({
|
|
415
400
|
"src/commands/suggest.ts"() {
|
|
416
401
|
"use strict";
|
|
417
402
|
init_cjs_shims();
|
|
418
403
|
import_chalk4 = __toESM(require("chalk"), 1);
|
|
419
|
-
|
|
404
|
+
import_axios4 = __toESM(require("axios"), 1);
|
|
420
405
|
}
|
|
421
406
|
});
|
|
422
407
|
|
|
@@ -560,7 +545,7 @@ __export(skills_provisioner_exports, {
|
|
|
560
545
|
async function provisionSkills(apiUrl, apiKey, projectId, rootDir) {
|
|
561
546
|
const skills = [];
|
|
562
547
|
try {
|
|
563
|
-
const response = await
|
|
548
|
+
const response = await import_axios7.default.get(`${apiUrl}/api/v1/skills`, {
|
|
564
549
|
params: { project_id: projectId },
|
|
565
550
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
566
551
|
});
|
|
@@ -651,12 +636,12 @@ async function jitProvisionSkill(skillId, apiUrl, apiKey, projectId, rootDir) {
|
|
|
651
636
|
return false;
|
|
652
637
|
}
|
|
653
638
|
}
|
|
654
|
-
var
|
|
639
|
+
var import_axios7, import_promises7, import_path7, import_chalk9;
|
|
655
640
|
var init_skills_provisioner = __esm({
|
|
656
641
|
"src/utils/skills-provisioner.ts"() {
|
|
657
642
|
"use strict";
|
|
658
643
|
init_cjs_shims();
|
|
659
|
-
|
|
644
|
+
import_axios7 = __toESM(require("axios"), 1);
|
|
660
645
|
import_promises7 = __toESM(require("fs/promises"), 1);
|
|
661
646
|
import_path7 = __toESM(require("path"), 1);
|
|
662
647
|
import_chalk9 = __toESM(require("chalk"), 1);
|
|
@@ -785,7 +770,7 @@ async function fetchRulesFromApi(projectId) {
|
|
|
785
770
|
try {
|
|
786
771
|
const apiUrl = getApiUrl();
|
|
787
772
|
const apiKey = getApiKey();
|
|
788
|
-
const response = await
|
|
773
|
+
const response = await import_axios8.default.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
789
774
|
params: { project_id: projectId },
|
|
790
775
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
791
776
|
timeout: 1e4
|
|
@@ -885,7 +870,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
885
870
|
limitValue: lmax,
|
|
886
871
|
severity: "CRITICAL"
|
|
887
872
|
}));
|
|
888
|
-
await
|
|
873
|
+
await import_axios8.default.post(`${apiUrl}/api/v1/guardian/sync`, {
|
|
889
874
|
projectId,
|
|
890
875
|
violations: payloadViolations,
|
|
891
876
|
warnings
|
|
@@ -898,7 +883,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
898
883
|
}
|
|
899
884
|
}
|
|
900
885
|
}
|
|
901
|
-
var import_promises9, import_path9, import_chalk11,
|
|
886
|
+
var import_promises9, import_path9, import_chalk11, import_axios8, DEFAULT_LMAX, DEFAULT_LMAX_WARNING, CACHE_FILE;
|
|
902
887
|
var init_watchdog = __esm({
|
|
903
888
|
"src/utils/watchdog.ts"() {
|
|
904
889
|
"use strict";
|
|
@@ -906,7 +891,7 @@ var init_watchdog = __esm({
|
|
|
906
891
|
import_promises9 = __toESM(require("fs/promises"), 1);
|
|
907
892
|
import_path9 = __toESM(require("path"), 1);
|
|
908
893
|
import_chalk11 = __toESM(require("chalk"), 1);
|
|
909
|
-
|
|
894
|
+
import_axios8 = __toESM(require("axios"), 1);
|
|
910
895
|
init_config();
|
|
911
896
|
DEFAULT_LMAX = 400;
|
|
912
897
|
DEFAULT_LMAX_WARNING = 350;
|
|
@@ -1938,7 +1923,7 @@ init_cjs_shims();
|
|
|
1938
1923
|
var import_commander6 = require("commander");
|
|
1939
1924
|
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
1940
1925
|
var import_ora3 = __toESM(require("ora"), 1);
|
|
1941
|
-
var
|
|
1926
|
+
var import_axios5 = __toESM(require("axios"), 1);
|
|
1942
1927
|
var import_glob = require("glob");
|
|
1943
1928
|
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
1944
1929
|
var import_path5 = __toESM(require("path"), 1);
|
|
@@ -2059,7 +2044,7 @@ function createScanCommand() {
|
|
|
2059
2044
|
spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
|
|
2060
2045
|
try {
|
|
2061
2046
|
const content = await import_promises5.default.readFile(filePath, "utf-8");
|
|
2062
|
-
const response = await
|
|
2047
|
+
const response = await import_axios5.default.post(
|
|
2063
2048
|
`${apiUrl}/api/v1/audit`,
|
|
2064
2049
|
{
|
|
2065
2050
|
content,
|
|
@@ -2093,7 +2078,7 @@ function createScanCommand() {
|
|
|
2093
2078
|
});
|
|
2094
2079
|
}
|
|
2095
2080
|
} catch (fileError) {
|
|
2096
|
-
if (
|
|
2081
|
+
if (import_axios5.default.isAxiosError(fileError)) {
|
|
2097
2082
|
console.warn(import_chalk7.default.yellow(`
|
|
2098
2083
|
\u26A0\uFE0F Skipping ${relativePath}: ${fileError.message}`));
|
|
2099
2084
|
} else {
|
|
@@ -2118,7 +2103,7 @@ function createScanCommand() {
|
|
|
2118
2103
|
}
|
|
2119
2104
|
} catch (error) {
|
|
2120
2105
|
spinner.fail(import_chalk7.default.red("\u274C Scan failed"));
|
|
2121
|
-
if (
|
|
2106
|
+
if (import_axios5.default.isAxiosError(error)) {
|
|
2122
2107
|
if (error.response) {
|
|
2123
2108
|
console.error(import_chalk7.default.red("API Error:"), error.response.data);
|
|
2124
2109
|
} else if (error.request) {
|
|
@@ -2194,7 +2179,7 @@ init_cjs_shims();
|
|
|
2194
2179
|
var import_commander7 = require("commander");
|
|
2195
2180
|
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
2196
2181
|
var import_ora4 = __toESM(require("ora"), 1);
|
|
2197
|
-
var
|
|
2182
|
+
var import_axios6 = __toESM(require("axios"), 1);
|
|
2198
2183
|
var import_glob2 = require("glob");
|
|
2199
2184
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
2200
2185
|
var import_path6 = __toESM(require("path"), 1);
|
|
@@ -2234,7 +2219,7 @@ function createFixCommand() {
|
|
|
2234
2219
|
spinner.start(`Analyzing ${relativePath}...`);
|
|
2235
2220
|
try {
|
|
2236
2221
|
const content = await import_promises6.default.readFile(filePath, "utf-8");
|
|
2237
|
-
const response = await
|
|
2222
|
+
const response = await import_axios6.default.post(
|
|
2238
2223
|
`${apiUrl}/api/v1/audit`,
|
|
2239
2224
|
{ content, file_path: relativePath, project_id: projectId },
|
|
2240
2225
|
{ headers: { "Authorization": `Bearer ${apiKey}` }, timeout: 12e4 }
|
|
@@ -2270,7 +2255,7 @@ ${import_chalk8.default.bold(relativePath)}: Found ${fixableIssues.length} fixab
|
|
|
2270
2255
|
}]);
|
|
2271
2256
|
if (completeStep) {
|
|
2272
2257
|
try {
|
|
2273
|
-
await
|
|
2258
|
+
await import_axios6.default.post(
|
|
2274
2259
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
2275
2260
|
{ step_id: issue.related_step_id, status: "COMPLETED", project_id: projectId },
|
|
2276
2261
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -2311,7 +2296,7 @@ var import_commander8 = require("commander");
|
|
|
2311
2296
|
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
2312
2297
|
var import_ora5 = __toESM(require("ora"), 1);
|
|
2313
2298
|
init_config();
|
|
2314
|
-
var
|
|
2299
|
+
var import_axios9 = __toESM(require("axios"), 1);
|
|
2315
2300
|
var import_promises10 = __toESM(require("fs/promises"), 1);
|
|
2316
2301
|
var import_path10 = __toESM(require("path"), 1);
|
|
2317
2302
|
function createSyncCommand() {
|
|
@@ -2345,7 +2330,7 @@ function createSyncCommand() {
|
|
|
2345
2330
|
return;
|
|
2346
2331
|
}
|
|
2347
2332
|
const apiUrl = getApiUrl();
|
|
2348
|
-
const response = await
|
|
2333
|
+
const response = await import_axios9.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
2349
2334
|
params: { project_id: projectId },
|
|
2350
2335
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2351
2336
|
});
|
|
@@ -2404,7 +2389,7 @@ function createSyncCommand() {
|
|
|
2404
2389
|
const logContent = await import_promises10.default.readFile(logPath, "utf-8");
|
|
2405
2390
|
const logData = JSON.parse(logContent);
|
|
2406
2391
|
if (logData.task_summary) {
|
|
2407
|
-
await
|
|
2392
|
+
await import_axios9.default.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
2408
2393
|
project_id: projectId,
|
|
2409
2394
|
...logData,
|
|
2410
2395
|
agent_role: process.env.RIGSTATE_MODE === "SUPERVISOR" ? "SUPERVISOR" : "WORKER"
|
|
@@ -2427,7 +2412,7 @@ function createSyncCommand() {
|
|
|
2427
2412
|
await runGuardianWatchdog2(process.cwd(), settings, projectId);
|
|
2428
2413
|
console.log(import_chalk12.default.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
|
|
2429
2414
|
try {
|
|
2430
|
-
const bridgeResponse = await
|
|
2415
|
+
const bridgeResponse = await import_axios9.default.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2431
2416
|
params: { project_id: projectId },
|
|
2432
2417
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2433
2418
|
});
|
|
@@ -2443,7 +2428,7 @@ function createSyncCommand() {
|
|
|
2443
2428
|
}
|
|
2444
2429
|
const pings = pending.filter((t) => t.proposal?.startsWith("ping"));
|
|
2445
2430
|
for (const ping of pings) {
|
|
2446
|
-
await
|
|
2431
|
+
await import_axios9.default.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2447
2432
|
bridge_id: ping.id,
|
|
2448
2433
|
status: "COMPLETED",
|
|
2449
2434
|
summary: "Pong! CLI Sync Heartbeat confirmed."
|
|
@@ -2473,7 +2458,7 @@ function createSyncCommand() {
|
|
|
2473
2458
|
} catch (e) {
|
|
2474
2459
|
}
|
|
2475
2460
|
try {
|
|
2476
|
-
const vaultResponse = await
|
|
2461
|
+
const vaultResponse = await import_axios9.default.post(
|
|
2477
2462
|
`${apiUrl}/api/v1/vault/sync`,
|
|
2478
2463
|
{ project_id: projectId },
|
|
2479
2464
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
@@ -2510,7 +2495,7 @@ function createSyncCommand() {
|
|
|
2510
2495
|
console.log(import_chalk12.default.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
|
|
2511
2496
|
await checkSystemIntegrity(apiUrl, apiKey, projectId);
|
|
2512
2497
|
} catch (error) {
|
|
2513
|
-
if (
|
|
2498
|
+
if (import_axios9.default.isAxiosError(error)) {
|
|
2514
2499
|
const message = error.response?.data?.error || error.message;
|
|
2515
2500
|
spinner.fail(import_chalk12.default.red(`Sync failed: ${message}`));
|
|
2516
2501
|
} else {
|
|
@@ -2522,7 +2507,7 @@ function createSyncCommand() {
|
|
|
2522
2507
|
}
|
|
2523
2508
|
async function checkSystemIntegrity(apiUrl, apiKey, projectId) {
|
|
2524
2509
|
try {
|
|
2525
|
-
const response = await
|
|
2510
|
+
const response = await import_axios9.default.get(`${apiUrl}/api/v1/system/integrity`, {
|
|
2526
2511
|
params: { project_id: projectId },
|
|
2527
2512
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2528
2513
|
});
|
|
@@ -2589,7 +2574,7 @@ async function loadManifest() {
|
|
|
2589
2574
|
|
|
2590
2575
|
// src/commands/init.ts
|
|
2591
2576
|
init_config();
|
|
2592
|
-
var
|
|
2577
|
+
var import_axios10 = __toESM(require("axios"), 1);
|
|
2593
2578
|
function createInitCommand() {
|
|
2594
2579
|
return new import_commander9.Command("init").description("Initialize or link a Rigstate project (interactive mode available)").argument("[project-id]", "ID of the project to link (optional, prompts if not provided)").option("-f, --force", "Overwrite existing .cursorrules file").option("--rules-only", "Only regenerate .cursorrules without interactive setup").action(async (projectIdArg, options) => {
|
|
2595
2580
|
const spinner = (0, import_ora6.default)("Initializing Rigstate project...").start();
|
|
@@ -2619,7 +2604,7 @@ function createInitCommand() {
|
|
|
2619
2604
|
spinner.start("Fetching your projects...");
|
|
2620
2605
|
let projects = [];
|
|
2621
2606
|
try {
|
|
2622
|
-
const projectsResponse = await
|
|
2607
|
+
const projectsResponse = await import_axios10.default.get(`${apiUrl}/api/v1/projects`, {
|
|
2623
2608
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2624
2609
|
});
|
|
2625
2610
|
if (projectsResponse.data.success) {
|
|
@@ -2671,7 +2656,7 @@ function createInitCommand() {
|
|
|
2671
2656
|
spinner.start("Fetching organizations...");
|
|
2672
2657
|
let orgs = [];
|
|
2673
2658
|
try {
|
|
2674
|
-
const orgsResponse = await
|
|
2659
|
+
const orgsResponse = await import_axios10.default.get(`${apiUrl}/api/v1/organizations`, {
|
|
2675
2660
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2676
2661
|
});
|
|
2677
2662
|
orgs = orgsResponse.data.data?.organizations || [];
|
|
@@ -2699,7 +2684,7 @@ function createInitCommand() {
|
|
|
2699
2684
|
}
|
|
2700
2685
|
spinner.start("Creating new project...");
|
|
2701
2686
|
try {
|
|
2702
|
-
const createResponse = await
|
|
2687
|
+
const createResponse = await import_axios10.default.post(`${apiUrl}/api/v1/projects`, {
|
|
2703
2688
|
name: newName,
|
|
2704
2689
|
organization_id: selectedOrgId
|
|
2705
2690
|
}, {
|
|
@@ -2750,7 +2735,7 @@ function createInitCommand() {
|
|
|
2750
2735
|
async function generateRules(apiUrl, apiKey, projectId, force, spinner) {
|
|
2751
2736
|
spinner.start("Generating AI rules (MDC + AGENTS.md)...");
|
|
2752
2737
|
try {
|
|
2753
|
-
const response = await
|
|
2738
|
+
const response = await import_axios10.default.post(`${apiUrl}/api/v1/rules/generate`, {
|
|
2754
2739
|
project_id: projectId
|
|
2755
2740
|
}, {
|
|
2756
2741
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -2802,7 +2787,7 @@ init_cjs_shims();
|
|
|
2802
2787
|
var import_commander10 = require("commander");
|
|
2803
2788
|
var import_chalk15 = __toESM(require("chalk"), 1);
|
|
2804
2789
|
var import_ora7 = __toESM(require("ora"), 1);
|
|
2805
|
-
var
|
|
2790
|
+
var import_axios11 = __toESM(require("axios"), 1);
|
|
2806
2791
|
var import_glob3 = require("glob");
|
|
2807
2792
|
var import_promises14 = __toESM(require("fs/promises"), 1);
|
|
2808
2793
|
var import_path14 = __toESM(require("path"), 1);
|
|
@@ -3039,7 +3024,7 @@ function createCheckCommand() {
|
|
|
3039
3024
|
settings = cached.settings;
|
|
3040
3025
|
spinner.text = "Using cached rules...";
|
|
3041
3026
|
} else {
|
|
3042
|
-
const response = await
|
|
3027
|
+
const response = await import_axios11.default.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3043
3028
|
params: { project_id: projectId },
|
|
3044
3029
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3045
3030
|
timeout: 1e4
|
|
@@ -3310,7 +3295,7 @@ init_cjs_shims();
|
|
|
3310
3295
|
var import_promises15 = require("fs/promises");
|
|
3311
3296
|
var import_path16 = require("path");
|
|
3312
3297
|
var import_path17 = __toESM(require("path"), 1);
|
|
3313
|
-
var
|
|
3298
|
+
var import_axios12 = __toESM(require("axios"), 1);
|
|
3314
3299
|
var GLOBAL_HEURISTICS = [
|
|
3315
3300
|
{
|
|
3316
3301
|
skillId: "payment-expert",
|
|
@@ -3360,7 +3345,7 @@ var HeuristicEngine = class {
|
|
|
3360
3345
|
try {
|
|
3361
3346
|
await (0, import_promises15.mkdir)((0, import_path16.dirname)(this.cachePath), { recursive: true });
|
|
3362
3347
|
const endpoint = `${apiUrl}/api/v1/skills/triggers`;
|
|
3363
|
-
const response = await
|
|
3348
|
+
const response = await import_axios12.default.get(endpoint, {
|
|
3364
3349
|
headers: {
|
|
3365
3350
|
"x-api-key": apiKey,
|
|
3366
3351
|
"Content-Type": "application/json"
|
|
@@ -3560,7 +3545,7 @@ function createInterventionProtocol() {
|
|
|
3560
3545
|
|
|
3561
3546
|
// src/daemon/guardian-monitor.ts
|
|
3562
3547
|
init_cjs_shims();
|
|
3563
|
-
var
|
|
3548
|
+
var import_axios13 = __toESM(require("axios"), 1);
|
|
3564
3549
|
var import_chalk17 = __toESM(require("chalk"), 1);
|
|
3565
3550
|
var import_promises16 = __toESM(require("fs/promises"), 1);
|
|
3566
3551
|
var import_path18 = __toESM(require("path"), 1);
|
|
@@ -3574,7 +3559,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3574
3559
|
return;
|
|
3575
3560
|
}
|
|
3576
3561
|
try {
|
|
3577
|
-
const response = await
|
|
3562
|
+
const response = await import_axios13.default.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3578
3563
|
params: { project_id: projectId },
|
|
3579
3564
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3580
3565
|
timeout: 1e4
|
|
@@ -3590,7 +3575,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3590
3575
|
const cloudUrl = "https://app.rigstate.com";
|
|
3591
3576
|
console.log(import_chalk17.default.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3592
3577
|
try {
|
|
3593
|
-
const cloudResponse = await
|
|
3578
|
+
const cloudResponse = await import_axios13.default.get(`${cloudUrl}/api/v1/guardian/rules`, {
|
|
3594
3579
|
params: { project_id: projectId },
|
|
3595
3580
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3596
3581
|
timeout: 5e3
|
|
@@ -3674,7 +3659,7 @@ async function saveCachedRules2(projectId, rules) {
|
|
|
3674
3659
|
|
|
3675
3660
|
// src/daemon/bridge-listener.ts
|
|
3676
3661
|
init_cjs_shims();
|
|
3677
|
-
var
|
|
3662
|
+
var import_axios14 = __toESM(require("axios"), 1);
|
|
3678
3663
|
var import_events2 = require("events");
|
|
3679
3664
|
var POLL_INTERVAL_MS = 5e3;
|
|
3680
3665
|
function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
@@ -3684,7 +3669,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3684
3669
|
let lastCheckedId = null;
|
|
3685
3670
|
const checkBridge = async () => {
|
|
3686
3671
|
try {
|
|
3687
|
-
const response = await
|
|
3672
|
+
const response = await import_axios14.default.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3688
3673
|
params: {
|
|
3689
3674
|
project_id: projectId,
|
|
3690
3675
|
action: "check"
|
|
@@ -3712,7 +3697,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3712
3697
|
};
|
|
3713
3698
|
const acknowledgePing = async (taskId) => {
|
|
3714
3699
|
try {
|
|
3715
|
-
await
|
|
3700
|
+
await import_axios14.default.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3716
3701
|
project_id: projectId,
|
|
3717
3702
|
action: "update",
|
|
3718
3703
|
bridge_id: taskId,
|
|
@@ -3745,10 +3730,10 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3745
3730
|
|
|
3746
3731
|
// src/daemon/telemetry.ts
|
|
3747
3732
|
init_cjs_shims();
|
|
3748
|
-
var
|
|
3733
|
+
var import_axios15 = __toESM(require("axios"), 1);
|
|
3749
3734
|
async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
|
|
3750
3735
|
try {
|
|
3751
|
-
await
|
|
3736
|
+
await import_axios15.default.post(`${apiUrl}/api/v1/skills/usage`, {
|
|
3752
3737
|
projectId,
|
|
3753
3738
|
skillName: skillId,
|
|
3754
3739
|
status: "ACTIVATED"
|
|
@@ -3799,7 +3784,12 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
3799
3784
|
this.setupFileWatcher();
|
|
3800
3785
|
}
|
|
3801
3786
|
if (this.config.bridgeEnabled) {
|
|
3802
|
-
|
|
3787
|
+
try {
|
|
3788
|
+
await this.setupBridge();
|
|
3789
|
+
} catch (e) {
|
|
3790
|
+
console.error(import_chalk18.default.yellow(` \u26A0\uFE0F Agent Bridge connection failed: ${e.message}`));
|
|
3791
|
+
console.log(import_chalk18.default.dim(" (Daemon will continue with local monitoring only)"));
|
|
3792
|
+
}
|
|
3803
3793
|
}
|
|
3804
3794
|
this.printActive();
|
|
3805
3795
|
this.emit("started", this.state);
|
|
@@ -4156,7 +4146,7 @@ init_cjs_shims();
|
|
|
4156
4146
|
var import_commander12 = require("commander");
|
|
4157
4147
|
var import_chalk20 = __toESM(require("chalk"), 1);
|
|
4158
4148
|
var import_ora9 = __toESM(require("ora"), 1);
|
|
4159
|
-
var
|
|
4149
|
+
var import_axios16 = __toESM(require("axios"), 1);
|
|
4160
4150
|
var import_inquirer2 = __toESM(require("inquirer"), 1);
|
|
4161
4151
|
init_config();
|
|
4162
4152
|
init_suggest();
|
|
@@ -4177,7 +4167,7 @@ async function listInteractive() {
|
|
|
4177
4167
|
const spinner = (0, import_ora9.default)("Fetching roadmap...").start();
|
|
4178
4168
|
try {
|
|
4179
4169
|
const { projectId, apiKey, apiUrl } = getContext();
|
|
4180
|
-
const response = await
|
|
4170
|
+
const response = await import_axios16.default.get(
|
|
4181
4171
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4182
4172
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4183
4173
|
);
|
|
@@ -4233,12 +4223,12 @@ async function setTaskStatus(taskId, status) {
|
|
|
4233
4223
|
let realId = taskId;
|
|
4234
4224
|
if (taskId.startsWith("T-") || taskId.length < 10) {
|
|
4235
4225
|
spinner.text = "Resolving Task ID...";
|
|
4236
|
-
const lookup = await
|
|
4226
|
+
const lookup = await import_axios16.default.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
4237
4227
|
const task = lookup.data.data.roadmap.find((t) => `T-${t.step_number}` === taskId || t.step_number.toString() === taskId);
|
|
4238
4228
|
if (!task) throw new Error(`Task ${taskId} not found.`);
|
|
4239
4229
|
realId = task.id;
|
|
4240
4230
|
}
|
|
4241
|
-
await
|
|
4231
|
+
await import_axios16.default.post(
|
|
4242
4232
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
4243
4233
|
{ step_id: realId, status, project_id: projectId },
|
|
4244
4234
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -4285,7 +4275,7 @@ var import_promises18 = __toESM(require("fs/promises"), 1);
|
|
|
4285
4275
|
var import_path20 = __toESM(require("path"), 1);
|
|
4286
4276
|
var import_child_process4 = require("child_process");
|
|
4287
4277
|
init_config();
|
|
4288
|
-
var
|
|
4278
|
+
var import_axios17 = __toESM(require("axios"), 1);
|
|
4289
4279
|
function createWatchCommand() {
|
|
4290
4280
|
const watch2 = new import_commander13.Command("watch");
|
|
4291
4281
|
watch2.description("Watch for changes and auto-verify roadmap tasks").option("--no-auto-commit", "Disable auto-commit on verification").option("--no-auto-push", "Disable auto-push after commit").option("--run-tests", "Run tests before committing").option("--test-command <cmd>", "Custom test command (default: npm test)").action(async (options) => {
|
|
@@ -4326,7 +4316,7 @@ function createWatchCommand() {
|
|
|
4326
4316
|
console.log("");
|
|
4327
4317
|
const fetchActiveTask = async () => {
|
|
4328
4318
|
try {
|
|
4329
|
-
const response = await
|
|
4319
|
+
const response = await import_axios17.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4330
4320
|
params: { project_id: projectId },
|
|
4331
4321
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4332
4322
|
});
|
|
@@ -4382,7 +4372,7 @@ function createWatchCommand() {
|
|
|
4382
4372
|
return;
|
|
4383
4373
|
}
|
|
4384
4374
|
}
|
|
4385
|
-
await
|
|
4375
|
+
await import_axios17.default.post(`${apiUrl}/api/v1/roadmap/update-status`, {
|
|
4386
4376
|
project_id: projectId,
|
|
4387
4377
|
chunk_id: taskId,
|
|
4388
4378
|
status: "COMPLETED"
|
|
@@ -4492,7 +4482,7 @@ var import_commander14 = require("commander");
|
|
|
4492
4482
|
var import_chalk22 = __toESM(require("chalk"), 1);
|
|
4493
4483
|
var import_ora11 = __toESM(require("ora"), 1);
|
|
4494
4484
|
init_config();
|
|
4495
|
-
var
|
|
4485
|
+
var import_axios18 = __toESM(require("axios"), 1);
|
|
4496
4486
|
var import_child_process5 = require("child_process");
|
|
4497
4487
|
var import_promises19 = __toESM(require("fs/promises"), 1);
|
|
4498
4488
|
var import_path21 = __toESM(require("path"), 1);
|
|
@@ -4524,7 +4514,7 @@ function createFocusCommand() {
|
|
|
4524
4514
|
}
|
|
4525
4515
|
const apiUrl = getApiUrl();
|
|
4526
4516
|
try {
|
|
4527
|
-
const response = await
|
|
4517
|
+
const response = await import_axios18.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4528
4518
|
params: { project_id: projectId },
|
|
4529
4519
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4530
4520
|
});
|
|
@@ -4730,7 +4720,7 @@ var import_uuid = require("uuid");
|
|
|
4730
4720
|
|
|
4731
4721
|
// src/hive/gateway.ts
|
|
4732
4722
|
init_cjs_shims();
|
|
4733
|
-
var
|
|
4723
|
+
var import_axios19 = __toESM(require("axios"), 1);
|
|
4734
4724
|
|
|
4735
4725
|
// src/hive/scrubber.ts
|
|
4736
4726
|
init_cjs_shims();
|
|
@@ -4801,7 +4791,7 @@ var HiveGateway = class {
|
|
|
4801
4791
|
if (!this.enabled) {
|
|
4802
4792
|
console.log(import_chalk25.default.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
4803
4793
|
}
|
|
4804
|
-
this.client =
|
|
4794
|
+
this.client = import_axios19.default.create({
|
|
4805
4795
|
baseURL: baseUrl,
|
|
4806
4796
|
headers: {
|
|
4807
4797
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5051,7 +5041,7 @@ var import_commander18 = require("commander");
|
|
|
5051
5041
|
var import_chalk28 = __toESM(require("chalk"), 1);
|
|
5052
5042
|
init_governance();
|
|
5053
5043
|
init_config();
|
|
5054
|
-
var
|
|
5044
|
+
var import_axios20 = __toESM(require("axios"), 1);
|
|
5055
5045
|
function createOverrideCommand() {
|
|
5056
5046
|
const override = new import_commander18.Command("override");
|
|
5057
5047
|
override.description("Emergency Override for Governance Soft Locks").argument("<violationId>", 'ID of the violation to override (or "all")').requiredOption("-r, --reason <reason>", "Description of why this override is necessary").action(async (violationId, options) => {
|
|
@@ -5074,7 +5064,7 @@ function createOverrideCommand() {
|
|
|
5074
5064
|
if (projectId) {
|
|
5075
5065
|
const apiUrl = getApiUrl();
|
|
5076
5066
|
const apiKey = getApiKey();
|
|
5077
|
-
await
|
|
5067
|
+
await import_axios20.default.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
5078
5068
|
project_id: projectId,
|
|
5079
5069
|
task_id: "OVERRIDE-" + Date.now(),
|
|
5080
5070
|
task_title: `Governance Override: ${violationId}`,
|
|
@@ -5102,7 +5092,7 @@ init_cjs_shims();
|
|
|
5102
5092
|
var import_commander19 = require("commander");
|
|
5103
5093
|
var import_chalk29 = __toESM(require("chalk"), 1);
|
|
5104
5094
|
var import_ora12 = __toESM(require("ora"), 1);
|
|
5105
|
-
var
|
|
5095
|
+
var import_axios21 = __toESM(require("axios"), 1);
|
|
5106
5096
|
var import_inquirer4 = __toESM(require("inquirer"), 1);
|
|
5107
5097
|
init_config();
|
|
5108
5098
|
function createIdeaCommand() {
|
|
@@ -5137,7 +5127,7 @@ function createIdeaCommand() {
|
|
|
5137
5127
|
if (tags.length === 0) {
|
|
5138
5128
|
}
|
|
5139
5129
|
const spinner = (0, import_ora12.default)("Securing idea in the Lab...").start();
|
|
5140
|
-
const response = await
|
|
5130
|
+
const response = await import_axios21.default.post(
|
|
5141
5131
|
`${apiUrl}/api/v1/ideas`,
|
|
5142
5132
|
{
|
|
5143
5133
|
project_id: projectId,
|
|
@@ -9790,7 +9780,7 @@ init_cjs_shims();
|
|
|
9790
9780
|
var import_commander21 = require("commander");
|
|
9791
9781
|
var import_chalk31 = __toESM(require("chalk"), 1);
|
|
9792
9782
|
var import_ora14 = __toESM(require("ora"), 1);
|
|
9793
|
-
var
|
|
9783
|
+
var import_axios22 = __toESM(require("axios"), 1);
|
|
9794
9784
|
init_config();
|
|
9795
9785
|
function createRoadmapCommand() {
|
|
9796
9786
|
return new import_commander21.Command("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
@@ -9803,7 +9793,7 @@ function createRoadmapCommand() {
|
|
|
9803
9793
|
spinner.fail(import_chalk31.default.red('Project context missing. Run "rigstate link".'));
|
|
9804
9794
|
return;
|
|
9805
9795
|
}
|
|
9806
|
-
const response = await
|
|
9796
|
+
const response = await import_axios22.default.get(
|
|
9807
9797
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
9808
9798
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
9809
9799
|
);
|