@rigstate/cli 0.7.14 → 0.7.16
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 +77 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +71 -92
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/config.ts +4 -4
- package/src/commands/link.ts +3 -2
- 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
|
|
@@ -1830,6 +1807,7 @@ Your API key has been securely stored. You can now use "rigstate scan" to audit
|
|
|
1830
1807
|
|
|
1831
1808
|
// src/commands/link.ts
|
|
1832
1809
|
init_esm_shims();
|
|
1810
|
+
init_config();
|
|
1833
1811
|
import { Command as Command5 } from "commander";
|
|
1834
1812
|
import fs3 from "fs/promises";
|
|
1835
1813
|
import path4 from "path";
|
|
@@ -1856,7 +1834,7 @@ function createLinkCommand() {
|
|
|
1856
1834
|
const manifestPath = path4.join(process.cwd(), ".rigstate");
|
|
1857
1835
|
const content = {
|
|
1858
1836
|
project_id: projectId,
|
|
1859
|
-
api_url:
|
|
1837
|
+
api_url: getApiUrl(),
|
|
1860
1838
|
linked_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1861
1839
|
};
|
|
1862
1840
|
try {
|
|
@@ -1866,9 +1844,9 @@ function createLinkCommand() {
|
|
|
1866
1844
|
console.log("");
|
|
1867
1845
|
console.log(chalk6.bold("\u{1F916} Rigstate Automation Detected"));
|
|
1868
1846
|
console.log("");
|
|
1869
|
-
const { getApiKey:
|
|
1870
|
-
const apiKey =
|
|
1871
|
-
const apiUrl =
|
|
1847
|
+
const { getApiKey: _getApiKey, getApiUrl: _getApiUrl } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
1848
|
+
const apiKey = getApiKey();
|
|
1849
|
+
const apiUrl = getApiUrl();
|
|
1872
1850
|
if (apiKey) {
|
|
1873
1851
|
console.log(chalk6.blue("\u{1F510} Checking Vault for secrets..."));
|
|
1874
1852
|
const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
|
|
@@ -1924,7 +1902,7 @@ init_config();
|
|
|
1924
1902
|
import { Command as Command6 } from "commander";
|
|
1925
1903
|
import chalk7 from "chalk";
|
|
1926
1904
|
import ora3 from "ora";
|
|
1927
|
-
import
|
|
1905
|
+
import axios4 from "axios";
|
|
1928
1906
|
import { glob } from "glob";
|
|
1929
1907
|
import fs5 from "fs/promises";
|
|
1930
1908
|
import path6 from "path";
|
|
@@ -2044,7 +2022,7 @@ function createScanCommand() {
|
|
|
2044
2022
|
spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
|
|
2045
2023
|
try {
|
|
2046
2024
|
const content = await fs5.readFile(filePath, "utf-8");
|
|
2047
|
-
const response = await
|
|
2025
|
+
const response = await axios4.post(
|
|
2048
2026
|
`${apiUrl}/api/v1/audit`,
|
|
2049
2027
|
{
|
|
2050
2028
|
content,
|
|
@@ -2078,7 +2056,7 @@ function createScanCommand() {
|
|
|
2078
2056
|
});
|
|
2079
2057
|
}
|
|
2080
2058
|
} catch (fileError) {
|
|
2081
|
-
if (
|
|
2059
|
+
if (axios4.isAxiosError(fileError)) {
|
|
2082
2060
|
console.warn(chalk7.yellow(`
|
|
2083
2061
|
\u26A0\uFE0F Skipping ${relativePath}: ${fileError.message}`));
|
|
2084
2062
|
} else {
|
|
@@ -2103,7 +2081,7 @@ function createScanCommand() {
|
|
|
2103
2081
|
}
|
|
2104
2082
|
} catch (error) {
|
|
2105
2083
|
spinner.fail(chalk7.red("\u274C Scan failed"));
|
|
2106
|
-
if (
|
|
2084
|
+
if (axios4.isAxiosError(error)) {
|
|
2107
2085
|
if (error.response) {
|
|
2108
2086
|
console.error(chalk7.red("API Error:"), error.response.data);
|
|
2109
2087
|
} else if (error.request) {
|
|
@@ -2180,7 +2158,7 @@ init_config();
|
|
|
2180
2158
|
import { Command as Command7 } from "commander";
|
|
2181
2159
|
import chalk8 from "chalk";
|
|
2182
2160
|
import ora4 from "ora";
|
|
2183
|
-
import
|
|
2161
|
+
import axios5 from "axios";
|
|
2184
2162
|
import { glob as glob2 } from "glob";
|
|
2185
2163
|
import fs6 from "fs/promises";
|
|
2186
2164
|
import path7 from "path";
|
|
@@ -2219,7 +2197,7 @@ function createFixCommand() {
|
|
|
2219
2197
|
spinner.start(`Analyzing ${relativePath}...`);
|
|
2220
2198
|
try {
|
|
2221
2199
|
const content = await fs6.readFile(filePath, "utf-8");
|
|
2222
|
-
const response = await
|
|
2200
|
+
const response = await axios5.post(
|
|
2223
2201
|
`${apiUrl}/api/v1/audit`,
|
|
2224
2202
|
{ content, file_path: relativePath, project_id: projectId },
|
|
2225
2203
|
{ headers: { "Authorization": `Bearer ${apiKey}` }, timeout: 12e4 }
|
|
@@ -2255,7 +2233,7 @@ ${chalk8.bold(relativePath)}: Found ${fixableIssues.length} fixable issues.`);
|
|
|
2255
2233
|
}]);
|
|
2256
2234
|
if (completeStep) {
|
|
2257
2235
|
try {
|
|
2258
|
-
await
|
|
2236
|
+
await axios5.post(
|
|
2259
2237
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
2260
2238
|
{ step_id: issue.related_step_id, status: "COMPLETED", project_id: projectId },
|
|
2261
2239
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -2296,7 +2274,7 @@ init_config();
|
|
|
2296
2274
|
import { Command as Command8 } from "commander";
|
|
2297
2275
|
import chalk12 from "chalk";
|
|
2298
2276
|
import ora5 from "ora";
|
|
2299
|
-
import
|
|
2277
|
+
import axios8 from "axios";
|
|
2300
2278
|
import fs10 from "fs/promises";
|
|
2301
2279
|
import path11 from "path";
|
|
2302
2280
|
function createSyncCommand() {
|
|
@@ -2330,7 +2308,7 @@ function createSyncCommand() {
|
|
|
2330
2308
|
return;
|
|
2331
2309
|
}
|
|
2332
2310
|
const apiUrl = getApiUrl();
|
|
2333
|
-
const response = await
|
|
2311
|
+
const response = await axios8.get(`${apiUrl}/api/v1/roadmap`, {
|
|
2334
2312
|
params: { project_id: projectId },
|
|
2335
2313
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2336
2314
|
});
|
|
@@ -2389,7 +2367,7 @@ function createSyncCommand() {
|
|
|
2389
2367
|
const logContent = await fs10.readFile(logPath, "utf-8");
|
|
2390
2368
|
const logData = JSON.parse(logContent);
|
|
2391
2369
|
if (logData.task_summary) {
|
|
2392
|
-
await
|
|
2370
|
+
await axios8.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
2393
2371
|
project_id: projectId,
|
|
2394
2372
|
...logData,
|
|
2395
2373
|
agent_role: process.env.RIGSTATE_MODE === "SUPERVISOR" ? "SUPERVISOR" : "WORKER"
|
|
@@ -2412,7 +2390,7 @@ function createSyncCommand() {
|
|
|
2412
2390
|
await runGuardianWatchdog2(process.cwd(), settings, projectId);
|
|
2413
2391
|
console.log(chalk12.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
|
|
2414
2392
|
try {
|
|
2415
|
-
const bridgeResponse = await
|
|
2393
|
+
const bridgeResponse = await axios8.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2416
2394
|
params: { project_id: projectId },
|
|
2417
2395
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2418
2396
|
});
|
|
@@ -2428,7 +2406,7 @@ function createSyncCommand() {
|
|
|
2428
2406
|
}
|
|
2429
2407
|
const pings = pending.filter((t) => t.proposal?.startsWith("ping"));
|
|
2430
2408
|
for (const ping of pings) {
|
|
2431
|
-
await
|
|
2409
|
+
await axios8.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
2432
2410
|
bridge_id: ping.id,
|
|
2433
2411
|
status: "COMPLETED",
|
|
2434
2412
|
summary: "Pong! CLI Sync Heartbeat confirmed."
|
|
@@ -2458,7 +2436,7 @@ function createSyncCommand() {
|
|
|
2458
2436
|
} catch (e) {
|
|
2459
2437
|
}
|
|
2460
2438
|
try {
|
|
2461
|
-
const vaultResponse = await
|
|
2439
|
+
const vaultResponse = await axios8.post(
|
|
2462
2440
|
`${apiUrl}/api/v1/vault/sync`,
|
|
2463
2441
|
{ project_id: projectId },
|
|
2464
2442
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
@@ -2495,7 +2473,7 @@ function createSyncCommand() {
|
|
|
2495
2473
|
console.log(chalk12.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
|
|
2496
2474
|
await checkSystemIntegrity(apiUrl, apiKey, projectId);
|
|
2497
2475
|
} catch (error) {
|
|
2498
|
-
if (
|
|
2476
|
+
if (axios8.isAxiosError(error)) {
|
|
2499
2477
|
const message = error.response?.data?.error || error.message;
|
|
2500
2478
|
spinner.fail(chalk12.red(`Sync failed: ${message}`));
|
|
2501
2479
|
} else {
|
|
@@ -2507,7 +2485,7 @@ function createSyncCommand() {
|
|
|
2507
2485
|
}
|
|
2508
2486
|
async function checkSystemIntegrity(apiUrl, apiKey, projectId) {
|
|
2509
2487
|
try {
|
|
2510
|
-
const response = await
|
|
2488
|
+
const response = await axios8.get(`${apiUrl}/api/v1/system/integrity`, {
|
|
2511
2489
|
params: { project_id: projectId },
|
|
2512
2490
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2513
2491
|
});
|
|
@@ -2574,7 +2552,7 @@ async function loadManifest() {
|
|
|
2574
2552
|
|
|
2575
2553
|
// src/commands/init.ts
|
|
2576
2554
|
init_config();
|
|
2577
|
-
import
|
|
2555
|
+
import axios9 from "axios";
|
|
2578
2556
|
function createInitCommand() {
|
|
2579
2557
|
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
2558
|
const spinner = ora6("Initializing Rigstate project...").start();
|
|
@@ -2604,7 +2582,7 @@ function createInitCommand() {
|
|
|
2604
2582
|
spinner.start("Fetching your projects...");
|
|
2605
2583
|
let projects = [];
|
|
2606
2584
|
try {
|
|
2607
|
-
const projectsResponse = await
|
|
2585
|
+
const projectsResponse = await axios9.get(`${apiUrl}/api/v1/projects`, {
|
|
2608
2586
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2609
2587
|
});
|
|
2610
2588
|
if (projectsResponse.data.success) {
|
|
@@ -2656,7 +2634,7 @@ function createInitCommand() {
|
|
|
2656
2634
|
spinner.start("Fetching organizations...");
|
|
2657
2635
|
let orgs = [];
|
|
2658
2636
|
try {
|
|
2659
|
-
const orgsResponse = await
|
|
2637
|
+
const orgsResponse = await axios9.get(`${apiUrl}/api/v1/organizations`, {
|
|
2660
2638
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
2661
2639
|
});
|
|
2662
2640
|
orgs = orgsResponse.data.data?.organizations || [];
|
|
@@ -2684,7 +2662,7 @@ function createInitCommand() {
|
|
|
2684
2662
|
}
|
|
2685
2663
|
spinner.start("Creating new project...");
|
|
2686
2664
|
try {
|
|
2687
|
-
const createResponse = await
|
|
2665
|
+
const createResponse = await axios9.post(`${apiUrl}/api/v1/projects`, {
|
|
2688
2666
|
name: newName,
|
|
2689
2667
|
organization_id: selectedOrgId
|
|
2690
2668
|
}, {
|
|
@@ -2735,7 +2713,7 @@ function createInitCommand() {
|
|
|
2735
2713
|
async function generateRules(apiUrl, apiKey, projectId, force, spinner) {
|
|
2736
2714
|
spinner.start("Generating AI rules (MDC + AGENTS.md)...");
|
|
2737
2715
|
try {
|
|
2738
|
-
const response = await
|
|
2716
|
+
const response = await axios9.post(`${apiUrl}/api/v1/rules/generate`, {
|
|
2739
2717
|
project_id: projectId
|
|
2740
2718
|
}, {
|
|
2741
2719
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -2788,7 +2766,7 @@ init_config();
|
|
|
2788
2766
|
import { Command as Command10 } from "commander";
|
|
2789
2767
|
import chalk15 from "chalk";
|
|
2790
2768
|
import ora7 from "ora";
|
|
2791
|
-
import
|
|
2769
|
+
import axios10 from "axios";
|
|
2792
2770
|
import { glob as glob3 } from "glob";
|
|
2793
2771
|
import fs14 from "fs/promises";
|
|
2794
2772
|
import path15 from "path";
|
|
@@ -3024,7 +3002,7 @@ function createCheckCommand() {
|
|
|
3024
3002
|
settings = cached.settings;
|
|
3025
3003
|
spinner.text = "Using cached rules...";
|
|
3026
3004
|
} else {
|
|
3027
|
-
const response = await
|
|
3005
|
+
const response = await axios10.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3028
3006
|
params: { project_id: projectId },
|
|
3029
3007
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3030
3008
|
timeout: 1e4
|
|
@@ -3295,7 +3273,7 @@ init_esm_shims();
|
|
|
3295
3273
|
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
3296
3274
|
import { dirname } from "path";
|
|
3297
3275
|
import path17 from "path";
|
|
3298
|
-
import
|
|
3276
|
+
import axios11 from "axios";
|
|
3299
3277
|
var GLOBAL_HEURISTICS = [
|
|
3300
3278
|
{
|
|
3301
3279
|
skillId: "payment-expert",
|
|
@@ -3345,7 +3323,7 @@ var HeuristicEngine = class {
|
|
|
3345
3323
|
try {
|
|
3346
3324
|
await mkdir(dirname(this.cachePath), { recursive: true });
|
|
3347
3325
|
const endpoint = `${apiUrl}/api/v1/skills/triggers`;
|
|
3348
|
-
const response = await
|
|
3326
|
+
const response = await axios11.get(endpoint, {
|
|
3349
3327
|
headers: {
|
|
3350
3328
|
"x-api-key": apiKey,
|
|
3351
3329
|
"Content-Type": "application/json"
|
|
@@ -3545,7 +3523,7 @@ function createInterventionProtocol() {
|
|
|
3545
3523
|
|
|
3546
3524
|
// src/daemon/guardian-monitor.ts
|
|
3547
3525
|
init_esm_shims();
|
|
3548
|
-
import
|
|
3526
|
+
import axios12 from "axios";
|
|
3549
3527
|
import chalk17 from "chalk";
|
|
3550
3528
|
import fs16 from "fs/promises";
|
|
3551
3529
|
import path19 from "path";
|
|
@@ -3559,7 +3537,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3559
3537
|
return;
|
|
3560
3538
|
}
|
|
3561
3539
|
try {
|
|
3562
|
-
const response = await
|
|
3540
|
+
const response = await axios12.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
3563
3541
|
params: { project_id: projectId },
|
|
3564
3542
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3565
3543
|
timeout: 1e4
|
|
@@ -3575,7 +3553,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
|
|
|
3575
3553
|
const cloudUrl = "https://app.rigstate.com";
|
|
3576
3554
|
console.log(chalk17.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3577
3555
|
try {
|
|
3578
|
-
const cloudResponse = await
|
|
3556
|
+
const cloudResponse = await axios12.get(`${cloudUrl}/api/v1/guardian/rules`, {
|
|
3579
3557
|
params: { project_id: projectId },
|
|
3580
3558
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
3581
3559
|
timeout: 5e3
|
|
@@ -3659,7 +3637,7 @@ async function saveCachedRules2(projectId, rules) {
|
|
|
3659
3637
|
|
|
3660
3638
|
// src/daemon/bridge-listener.ts
|
|
3661
3639
|
init_esm_shims();
|
|
3662
|
-
import
|
|
3640
|
+
import axios13 from "axios";
|
|
3663
3641
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
3664
3642
|
var POLL_INTERVAL_MS = 5e3;
|
|
3665
3643
|
function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
@@ -3669,7 +3647,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3669
3647
|
let lastCheckedId = null;
|
|
3670
3648
|
const checkBridge = async () => {
|
|
3671
3649
|
try {
|
|
3672
|
-
const response = await
|
|
3650
|
+
const response = await axios13.get(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3673
3651
|
params: {
|
|
3674
3652
|
project_id: projectId,
|
|
3675
3653
|
action: "check"
|
|
@@ -3697,7 +3675,7 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3697
3675
|
};
|
|
3698
3676
|
const acknowledgePing = async (taskId) => {
|
|
3699
3677
|
try {
|
|
3700
|
-
await
|
|
3678
|
+
await axios13.post(`${apiUrl}/api/v1/agent/bridge`, {
|
|
3701
3679
|
project_id: projectId,
|
|
3702
3680
|
action: "update",
|
|
3703
3681
|
bridge_id: taskId,
|
|
@@ -3730,10 +3708,10 @@ function createBridgeListener(projectId, apiUrl, apiKey) {
|
|
|
3730
3708
|
|
|
3731
3709
|
// src/daemon/telemetry.ts
|
|
3732
3710
|
init_esm_shims();
|
|
3733
|
-
import
|
|
3711
|
+
import axios14 from "axios";
|
|
3734
3712
|
async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
|
|
3735
3713
|
try {
|
|
3736
|
-
await
|
|
3714
|
+
await axios14.post(`${apiUrl}/api/v1/skills/usage`, {
|
|
3737
3715
|
projectId,
|
|
3738
3716
|
skillName: skillId,
|
|
3739
3717
|
status: "ACTIVATED"
|
|
@@ -3891,7 +3869,7 @@ var GuardianDaemon = class extends EventEmitter3 {
|
|
|
3891
3869
|
// src/daemon/factory.ts
|
|
3892
3870
|
init_config();
|
|
3893
3871
|
async function createDaemon(options) {
|
|
3894
|
-
const apiUrl =
|
|
3872
|
+
const apiUrl = getApiUrl();
|
|
3895
3873
|
let projectId = options.project;
|
|
3896
3874
|
if (!projectId) {
|
|
3897
3875
|
const manifest = await loadManifest();
|
|
@@ -4148,7 +4126,7 @@ init_suggest();
|
|
|
4148
4126
|
import { Command as Command12 } from "commander";
|
|
4149
4127
|
import chalk20 from "chalk";
|
|
4150
4128
|
import ora9 from "ora";
|
|
4151
|
-
import
|
|
4129
|
+
import axios15 from "axios";
|
|
4152
4130
|
import inquirer2 from "inquirer";
|
|
4153
4131
|
function createWorkCommand() {
|
|
4154
4132
|
const work = new Command12("work");
|
|
@@ -4167,7 +4145,7 @@ async function listInteractive() {
|
|
|
4167
4145
|
const spinner = ora9("Fetching roadmap...").start();
|
|
4168
4146
|
try {
|
|
4169
4147
|
const { projectId, apiKey, apiUrl } = getContext();
|
|
4170
|
-
const response = await
|
|
4148
|
+
const response = await axios15.get(
|
|
4171
4149
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4172
4150
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4173
4151
|
);
|
|
@@ -4223,12 +4201,12 @@ async function setTaskStatus(taskId, status) {
|
|
|
4223
4201
|
let realId = taskId;
|
|
4224
4202
|
if (taskId.startsWith("T-") || taskId.length < 10) {
|
|
4225
4203
|
spinner.text = "Resolving Task ID...";
|
|
4226
|
-
const lookup = await
|
|
4204
|
+
const lookup = await axios15.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
4227
4205
|
const task = lookup.data.data.roadmap.find((t) => `T-${t.step_number}` === taskId || t.step_number.toString() === taskId);
|
|
4228
4206
|
if (!task) throw new Error(`Task ${taskId} not found.`);
|
|
4229
4207
|
realId = task.id;
|
|
4230
4208
|
}
|
|
4231
|
-
await
|
|
4209
|
+
await axios15.post(
|
|
4232
4210
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
4233
4211
|
{ step_id: realId, status, project_id: projectId },
|
|
4234
4212
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -4275,7 +4253,7 @@ import chokidar2 from "chokidar";
|
|
|
4275
4253
|
import fs19 from "fs/promises";
|
|
4276
4254
|
import path21 from "path";
|
|
4277
4255
|
import { execSync as execSync4 } from "child_process";
|
|
4278
|
-
import
|
|
4256
|
+
import axios16 from "axios";
|
|
4279
4257
|
function createWatchCommand() {
|
|
4280
4258
|
const watch2 = new Command13("watch");
|
|
4281
4259
|
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 +4294,7 @@ function createWatchCommand() {
|
|
|
4316
4294
|
console.log("");
|
|
4317
4295
|
const fetchActiveTask = async () => {
|
|
4318
4296
|
try {
|
|
4319
|
-
const response = await
|
|
4297
|
+
const response = await axios16.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4320
4298
|
params: { project_id: projectId },
|
|
4321
4299
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4322
4300
|
});
|
|
@@ -4372,7 +4350,7 @@ function createWatchCommand() {
|
|
|
4372
4350
|
return;
|
|
4373
4351
|
}
|
|
4374
4352
|
}
|
|
4375
|
-
await
|
|
4353
|
+
await axios16.post(`${apiUrl}/api/v1/roadmap/update-status`, {
|
|
4376
4354
|
project_id: projectId,
|
|
4377
4355
|
chunk_id: taskId,
|
|
4378
4356
|
status: "COMPLETED"
|
|
@@ -4482,7 +4460,7 @@ init_config();
|
|
|
4482
4460
|
import { Command as Command14 } from "commander";
|
|
4483
4461
|
import chalk22 from "chalk";
|
|
4484
4462
|
import ora11 from "ora";
|
|
4485
|
-
import
|
|
4463
|
+
import axios17 from "axios";
|
|
4486
4464
|
import { execSync as execSync5 } from "child_process";
|
|
4487
4465
|
import fs20 from "fs/promises";
|
|
4488
4466
|
import path22 from "path";
|
|
@@ -4514,7 +4492,7 @@ function createFocusCommand() {
|
|
|
4514
4492
|
}
|
|
4515
4493
|
const apiUrl = getApiUrl();
|
|
4516
4494
|
try {
|
|
4517
|
-
const response = await
|
|
4495
|
+
const response = await axios17.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4518
4496
|
params: { project_id: projectId },
|
|
4519
4497
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4520
4498
|
});
|
|
@@ -4640,11 +4618,12 @@ function createConfigCommand() {
|
|
|
4640
4618
|
console.log(chalk23.green(`\u2705 project_id updated`));
|
|
4641
4619
|
break;
|
|
4642
4620
|
case "api_url":
|
|
4643
|
-
|
|
4621
|
+
setApiUrl(value);
|
|
4622
|
+
console.log(chalk23.green(`\u2705 api_url updated`));
|
|
4644
4623
|
break;
|
|
4645
4624
|
default:
|
|
4646
4625
|
console.log(chalk23.red(`Unknown config key: ${key}`));
|
|
4647
|
-
console.log(chalk23.dim("Valid keys: api_key, project_id"));
|
|
4626
|
+
console.log(chalk23.dim("Valid keys: api_key, project_id, api_url"));
|
|
4648
4627
|
}
|
|
4649
4628
|
});
|
|
4650
4629
|
return config2;
|
|
@@ -4720,7 +4699,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
4720
4699
|
|
|
4721
4700
|
// src/hive/gateway.ts
|
|
4722
4701
|
init_esm_shims();
|
|
4723
|
-
import
|
|
4702
|
+
import axios18 from "axios";
|
|
4724
4703
|
|
|
4725
4704
|
// src/hive/scrubber.ts
|
|
4726
4705
|
init_esm_shims();
|
|
@@ -4791,7 +4770,7 @@ var HiveGateway = class {
|
|
|
4791
4770
|
if (!this.enabled) {
|
|
4792
4771
|
console.log(chalk25.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
4793
4772
|
}
|
|
4794
|
-
this.client =
|
|
4773
|
+
this.client = axios18.create({
|
|
4795
4774
|
baseURL: baseUrl,
|
|
4796
4775
|
headers: {
|
|
4797
4776
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5041,7 +5020,7 @@ init_governance();
|
|
|
5041
5020
|
init_config();
|
|
5042
5021
|
import { Command as Command18 } from "commander";
|
|
5043
5022
|
import chalk28 from "chalk";
|
|
5044
|
-
import
|
|
5023
|
+
import axios19 from "axios";
|
|
5045
5024
|
function createOverrideCommand() {
|
|
5046
5025
|
const override = new Command18("override");
|
|
5047
5026
|
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 +5043,7 @@ function createOverrideCommand() {
|
|
|
5064
5043
|
if (projectId) {
|
|
5065
5044
|
const apiUrl = getApiUrl();
|
|
5066
5045
|
const apiKey = getApiKey();
|
|
5067
|
-
await
|
|
5046
|
+
await axios19.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
5068
5047
|
project_id: projectId,
|
|
5069
5048
|
task_id: "OVERRIDE-" + Date.now(),
|
|
5070
5049
|
task_title: `Governance Override: ${violationId}`,
|
|
@@ -5093,7 +5072,7 @@ init_config();
|
|
|
5093
5072
|
import { Command as Command19 } from "commander";
|
|
5094
5073
|
import chalk29 from "chalk";
|
|
5095
5074
|
import ora12 from "ora";
|
|
5096
|
-
import
|
|
5075
|
+
import axios20 from "axios";
|
|
5097
5076
|
import inquirer4 from "inquirer";
|
|
5098
5077
|
function createIdeaCommand() {
|
|
5099
5078
|
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 +5106,7 @@ function createIdeaCommand() {
|
|
|
5127
5106
|
if (tags.length === 0) {
|
|
5128
5107
|
}
|
|
5129
5108
|
const spinner = ora12("Securing idea in the Lab...").start();
|
|
5130
|
-
const response = await
|
|
5109
|
+
const response = await axios20.post(
|
|
5131
5110
|
`${apiUrl}/api/v1/ideas`,
|
|
5132
5111
|
{
|
|
5133
5112
|
project_id: projectId,
|
|
@@ -9781,7 +9760,7 @@ init_config();
|
|
|
9781
9760
|
import { Command as Command21 } from "commander";
|
|
9782
9761
|
import chalk31 from "chalk";
|
|
9783
9762
|
import ora14 from "ora";
|
|
9784
|
-
import
|
|
9763
|
+
import axios21 from "axios";
|
|
9785
9764
|
function createRoadmapCommand() {
|
|
9786
9765
|
return new Command21("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
9787
9766
|
const spinner = ora14("Fetching tactical overview...").start();
|
|
@@ -9793,7 +9772,7 @@ function createRoadmapCommand() {
|
|
|
9793
9772
|
spinner.fail(chalk31.red('Project context missing. Run "rigstate link".'));
|
|
9794
9773
|
return;
|
|
9795
9774
|
}
|
|
9796
|
-
const response = await
|
|
9775
|
+
const response = await axios21.get(
|
|
9797
9776
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
9798
9777
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
9799
9778
|
);
|