@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.js
CHANGED
|
@@ -64,6 +64,7 @@ __export(config_exports, {
|
|
|
64
64
|
setProjectId: () => setProjectId
|
|
65
65
|
});
|
|
66
66
|
import Conf from "conf";
|
|
67
|
+
import axios from "axios";
|
|
67
68
|
function getApiKey() {
|
|
68
69
|
const apiKey = config.get("apiKey");
|
|
69
70
|
if (!apiKey) {
|
|
@@ -94,39 +95,23 @@ function getApiUrl() {
|
|
|
94
95
|
}
|
|
95
96
|
async function discoverApiUrl() {
|
|
96
97
|
const configuredUrl = getApiUrl();
|
|
97
|
-
const
|
|
98
|
-
const { default: chalk34 } = await import("chalk");
|
|
99
|
-
console.log(chalk34.gray(`\u{1F50D} Discovering local Rigstate API URL... Configured: ${configuredUrl}`));
|
|
98
|
+
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
100
99
|
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
101
|
-
console.log(chalk34.gray(` Configured URL is not localhost, trusting: ${configuredUrl}`));
|
|
102
100
|
return configuredUrl;
|
|
103
101
|
}
|
|
104
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
105
102
|
for (const port of ports) {
|
|
106
103
|
const url = `http://localhost:${port}`;
|
|
107
104
|
try {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
return url;
|
|
116
|
-
} catch (e) {
|
|
117
|
-
if (axios22.isAxiosError(e) && e.response && e.response.status === 404) {
|
|
118
|
-
console.log(chalk34.yellow(` \u26A0\uFE0F ${url} responded with 404, but might still be a Rigstate server. Skipping for now.`));
|
|
119
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNABORTED") {
|
|
120
|
-
console.log(chalk34.gray(` Connection to ${url} timed out.`));
|
|
121
|
-
} else if (axios22.isAxiosError(e) && e.code === "ECONNREFUSED") {
|
|
122
|
-
console.log(chalk34.gray(` Connection to ${url} refused.`));
|
|
123
|
-
} else {
|
|
124
|
-
console.log(chalk34.gray(` Failed to connect to ${url}: ${e.message}`));
|
|
105
|
+
const res = await axios.get(`${url}/api/v1/system/health`, { timeout: 200 });
|
|
106
|
+
if (res.data?.status === "healthy") {
|
|
107
|
+
if (url !== configuredUrl) {
|
|
108
|
+
setApiUrl(url);
|
|
109
|
+
}
|
|
110
|
+
return url;
|
|
125
111
|
}
|
|
126
|
-
|
|
112
|
+
} catch (e) {
|
|
127
113
|
}
|
|
128
114
|
}
|
|
129
|
-
console.log(chalk34.yellow(` \u274C No local Rigstate API found on scanned ports. Falling back to Rigstate Cloud.`));
|
|
130
115
|
return "https://app.rigstate.com";
|
|
131
116
|
}
|
|
132
117
|
function setApiUrl(url) {
|
|
@@ -160,7 +145,7 @@ import chalk2 from "chalk";
|
|
|
160
145
|
import ora from "ora";
|
|
161
146
|
import fs from "fs/promises";
|
|
162
147
|
import path2 from "path";
|
|
163
|
-
import
|
|
148
|
+
import axios2 from "axios";
|
|
164
149
|
async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
165
150
|
if (!silent) {
|
|
166
151
|
console.log("");
|
|
@@ -171,7 +156,7 @@ async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
|
171
156
|
}
|
|
172
157
|
const spinner = ora("Fetching secrets from Vault...").start();
|
|
173
158
|
try {
|
|
174
|
-
const response = await
|
|
159
|
+
const response = await axios2.post(`${apiUrl}/api/v1/vault/sync`, {
|
|
175
160
|
project_id: projectId
|
|
176
161
|
}, {
|
|
177
162
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -292,13 +277,13 @@ __export(sync_rules_exports, {
|
|
|
292
277
|
import { Command as Command3 } from "commander";
|
|
293
278
|
import chalk3 from "chalk";
|
|
294
279
|
import ora2 from "ora";
|
|
295
|
-
import
|
|
280
|
+
import axios3 from "axios";
|
|
296
281
|
async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
297
282
|
const spinner = ora2("\u{1F6E1}\uFE0F Frank Protocol: Initializing retroactive sync...").start();
|
|
298
283
|
let success = true;
|
|
299
284
|
try {
|
|
300
285
|
spinner.text = "Fetching project info...";
|
|
301
|
-
const projectRes = await
|
|
286
|
+
const projectRes = await axios3.get(`${apiUrl}/api/v1/projects`, {
|
|
302
287
|
params: { project_id: projectId },
|
|
303
288
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
304
289
|
});
|
|
@@ -311,7 +296,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
311
296
|
spinner.succeed(chalk3.yellow(` [DRY-RUN] Would sync: ${project.name}`));
|
|
312
297
|
return true;
|
|
313
298
|
}
|
|
314
|
-
const syncResponse = await
|
|
299
|
+
const syncResponse = await axios3.post(`${apiUrl}/api/v1/rules/sync`, {
|
|
315
300
|
project_id: project.id
|
|
316
301
|
}, {
|
|
317
302
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -379,10 +364,10 @@ __export(suggest_exports, {
|
|
|
379
364
|
suggestNextMove: () => suggestNextMove
|
|
380
365
|
});
|
|
381
366
|
import chalk4 from "chalk";
|
|
382
|
-
import
|
|
367
|
+
import axios4 from "axios";
|
|
383
368
|
async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
384
369
|
try {
|
|
385
|
-
const response = await
|
|
370
|
+
const response = await axios4.get(`${apiUrl}/api/v1/roadmap/chunks`, {
|
|
386
371
|
params: {
|
|
387
372
|
project_id: projectId,
|
|
388
373
|
status: "PENDING",
|
|
@@ -558,14 +543,14 @@ __export(skills_provisioner_exports, {
|
|
|
558
543
|
jitProvisionSkill: () => jitProvisionSkill,
|
|
559
544
|
provisionSkills: () => provisionSkills
|
|
560
545
|
});
|
|
561
|
-
import
|
|
546
|
+
import axios7 from "axios";
|
|
562
547
|
import fs7 from "fs/promises";
|
|
563
548
|
import path8 from "path";
|
|
564
549
|
import chalk9 from "chalk";
|
|
565
550
|
async function provisionSkills(apiUrl, apiKey, projectId, rootDir) {
|
|
566
551
|
const skills = [];
|
|
567
552
|
try {
|
|
568
|
-
const response = await
|
|
553
|
+
const response = await axios7.get(`${apiUrl}/api/v1/skills`, {
|
|
569
554
|
params: { project_id: projectId },
|
|
570
555
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
571
556
|
});
|
|
@@ -763,7 +748,7 @@ __export(watchdog_exports, {
|
|
|
763
748
|
import fs9 from "fs/promises";
|
|
764
749
|
import path10 from "path";
|
|
765
750
|
import chalk11 from "chalk";
|
|
766
|
-
import
|
|
751
|
+
import axios8 from "axios";
|
|
767
752
|
async function countLines(filePath) {
|
|
768
753
|
try {
|
|
769
754
|
const content = await fs9.readFile(filePath, "utf-8");
|
|
@@ -789,7 +774,7 @@ async function fetchRulesFromApi(projectId) {
|
|
|
789
774
|
try {
|
|
790
775
|
const apiUrl = getApiUrl();
|
|
791
776
|
const apiKey = getApiKey();
|
|
792
|
-
const response = await
|
|
777
|
+
const response = await axios8.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
793
778
|
params: { project_id: projectId },
|
|
794
779
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
795
780
|
timeout: 1e4
|
|
@@ -889,7 +874,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
889
874
|
limitValue: lmax,
|
|
890
875
|
severity: "CRITICAL"
|
|
891
876
|
}));
|
|
892
|
-
await
|
|
877
|
+
await axios8.post(`${apiUrl}/api/v1/guardian/sync`, {
|
|
893
878
|
projectId,
|
|
894
879
|
violations: payloadViolations,
|
|
895
880
|
warnings
|
|
@@ -1939,7 +1924,7 @@ init_config();
|
|
|
1939
1924
|
import { Command as Command6 } from "commander";
|
|
1940
1925
|
import chalk7 from "chalk";
|
|
1941
1926
|
import ora3 from "ora";
|
|
1942
|
-
import
|
|
1927
|
+
import axios5 from "axios";
|
|
1943
1928
|
import { glob } from "glob";
|
|
1944
1929
|
import fs5 from "fs/promises";
|
|
1945
1930
|
import path6 from "path";
|
|
@@ -2059,7 +2044,7 @@ function createScanCommand() {
|
|
|
2059
2044
|
spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
|
|
2060
2045
|
try {
|
|
2061
2046
|
const content = await fs5.readFile(filePath, "utf-8");
|
|
2062
|
-
const response = await
|
|
2047
|
+
const response = await axios5.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 (axios5.isAxiosError(fileError)) {
|
|
2097
2082
|
console.warn(chalk7.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(chalk7.red("\u274C Scan failed"));
|
|
2121
|
-
if (
|
|
2106
|
+
if (axios5.isAxiosError(error)) {
|
|
2122
2107
|
if (error.response) {
|
|
2123
2108
|
console.error(chalk7.red("API Error:"), error.response.data);
|
|
2124
2109
|
} else if (error.request) {
|
|
@@ -2195,7 +2180,7 @@ init_config();
|
|
|
2195
2180
|
import { Command as Command7 } from "commander";
|
|
2196
2181
|
import chalk8 from "chalk";
|
|
2197
2182
|
import ora4 from "ora";
|
|
2198
|
-
import
|
|
2183
|
+
import axios6 from "axios";
|
|
2199
2184
|
import { glob as glob2 } from "glob";
|
|
2200
2185
|
import fs6 from "fs/promises";
|
|
2201
2186
|
import path7 from "path";
|
|
@@ -2234,7 +2219,7 @@ function createFixCommand() {
|
|
|
2234
2219
|
spinner.start(`Analyzing ${relativePath}...`);
|
|
2235
2220
|
try {
|
|
2236
2221
|
const content = await fs6.readFile(filePath, "utf-8");
|
|
2237
|
-
const response = await
|
|
2222
|
+
const response = await axios6.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 @@ ${chalk8.bold(relativePath)}: Found ${fixableIssues.length} fixable issues.`);
|
|
|
2270
2255
|
}]);
|
|
2271
2256
|
if (completeStep) {
|
|
2272
2257
|
try {
|
|
2273
|
-
await
|
|
2258
|
+
await axios6.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 @@ init_config();
|
|
|
2311
2296
|
import { Command as Command8 } from "commander";
|
|
2312
2297
|
import chalk12 from "chalk";
|
|
2313
2298
|
import ora5 from "ora";
|
|
2314
|
-
import
|
|
2299
|
+
import axios9 from "axios";
|
|
2315
2300
|
import fs10 from "fs/promises";
|
|
2316
2301
|
import path11 from "path";
|
|
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 axios9.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 fs10.readFile(logPath, "utf-8");
|
|
2405
2390
|
const logData = JSON.parse(logContent);
|
|
2406
2391
|
if (logData.task_summary) {
|
|
2407
|
-
await
|
|
2392
|
+
await axios9.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(chalk12.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
|
|
2429
2414
|
try {
|
|
2430
|
-
const bridgeResponse = await
|
|
2415
|
+
const bridgeResponse = await axios9.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 axios9.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 axios9.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(chalk12.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
|
|
2511
2496
|
await checkSystemIntegrity(apiUrl, apiKey, projectId);
|
|
2512
2497
|
} catch (error) {
|
|
2513
|
-
if (
|
|
2498
|
+
if (axios9.isAxiosError(error)) {
|
|
2514
2499
|
const message = error.response?.data?.error || error.message;
|
|
2515
2500
|
spinner.fail(chalk12.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 axios9.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
|
-
import
|
|
2577
|
+
import axios10 from "axios";
|
|
2593
2578
|
function createInitCommand() {
|
|
2594
2579
|
return new Command9("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 = ora6("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 axios10.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 axios10.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 axios10.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 axios10.post(`${apiUrl}/api/v1/rules/generate`, {
|
|
2754
2739
|
project_id: projectId
|
|
2755
2740
|
}, {
|
|
2756
2741
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -2803,7 +2788,7 @@ init_config();
|
|
|
2803
2788
|
import { Command as Command10 } from "commander";
|
|
2804
2789
|
import chalk15 from "chalk";
|
|
2805
2790
|
import ora7 from "ora";
|
|
2806
|
-
import
|
|
2791
|
+
import axios11 from "axios";
|
|
2807
2792
|
import { glob as glob3 } from "glob";
|
|
2808
2793
|
import fs14 from "fs/promises";
|
|
2809
2794
|
import path15 from "path";
|
|
@@ -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 axios11.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_esm_shims();
|
|
|
3310
3295
|
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
3311
3296
|
import { dirname } from "path";
|
|
3312
3297
|
import path17 from "path";
|
|
3313
|
-
import
|
|
3298
|
+
import axios12 from "axios";
|
|
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 mkdir(dirname(this.cachePath), { recursive: true });
|
|
3362
3347
|
const endpoint = `${apiUrl}/api/v1/skills/triggers`;
|
|
3363
|
-
const response = await
|
|
3348
|
+
const response = await axios12.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_esm_shims();
|
|
3563
|
-
import
|
|
3548
|
+
import axios13 from "axios";
|
|
3564
3549
|
import chalk17 from "chalk";
|
|
3565
3550
|
import fs16 from "fs/promises";
|
|
3566
3551
|
import path19 from "path";
|
|
@@ -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 axios13.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(chalk17.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3592
3577
|
try {
|
|
3593
|
-
const cloudResponse = await
|
|
3578
|
+
const cloudResponse = await axios13.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_esm_shims();
|
|
3677
|
-
import
|
|
3662
|
+
import axios14 from "axios";
|
|
3678
3663
|
import { EventEmitter as EventEmitter2 } from "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 axios14.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 axios14.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_esm_shims();
|
|
3748
|
-
import
|
|
3733
|
+
import axios15 from "axios";
|
|
3749
3734
|
async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
|
|
3750
3735
|
try {
|
|
3751
|
-
await
|
|
3736
|
+
await axios15.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 EventEmitter3 {
|
|
|
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(chalk18.yellow(` \u26A0\uFE0F Agent Bridge connection failed: ${e.message}`));
|
|
3791
|
+
console.log(chalk18.dim(" (Daemon will continue with local monitoring only)"));
|
|
3792
|
+
}
|
|
3803
3793
|
}
|
|
3804
3794
|
this.printActive();
|
|
3805
3795
|
this.emit("started", this.state);
|
|
@@ -4158,7 +4148,7 @@ init_suggest();
|
|
|
4158
4148
|
import { Command as Command12 } from "commander";
|
|
4159
4149
|
import chalk20 from "chalk";
|
|
4160
4150
|
import ora9 from "ora";
|
|
4161
|
-
import
|
|
4151
|
+
import axios16 from "axios";
|
|
4162
4152
|
import inquirer2 from "inquirer";
|
|
4163
4153
|
function createWorkCommand() {
|
|
4164
4154
|
const work = new Command12("work");
|
|
@@ -4177,7 +4167,7 @@ async function listInteractive() {
|
|
|
4177
4167
|
const spinner = ora9("Fetching roadmap...").start();
|
|
4178
4168
|
try {
|
|
4179
4169
|
const { projectId, apiKey, apiUrl } = getContext();
|
|
4180
|
-
const response = await
|
|
4170
|
+
const response = await axios16.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 axios16.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 axios16.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 @@ import chokidar2 from "chokidar";
|
|
|
4285
4275
|
import fs19 from "fs/promises";
|
|
4286
4276
|
import path21 from "path";
|
|
4287
4277
|
import { execSync as execSync4 } from "child_process";
|
|
4288
|
-
import
|
|
4278
|
+
import axios17 from "axios";
|
|
4289
4279
|
function createWatchCommand() {
|
|
4290
4280
|
const watch2 = new Command13("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 axios17.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 axios17.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 @@ init_config();
|
|
|
4492
4482
|
import { Command as Command14 } from "commander";
|
|
4493
4483
|
import chalk22 from "chalk";
|
|
4494
4484
|
import ora11 from "ora";
|
|
4495
|
-
import
|
|
4485
|
+
import axios18 from "axios";
|
|
4496
4486
|
import { execSync as execSync5 } from "child_process";
|
|
4497
4487
|
import fs20 from "fs/promises";
|
|
4498
4488
|
import path22 from "path";
|
|
@@ -4524,7 +4514,7 @@ function createFocusCommand() {
|
|
|
4524
4514
|
}
|
|
4525
4515
|
const apiUrl = getApiUrl();
|
|
4526
4516
|
try {
|
|
4527
|
-
const response = await
|
|
4517
|
+
const response = await axios18.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4528
4518
|
params: { project_id: projectId },
|
|
4529
4519
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4530
4520
|
});
|
|
@@ -4730,7 +4720,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
4730
4720
|
|
|
4731
4721
|
// src/hive/gateway.ts
|
|
4732
4722
|
init_esm_shims();
|
|
4733
|
-
import
|
|
4723
|
+
import axios19 from "axios";
|
|
4734
4724
|
|
|
4735
4725
|
// src/hive/scrubber.ts
|
|
4736
4726
|
init_esm_shims();
|
|
@@ -4801,7 +4791,7 @@ var HiveGateway = class {
|
|
|
4801
4791
|
if (!this.enabled) {
|
|
4802
4792
|
console.log(chalk25.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
4803
4793
|
}
|
|
4804
|
-
this.client =
|
|
4794
|
+
this.client = axios19.create({
|
|
4805
4795
|
baseURL: baseUrl,
|
|
4806
4796
|
headers: {
|
|
4807
4797
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5051,7 +5041,7 @@ init_governance();
|
|
|
5051
5041
|
init_config();
|
|
5052
5042
|
import { Command as Command18 } from "commander";
|
|
5053
5043
|
import chalk28 from "chalk";
|
|
5054
|
-
import
|
|
5044
|
+
import axios20 from "axios";
|
|
5055
5045
|
function createOverrideCommand() {
|
|
5056
5046
|
const override = new Command18("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 axios20.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}`,
|
|
@@ -5103,7 +5093,7 @@ init_config();
|
|
|
5103
5093
|
import { Command as Command19 } from "commander";
|
|
5104
5094
|
import chalk29 from "chalk";
|
|
5105
5095
|
import ora12 from "ora";
|
|
5106
|
-
import
|
|
5096
|
+
import axios21 from "axios";
|
|
5107
5097
|
import inquirer4 from "inquirer";
|
|
5108
5098
|
function createIdeaCommand() {
|
|
5109
5099
|
return new Command19("idea").description("Capture a new idea or feature request").argument("[title]", "Quick title of the idea").option("-d, --desc <text>", "Detailed description").option("-t, --tag <tags>", "Comma separated tags (e.g. ui,auth)").action(async (title, options) => {
|
|
@@ -5137,7 +5127,7 @@ function createIdeaCommand() {
|
|
|
5137
5127
|
if (tags.length === 0) {
|
|
5138
5128
|
}
|
|
5139
5129
|
const spinner = ora12("Securing idea in the Lab...").start();
|
|
5140
|
-
const response = await
|
|
5130
|
+
const response = await axios21.post(
|
|
5141
5131
|
`${apiUrl}/api/v1/ideas`,
|
|
5142
5132
|
{
|
|
5143
5133
|
project_id: projectId,
|
|
@@ -9791,7 +9781,7 @@ init_config();
|
|
|
9791
9781
|
import { Command as Command21 } from "commander";
|
|
9792
9782
|
import chalk31 from "chalk";
|
|
9793
9783
|
import ora14 from "ora";
|
|
9794
|
-
import
|
|
9784
|
+
import axios22 from "axios";
|
|
9795
9785
|
function createRoadmapCommand() {
|
|
9796
9786
|
return new Command21("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
9797
9787
|
const spinner = ora14("Fetching tactical overview...").start();
|
|
@@ -9803,7 +9793,7 @@ function createRoadmapCommand() {
|
|
|
9803
9793
|
spinner.fail(chalk31.red('Project context missing. Run "rigstate link".'));
|
|
9804
9794
|
return;
|
|
9805
9795
|
}
|
|
9806
|
-
const response = await
|
|
9796
|
+
const response = await axios22.get(
|
|
9807
9797
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
9808
9798
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
9809
9799
|
);
|