@rigstate/cli 0.7.14 → 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 +71 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +65 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/daemon/factory.ts +2 -3
- package/src/utils/config.ts +1 -42
package/dist/index.js
CHANGED
|
@@ -55,7 +55,6 @@ var config_exports = {};
|
|
|
55
55
|
__export(config_exports, {
|
|
56
56
|
clearConfig: () => clearConfig,
|
|
57
57
|
config: () => config,
|
|
58
|
-
discoverApiUrl: () => discoverApiUrl,
|
|
59
58
|
getApiKey: () => getApiKey,
|
|
60
59
|
getApiUrl: () => getApiUrl,
|
|
61
60
|
getProjectId: () => getProjectId,
|
|
@@ -64,7 +63,6 @@ __export(config_exports, {
|
|
|
64
63
|
setProjectId: () => setProjectId
|
|
65
64
|
});
|
|
66
65
|
import Conf from "conf";
|
|
67
|
-
import axios from "axios";
|
|
68
66
|
function getApiKey() {
|
|
69
67
|
const apiKey = config.get("apiKey");
|
|
70
68
|
if (!apiKey) {
|
|
@@ -93,27 +91,6 @@ function getApiUrl() {
|
|
|
93
91
|
}
|
|
94
92
|
return "https://app.rigstate.com";
|
|
95
93
|
}
|
|
96
|
-
async function discoverApiUrl() {
|
|
97
|
-
const configuredUrl = getApiUrl();
|
|
98
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
99
|
-
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
100
|
-
return configuredUrl;
|
|
101
|
-
}
|
|
102
|
-
for (const port of ports) {
|
|
103
|
-
const url = `http://localhost:${port}`;
|
|
104
|
-
try {
|
|
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;
|
|
111
|
-
}
|
|
112
|
-
} catch (e) {
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return "https://app.rigstate.com";
|
|
116
|
-
}
|
|
117
94
|
function setApiUrl(url) {
|
|
118
95
|
config.set("apiUrl", url);
|
|
119
96
|
}
|
|
@@ -128,7 +105,7 @@ var init_config = __esm({
|
|
|
128
105
|
config = new Conf({
|
|
129
106
|
projectName: "rigstate-cli",
|
|
130
107
|
defaults: {
|
|
131
|
-
apiUrl: "
|
|
108
|
+
apiUrl: "https://app.rigstate.com"
|
|
132
109
|
}
|
|
133
110
|
});
|
|
134
111
|
}
|
|
@@ -145,7 +122,7 @@ import chalk2 from "chalk";
|
|
|
145
122
|
import ora from "ora";
|
|
146
123
|
import fs from "fs/promises";
|
|
147
124
|
import path2 from "path";
|
|
148
|
-
import
|
|
125
|
+
import axios from "axios";
|
|
149
126
|
async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
150
127
|
if (!silent) {
|
|
151
128
|
console.log("");
|
|
@@ -156,7 +133,7 @@ async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
|
156
133
|
}
|
|
157
134
|
const spinner = ora("Fetching secrets from Vault...").start();
|
|
158
135
|
try {
|
|
159
|
-
const response = await
|
|
136
|
+
const response = await axios.post(`${apiUrl}/api/v1/vault/sync`, {
|
|
160
137
|
project_id: projectId
|
|
161
138
|
}, {
|
|
162
139
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -277,13 +254,13 @@ __export(sync_rules_exports, {
|
|
|
277
254
|
import { Command as Command3 } from "commander";
|
|
278
255
|
import chalk3 from "chalk";
|
|
279
256
|
import ora2 from "ora";
|
|
280
|
-
import
|
|
257
|
+
import axios2 from "axios";
|
|
281
258
|
async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
282
259
|
const spinner = ora2("\u{1F6E1}\uFE0F Frank Protocol: Initializing retroactive sync...").start();
|
|
283
260
|
let success = true;
|
|
284
261
|
try {
|
|
285
262
|
spinner.text = "Fetching project info...";
|
|
286
|
-
const projectRes = await
|
|
263
|
+
const projectRes = await axios2.get(`${apiUrl}/api/v1/projects`, {
|
|
287
264
|
params: { project_id: projectId },
|
|
288
265
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
289
266
|
});
|
|
@@ -296,7 +273,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
296
273
|
spinner.succeed(chalk3.yellow(` [DRY-RUN] Would sync: ${project.name}`));
|
|
297
274
|
return true;
|
|
298
275
|
}
|
|
299
|
-
const syncResponse = await
|
|
276
|
+
const syncResponse = await axios2.post(`${apiUrl}/api/v1/rules/sync`, {
|
|
300
277
|
project_id: project.id
|
|
301
278
|
}, {
|
|
302
279
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -364,10 +341,10 @@ __export(suggest_exports, {
|
|
|
364
341
|
suggestNextMove: () => suggestNextMove
|
|
365
342
|
});
|
|
366
343
|
import chalk4 from "chalk";
|
|
367
|
-
import
|
|
344
|
+
import axios3 from "axios";
|
|
368
345
|
async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
369
346
|
try {
|
|
370
|
-
const response = await
|
|
347
|
+
const response = await axios3.get(`${apiUrl}/api/v1/roadmap/chunks`, {
|
|
371
348
|
params: {
|
|
372
349
|
project_id: projectId,
|
|
373
350
|
status: "PENDING",
|
|
@@ -543,14 +520,14 @@ __export(skills_provisioner_exports, {
|
|
|
543
520
|
jitProvisionSkill: () => jitProvisionSkill,
|
|
544
521
|
provisionSkills: () => provisionSkills
|
|
545
522
|
});
|
|
546
|
-
import
|
|
523
|
+
import axios6 from "axios";
|
|
547
524
|
import fs7 from "fs/promises";
|
|
548
525
|
import path8 from "path";
|
|
549
526
|
import chalk9 from "chalk";
|
|
550
527
|
async function provisionSkills(apiUrl, apiKey, projectId, rootDir) {
|
|
551
528
|
const skills = [];
|
|
552
529
|
try {
|
|
553
|
-
const response = await
|
|
530
|
+
const response = await axios6.get(`${apiUrl}/api/v1/skills`, {
|
|
554
531
|
params: { project_id: projectId },
|
|
555
532
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
556
533
|
});
|
|
@@ -748,7 +725,7 @@ __export(watchdog_exports, {
|
|
|
748
725
|
import fs9 from "fs/promises";
|
|
749
726
|
import path10 from "path";
|
|
750
727
|
import chalk11 from "chalk";
|
|
751
|
-
import
|
|
728
|
+
import axios7 from "axios";
|
|
752
729
|
async function countLines(filePath) {
|
|
753
730
|
try {
|
|
754
731
|
const content = await fs9.readFile(filePath, "utf-8");
|
|
@@ -774,7 +751,7 @@ async function fetchRulesFromApi(projectId) {
|
|
|
774
751
|
try {
|
|
775
752
|
const apiUrl = getApiUrl();
|
|
776
753
|
const apiKey = getApiKey();
|
|
777
|
-
const response = await
|
|
754
|
+
const response = await axios7.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
778
755
|
params: { project_id: projectId },
|
|
779
756
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
780
757
|
timeout: 1e4
|
|
@@ -874,7 +851,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
874
851
|
limitValue: lmax,
|
|
875
852
|
severity: "CRITICAL"
|
|
876
853
|
}));
|
|
877
|
-
await
|
|
854
|
+
await axios7.post(`${apiUrl}/api/v1/guardian/sync`, {
|
|
878
855
|
projectId,
|
|
879
856
|
violations: payloadViolations,
|
|
880
857
|
warnings
|
|
@@ -1866,9 +1843,9 @@ function createLinkCommand() {
|
|
|
1866
1843
|
console.log("");
|
|
1867
1844
|
console.log(chalk6.bold("\u{1F916} Rigstate Automation Detected"));
|
|
1868
1845
|
console.log("");
|
|
1869
|
-
const { getApiKey: getApiKey2, getApiUrl:
|
|
1846
|
+
const { getApiKey: getApiKey2, getApiUrl: getApiUrl2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
1870
1847
|
const apiKey = getApiKey2();
|
|
1871
|
-
const apiUrl =
|
|
1848
|
+
const apiUrl = getApiUrl2();
|
|
1872
1849
|
if (apiKey) {
|
|
1873
1850
|
console.log(chalk6.blue("\u{1F510} Checking Vault for secrets..."));
|
|
1874
1851
|
const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
|
|
@@ -1924,7 +1901,7 @@ init_config();
|
|
|
1924
1901
|
import { Command as Command6 } from "commander";
|
|
1925
1902
|
import chalk7 from "chalk";
|
|
1926
1903
|
import ora3 from "ora";
|
|
1927
|
-
import
|
|
1904
|
+
import axios4 from "axios";
|
|
1928
1905
|
import { glob } from "glob";
|
|
1929
1906
|
import fs5 from "fs/promises";
|
|
1930
1907
|
import path6 from "path";
|
|
@@ -2044,7 +2021,7 @@ function createScanCommand() {
|
|
|
2044
2021
|
spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
|
|
2045
2022
|
try {
|
|
2046
2023
|
const content = await fs5.readFile(filePath, "utf-8");
|
|
2047
|
-
const response = await
|
|
2024
|
+
const response = await axios4.post(
|
|
2048
2025
|
`${apiUrl}/api/v1/audit`,
|
|
2049
2026
|
{
|
|
2050
2027
|
content,
|
|
@@ -2078,7 +2055,7 @@ function createScanCommand() {
|
|
|
2078
2055
|
});
|
|
2079
2056
|
}
|
|
2080
2057
|
} catch (fileError) {
|
|
2081
|
-
if (
|
|
2058
|
+
if (axios4.isAxiosError(fileError)) {
|
|
2082
2059
|
console.warn(chalk7.yellow(`
|
|
2083
2060
|
\u26A0\uFE0F Skipping ${relativePath}: ${fileError.message}`));
|
|
2084
2061
|
} else {
|
|
@@ -2103,7 +2080,7 @@ function createScanCommand() {
|
|
|
2103
2080
|
}
|
|
2104
2081
|
} catch (error) {
|
|
2105
2082
|
spinner.fail(chalk7.red("\u274C Scan failed"));
|
|
2106
|
-
if (
|
|
2083
|
+
if (axios4.isAxiosError(error)) {
|
|
2107
2084
|
if (error.response) {
|
|
2108
2085
|
console.error(chalk7.red("API Error:"), error.response.data);
|
|
2109
2086
|
} else if (error.request) {
|
|
@@ -2180,7 +2157,7 @@ init_config();
|
|
|
2180
2157
|
import { Command as Command7 } from "commander";
|
|
2181
2158
|
import chalk8 from "chalk";
|
|
2182
2159
|
import ora4 from "ora";
|
|
2183
|
-
import
|
|
2160
|
+
import axios5 from "axios";
|
|
2184
2161
|
import { glob as glob2 } from "glob";
|
|
2185
2162
|
import fs6 from "fs/promises";
|
|
2186
2163
|
import path7 from "path";
|
|
@@ -2219,7 +2196,7 @@ function createFixCommand() {
|
|
|
2219
2196
|
spinner.start(`Analyzing ${relativePath}...`);
|
|
2220
2197
|
try {
|
|
2221
2198
|
const content = await fs6.readFile(filePath, "utf-8");
|
|
2222
|
-
const response = await
|
|
2199
|
+
const response = await axios5.post(
|
|
2223
2200
|
`${apiUrl}/api/v1/audit`,
|
|
2224
2201
|
{ content, file_path: relativePath, project_id: projectId },
|
|
2225
2202
|
{ headers: { "Authorization": `Bearer ${apiKey}` }, timeout: 12e4 }
|
|
@@ -2255,7 +2232,7 @@ ${chalk8.bold(relativePath)}: Found ${fixableIssues.length} fixable issues.`);
|
|
|
2255
2232
|
}]);
|
|
2256
2233
|
if (completeStep) {
|
|
2257
2234
|
try {
|
|
2258
|
-
await
|
|
2235
|
+
await axios5.post(
|
|
2259
2236
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
2260
2237
|
{ step_id: issue.related_step_id, status: "COMPLETED", project_id: projectId },
|
|
2261
2238
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -2296,7 +2273,7 @@ init_config();
|
|
|
2296
2273
|
import { Command as Command8 } from "commander";
|
|
2297
2274
|
import chalk12 from "chalk";
|
|
2298
2275
|
import ora5 from "ora";
|
|
2299
|
-
import
|
|
2276
|
+
import axios8 from "axios";
|
|
2300
2277
|
import fs10 from "fs/promises";
|
|
2301
2278
|
import path11 from "path";
|
|
2302
2279
|
function createSyncCommand() {
|
|
@@ -2330,7 +2307,7 @@ function createSyncCommand() {
|
|
|
2330
2307
|
return;
|
|
2331
2308
|
}
|
|
2332
2309
|
const apiUrl = getApiUrl();
|
|
2333
|
-
const response = await
|
|
2310
|
+
const response = await axios8.get(`${apiUrl}/api/v1/roadmap`, {
|
|
2334
2311
|
params: { project_id: projectId },
|
|
2335
2312
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2336
2313
|
});
|
|
@@ -2389,7 +2366,7 @@ function createSyncCommand() {
|
|
|
2389
2366
|
const logContent = await fs10.readFile(logPath, "utf-8");
|
|
2390
2367
|
const logData = JSON.parse(logContent);
|
|
2391
2368
|
if (logData.task_summary) {
|
|
2392
|
-
await
|
|
2369
|
+
await axios8.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
2393
2370
|
project_id: projectId,
|
|
2394
2371
|
...logData,
|
|
2395
2372
|
agent_role: process.env.RIGSTATE_MODE === "SUPERVISOR" ? "SUPERVISOR" : "WORKER"
|
|
@@ -2412,7 +2389,7 @@ function createSyncCommand() {
|
|
|
2412
2389
|
await runGuardianWatchdog2(process.cwd(), settings, projectId);
|
|
2413
2390
|
console.log(chalk12.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
|
|
2414
2391
|
try {
|
|
2415
|
-
const bridgeResponse = await
|
|
2392
|
+
const bridgeResponse = await axios8.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2416
2393
|
params: { project_id: projectId },
|
|
2417
2394
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2418
2395
|
});
|
|
@@ -2428,7 +2405,7 @@ function createSyncCommand() {
|
|
|
2428
2405
|
}
|
|
2429
2406
|
const pings = pending.filter((t) => t.proposal?.startsWith("ping"));
|
|
2430
2407
|
for (const ping of pings) {
|
|
2431
|
-
await
|
|
2408
|
+
await axios8.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2432
2409
|
bridge_id: ping.id,
|
|
2433
2410
|
status: "COMPLETED",
|
|
2434
2411
|
summary: "Pong! CLI Sync Heartbeat confirmed."
|
|
@@ -2458,7 +2435,7 @@ function createSyncCommand() {
|
|
|
2458
2435
|
} catch (e) {
|
|
2459
2436
|
}
|
|
2460
2437
|
try {
|
|
2461
|
-
const vaultResponse = await
|
|
2438
|
+
const vaultResponse = await axios8.post(
|
|
2462
2439
|
`${apiUrl}/api/v1/vault/sync`,
|
|
2463
2440
|
{ project_id: projectId },
|
|
2464
2441
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
@@ -2495,7 +2472,7 @@ function createSyncCommand() {
|
|
|
2495
2472
|
console.log(chalk12.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
|
|
2496
2473
|
await checkSystemIntegrity(apiUrl, apiKey, projectId);
|
|
2497
2474
|
} catch (error) {
|
|
2498
|
-
if (
|
|
2475
|
+
if (axios8.isAxiosError(error)) {
|
|
2499
2476
|
const message = error.response?.data?.error || error.message;
|
|
2500
2477
|
spinner.fail(chalk12.red(`Sync failed: ${message}`));
|
|
2501
2478
|
} else {
|
|
@@ -2507,7 +2484,7 @@ function createSyncCommand() {
|
|
|
2507
2484
|
}
|
|
2508
2485
|
async function checkSystemIntegrity(apiUrl, apiKey, projectId) {
|
|
2509
2486
|
try {
|
|
2510
|
-
const response = await
|
|
2487
|
+
const response = await axios8.get(`${apiUrl}/api/v1/system/integrity`, {
|
|
2511
2488
|
params: { project_id: projectId },
|
|
2512
2489
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2513
2490
|
});
|
|
@@ -2574,7 +2551,7 @@ async function loadManifest() {
|
|
|
2574
2551
|
|
|
2575
2552
|
// src/commands/init.ts
|
|
2576
2553
|
init_config();
|
|
2577
|
-
import
|
|
2554
|
+
import axios9 from "axios";
|
|
2578
2555
|
function createInitCommand() {
|
|
2579
2556
|
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) => {
|
|
2580
2557
|
const spinner = ora6("Initializing Rigstate project...").start();
|
|
@@ -2604,7 +2581,7 @@ function createInitCommand() {
|
|
|
2604
2581
|
spinner.start("Fetching your projects...");
|
|
2605
2582
|
let projects = [];
|
|
2606
2583
|
try {
|
|
2607
|
-
const projectsResponse = await
|
|
2584
|
+
const projectsResponse = await axios9.get(`${apiUrl}/api/v1/projects`, {
|
|
2608
2585
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2609
2586
|
});
|
|
2610
2587
|
if (projectsResponse.data.success) {
|
|
@@ -2656,7 +2633,7 @@ function createInitCommand() {
|
|
|
2656
2633
|
spinner.start("Fetching organizations...");
|
|
2657
2634
|
let orgs = [];
|
|
2658
2635
|
try {
|
|
2659
|
-
const orgsResponse = await
|
|
2636
|
+
const orgsResponse = await axios9.get(`${apiUrl}/api/v1/organizations`, {
|
|
2660
2637
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2661
2638
|
});
|
|
2662
2639
|
orgs = orgsResponse.data.data?.organizations || [];
|
|
@@ -2684,7 +2661,7 @@ function createInitCommand() {
|
|
|
2684
2661
|
}
|
|
2685
2662
|
spinner.start("Creating new project...");
|
|
2686
2663
|
try {
|
|
2687
|
-
const createResponse = await
|
|
2664
|
+
const createResponse = await axios9.post(`${apiUrl}/api/v1/projects`, {
|
|
2688
2665
|
name: newName,
|
|
2689
2666
|
organization_id: selectedOrgId
|
|
2690
2667
|
}, {
|
|
@@ -2735,7 +2712,7 @@ function createInitCommand() {
|
|
|
2735
2712
|
async function generateRules(apiUrl, apiKey, projectId, force, spinner) {
|
|
2736
2713
|
spinner.start("Generating AI rules (MDC + AGENTS.md)...");
|
|
2737
2714
|
try {
|
|
2738
|
-
const response = await
|
|
2715
|
+
const response = await axios9.post(`${apiUrl}/api/v1/rules/generate`, {
|
|
2739
2716
|
project_id: projectId
|
|
2740
2717
|
}, {
|
|
2741
2718
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -2788,7 +2765,7 @@ init_config();
|
|
|
2788
2765
|
import { Command as Command10 } from "commander";
|
|
2789
2766
|
import chalk15 from "chalk";
|
|
2790
2767
|
import ora7 from "ora";
|
|
2791
|
-
import
|
|
2768
|
+
import axios10 from "axios";
|
|
2792
2769
|
import { glob as glob3 } from "glob";
|
|
2793
2770
|
import fs14 from "fs/promises";
|
|
2794
2771
|
import path15 from "path";
|
|
@@ -3024,7 +3001,7 @@ function createCheckCommand() {
|
|
|
3024
3001
|
settings = cached.settings;
|
|
3025
3002
|
spinner.text = "Using cached rules...";
|
|
3026
3003
|
} else {
|
|
3027
|
-
const response = await
|
|
3004
|
+
const response = await axios10.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3028
3005
|
params: { project_id: projectId },
|
|
3029
3006
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3030
3007
|
timeout: 1e4
|
|
@@ -3295,7 +3272,7 @@ init_esm_shims();
|
|
|
3295
3272
|
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
3296
3273
|
import { dirname } from "path";
|
|
3297
3274
|
import path17 from "path";
|
|
3298
|
-
import
|
|
3275
|
+
import axios11 from "axios";
|
|
3299
3276
|
var GLOBAL_HEURISTICS = [
|
|
3300
3277
|
{
|
|
3301
3278
|
skillId: "payment-expert",
|
|
@@ -3345,7 +3322,7 @@ var HeuristicEngine = class {
|
|
|
3345
3322
|
try {
|
|
3346
3323
|
await mkdir(dirname(this.cachePath), { recursive: true });
|
|
3347
3324
|
const endpoint = `${apiUrl}/api/v1/skills/triggers`;
|
|
3348
|
-
const response = await
|
|
3325
|
+
const response = await axios11.get(endpoint, {
|
|
3349
3326
|
headers: {
|
|
3350
3327
|
"x-api-key": apiKey,
|
|
3351
3328
|
"Content-Type": "application/json"
|
|
@@ -3545,7 +3522,7 @@ function createInterventionProtocol() {
|
|
|
3545
3522
|
|
|
3546
3523
|
// src/daemon/guardian-monitor.ts
|
|
3547
3524
|
init_esm_shims();
|
|
3548
|
-
import
|
|
3525
|
+
import axios12 from "axios";
|
|
3549
3526
|
import chalk17 from "chalk";
|
|
3550
3527
|
import fs16 from "fs/promises";
|
|
3551
3528
|
import path19 from "path";
|
|
@@ -3559,7 +3536,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3559
3536
|
return;
|
|
3560
3537
|
}
|
|
3561
3538
|
try {
|
|
3562
|
-
const response = await
|
|
3539
|
+
const response = await axios12.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3563
3540
|
params: { project_id: projectId },
|
|
3564
3541
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3565
3542
|
timeout: 1e4
|
|
@@ -3575,7 +3552,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3575
3552
|
const cloudUrl = "https://app.rigstate.com";
|
|
3576
3553
|
console.log(chalk17.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3577
3554
|
try {
|
|
3578
|
-
const cloudResponse = await
|
|
3555
|
+
const cloudResponse = await axios12.get(`${cloudUrl}/api/v1/guardian/rules`, {
|
|
3579
3556
|
params: { project_id: projectId },
|
|
3580
3557
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3581
3558
|
timeout: 5e3
|
|
@@ -3659,7 +3636,7 @@ async function saveCachedRules2(projectId, rules) {
|
|
|
3659
3636
|
|
|
3660
3637
|
// src/daemon/bridge-listener.ts
|
|
3661
3638
|
init_esm_shims();
|
|
3662
|
-
import
|
|
3639
|
+
import axios13 from "axios";
|
|
3663
3640
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
3664
3641
|
var POLL_INTERVAL_MS = 5e3;
|
|
3665
3642
|
function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
@@ -3669,7 +3646,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3669
3646
|
let lastCheckedId = null;
|
|
3670
3647
|
const checkBridge = async () => {
|
|
3671
3648
|
try {
|
|
3672
|
-
const response = await
|
|
3649
|
+
const response = await axios13.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3673
3650
|
params: {
|
|
3674
3651
|
project_id: projectId,
|
|
3675
3652
|
action: "check"
|
|
@@ -3697,7 +3674,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3697
3674
|
};
|
|
3698
3675
|
const acknowledgePing = async (taskId) => {
|
|
3699
3676
|
try {
|
|
3700
|
-
await
|
|
3677
|
+
await axios13.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3701
3678
|
project_id: projectId,
|
|
3702
3679
|
action: "update",
|
|
3703
3680
|
bridge_id: taskId,
|
|
@@ -3730,10 +3707,10 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3730
3707
|
|
|
3731
3708
|
// src/daemon/telemetry.ts
|
|
3732
3709
|
init_esm_shims();
|
|
3733
|
-
import
|
|
3710
|
+
import axios14 from "axios";
|
|
3734
3711
|
async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
|
|
3735
3712
|
try {
|
|
3736
|
-
await
|
|
3713
|
+
await axios14.post(`${apiUrl}/api/v1/skills/usage`, {
|
|
3737
3714
|
projectId,
|
|
3738
3715
|
skillName: skillId,
|
|
3739
3716
|
status: "ACTIVATED"
|
|
@@ -3891,7 +3868,7 @@ var GuardianDaemon = class extends EventEmitter3 {
|
|
|
3891
3868
|
// src/daemon/factory.ts
|
|
3892
3869
|
init_config();
|
|
3893
3870
|
async function createDaemon(options) {
|
|
3894
|
-
const apiUrl =
|
|
3871
|
+
const apiUrl = getApiUrl();
|
|
3895
3872
|
let projectId = options.project;
|
|
3896
3873
|
if (!projectId) {
|
|
3897
3874
|
const manifest = await loadManifest();
|
|
@@ -4148,7 +4125,7 @@ init_suggest();
|
|
|
4148
4125
|
import { Command as Command12 } from "commander";
|
|
4149
4126
|
import chalk20 from "chalk";
|
|
4150
4127
|
import ora9 from "ora";
|
|
4151
|
-
import
|
|
4128
|
+
import axios15 from "axios";
|
|
4152
4129
|
import inquirer2 from "inquirer";
|
|
4153
4130
|
function createWorkCommand() {
|
|
4154
4131
|
const work = new Command12("work");
|
|
@@ -4167,7 +4144,7 @@ async function listInteractive() {
|
|
|
4167
4144
|
const spinner = ora9("Fetching roadmap...").start();
|
|
4168
4145
|
try {
|
|
4169
4146
|
const { projectId, apiKey, apiUrl } = getContext();
|
|
4170
|
-
const response = await
|
|
4147
|
+
const response = await axios15.get(
|
|
4171
4148
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4172
4149
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4173
4150
|
);
|
|
@@ -4223,12 +4200,12 @@ async function setTaskStatus(taskId, status) {
|
|
|
4223
4200
|
let realId = taskId;
|
|
4224
4201
|
if (taskId.startsWith("T-") || taskId.length < 10) {
|
|
4225
4202
|
spinner.text = "Resolving Task ID...";
|
|
4226
|
-
const lookup = await
|
|
4203
|
+
const lookup = await axios15.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
4227
4204
|
const task = lookup.data.data.roadmap.find((t) => `T-${t.step_number}` === taskId || t.step_number.toString() === taskId);
|
|
4228
4205
|
if (!task) throw new Error(`Task ${taskId} not found.`);
|
|
4229
4206
|
realId = task.id;
|
|
4230
4207
|
}
|
|
4231
|
-
await
|
|
4208
|
+
await axios15.post(
|
|
4232
4209
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
4233
4210
|
{ step_id: realId, status, project_id: projectId },
|
|
4234
4211
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -4275,7 +4252,7 @@ import chokidar2 from "chokidar";
|
|
|
4275
4252
|
import fs19 from "fs/promises";
|
|
4276
4253
|
import path21 from "path";
|
|
4277
4254
|
import { execSync as execSync4 } from "child_process";
|
|
4278
|
-
import
|
|
4255
|
+
import axios16 from "axios";
|
|
4279
4256
|
function createWatchCommand() {
|
|
4280
4257
|
const watch2 = new Command13("watch");
|
|
4281
4258
|
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) => {
|
|
@@ -4316,7 +4293,7 @@ function createWatchCommand() {
|
|
|
4316
4293
|
console.log("");
|
|
4317
4294
|
const fetchActiveTask = async () => {
|
|
4318
4295
|
try {
|
|
4319
|
-
const response = await
|
|
4296
|
+
const response = await axios16.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4320
4297
|
params: { project_id: projectId },
|
|
4321
4298
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4322
4299
|
});
|
|
@@ -4372,7 +4349,7 @@ function createWatchCommand() {
|
|
|
4372
4349
|
return;
|
|
4373
4350
|
}
|
|
4374
4351
|
}
|
|
4375
|
-
await
|
|
4352
|
+
await axios16.post(`${apiUrl}/api/v1/roadmap/update-status`, {
|
|
4376
4353
|
project_id: projectId,
|
|
4377
4354
|
chunk_id: taskId,
|
|
4378
4355
|
status: "COMPLETED"
|
|
@@ -4482,7 +4459,7 @@ init_config();
|
|
|
4482
4459
|
import { Command as Command14 } from "commander";
|
|
4483
4460
|
import chalk22 from "chalk";
|
|
4484
4461
|
import ora11 from "ora";
|
|
4485
|
-
import
|
|
4462
|
+
import axios17 from "axios";
|
|
4486
4463
|
import { execSync as execSync5 } from "child_process";
|
|
4487
4464
|
import fs20 from "fs/promises";
|
|
4488
4465
|
import path22 from "path";
|
|
@@ -4514,7 +4491,7 @@ function createFocusCommand() {
|
|
|
4514
4491
|
}
|
|
4515
4492
|
const apiUrl = getApiUrl();
|
|
4516
4493
|
try {
|
|
4517
|
-
const response = await
|
|
4494
|
+
const response = await axios17.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4518
4495
|
params: { project_id: projectId },
|
|
4519
4496
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4520
4497
|
});
|
|
@@ -4720,7 +4697,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
4720
4697
|
|
|
4721
4698
|
// src/hive/gateway.ts
|
|
4722
4699
|
init_esm_shims();
|
|
4723
|
-
import
|
|
4700
|
+
import axios18 from "axios";
|
|
4724
4701
|
|
|
4725
4702
|
// src/hive/scrubber.ts
|
|
4726
4703
|
init_esm_shims();
|
|
@@ -4791,7 +4768,7 @@ var HiveGateway = class {
|
|
|
4791
4768
|
if (!this.enabled) {
|
|
4792
4769
|
console.log(chalk25.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
4793
4770
|
}
|
|
4794
|
-
this.client =
|
|
4771
|
+
this.client = axios18.create({
|
|
4795
4772
|
baseURL: baseUrl,
|
|
4796
4773
|
headers: {
|
|
4797
4774
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5041,7 +5018,7 @@ init_governance();
|
|
|
5041
5018
|
init_config();
|
|
5042
5019
|
import { Command as Command18 } from "commander";
|
|
5043
5020
|
import chalk28 from "chalk";
|
|
5044
|
-
import
|
|
5021
|
+
import axios19 from "axios";
|
|
5045
5022
|
function createOverrideCommand() {
|
|
5046
5023
|
const override = new Command18("override");
|
|
5047
5024
|
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) => {
|
|
@@ -5064,7 +5041,7 @@ function createOverrideCommand() {
|
|
|
5064
5041
|
if (projectId) {
|
|
5065
5042
|
const apiUrl = getApiUrl();
|
|
5066
5043
|
const apiKey = getApiKey();
|
|
5067
|
-
await
|
|
5044
|
+
await axios19.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
5068
5045
|
project_id: projectId,
|
|
5069
5046
|
task_id: "OVERRIDE-" + Date.now(),
|
|
5070
5047
|
task_title: `Governance Override: ${violationId}`,
|
|
@@ -5093,7 +5070,7 @@ init_config();
|
|
|
5093
5070
|
import { Command as Command19 } from "commander";
|
|
5094
5071
|
import chalk29 from "chalk";
|
|
5095
5072
|
import ora12 from "ora";
|
|
5096
|
-
import
|
|
5073
|
+
import axios20 from "axios";
|
|
5097
5074
|
import inquirer4 from "inquirer";
|
|
5098
5075
|
function createIdeaCommand() {
|
|
5099
5076
|
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) => {
|
|
@@ -5127,7 +5104,7 @@ function createIdeaCommand() {
|
|
|
5127
5104
|
if (tags.length === 0) {
|
|
5128
5105
|
}
|
|
5129
5106
|
const spinner = ora12("Securing idea in the Lab...").start();
|
|
5130
|
-
const response = await
|
|
5107
|
+
const response = await axios20.post(
|
|
5131
5108
|
`${apiUrl}/api/v1/ideas`,
|
|
5132
5109
|
{
|
|
5133
5110
|
project_id: projectId,
|
|
@@ -9781,7 +9758,7 @@ init_config();
|
|
|
9781
9758
|
import { Command as Command21 } from "commander";
|
|
9782
9759
|
import chalk31 from "chalk";
|
|
9783
9760
|
import ora14 from "ora";
|
|
9784
|
-
import
|
|
9761
|
+
import axios21 from "axios";
|
|
9785
9762
|
function createRoadmapCommand() {
|
|
9786
9763
|
return new Command21("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
9787
9764
|
const spinner = ora14("Fetching tactical overview...").start();
|
|
@@ -9793,7 +9770,7 @@ function createRoadmapCommand() {
|
|
|
9793
9770
|
spinner.fail(chalk31.red('Project context missing. Run "rigstate link".'));
|
|
9794
9771
|
return;
|
|
9795
9772
|
}
|
|
9796
|
-
const response = await
|
|
9773
|
+
const response = await axios21.get(
|
|
9797
9774
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
9798
9775
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
9799
9776
|
);
|