@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.cjs
CHANGED
|
@@ -51,7 +51,6 @@ var config_exports = {};
|
|
|
51
51
|
__export(config_exports, {
|
|
52
52
|
clearConfig: () => clearConfig,
|
|
53
53
|
config: () => config,
|
|
54
|
-
discoverApiUrl: () => discoverApiUrl,
|
|
55
54
|
getApiKey: () => getApiKey,
|
|
56
55
|
getApiUrl: () => getApiUrl,
|
|
57
56
|
getProjectId: () => getProjectId,
|
|
@@ -87,44 +86,22 @@ function getApiUrl() {
|
|
|
87
86
|
}
|
|
88
87
|
return "https://app.rigstate.com";
|
|
89
88
|
}
|
|
90
|
-
async function discoverApiUrl() {
|
|
91
|
-
const configuredUrl = getApiUrl();
|
|
92
|
-
const ports = [3e3, 3001, 3002, 3003, 3004, 3005, 3006, 3007, 3008, 3009, 3010];
|
|
93
|
-
if (!configuredUrl.includes("localhost") && !configuredUrl.includes("127.0.0.1")) {
|
|
94
|
-
return configuredUrl;
|
|
95
|
-
}
|
|
96
|
-
for (const port of ports) {
|
|
97
|
-
const url = `http://localhost:${port}`;
|
|
98
|
-
try {
|
|
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;
|
|
105
|
-
}
|
|
106
|
-
} catch (e) {
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return "https://app.rigstate.com";
|
|
110
|
-
}
|
|
111
89
|
function setApiUrl(url) {
|
|
112
90
|
config.set("apiUrl", url);
|
|
113
91
|
}
|
|
114
92
|
function clearConfig() {
|
|
115
93
|
config.clear();
|
|
116
94
|
}
|
|
117
|
-
var import_conf,
|
|
95
|
+
var import_conf, config;
|
|
118
96
|
var init_config = __esm({
|
|
119
97
|
"src/utils/config.ts"() {
|
|
120
98
|
"use strict";
|
|
121
99
|
init_cjs_shims();
|
|
122
100
|
import_conf = __toESM(require("conf"), 1);
|
|
123
|
-
import_axios = __toESM(require("axios"), 1);
|
|
124
101
|
config = new import_conf.default({
|
|
125
102
|
projectName: "rigstate-cli",
|
|
126
103
|
defaults: {
|
|
127
|
-
apiUrl: "
|
|
104
|
+
apiUrl: "https://app.rigstate.com"
|
|
128
105
|
}
|
|
129
106
|
});
|
|
130
107
|
}
|
|
@@ -146,7 +123,7 @@ async function syncEnv(projectId, apiKey, apiUrl, silent = false) {
|
|
|
146
123
|
}
|
|
147
124
|
const spinner = (0, import_ora.default)("Fetching secrets from Vault...").start();
|
|
148
125
|
try {
|
|
149
|
-
const response = await
|
|
126
|
+
const response = await import_axios.default.post(`${apiUrl}/api/v1/vault/sync`, {
|
|
150
127
|
project_id: projectId
|
|
151
128
|
}, {
|
|
152
129
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -250,7 +227,7 @@ function createEnvPullCommand() {
|
|
|
250
227
|
});
|
|
251
228
|
return envPull;
|
|
252
229
|
}
|
|
253
|
-
var import_commander2, import_chalk2, import_ora, import_promises, import_path,
|
|
230
|
+
var import_commander2, import_chalk2, import_ora, import_promises, import_path, import_axios;
|
|
254
231
|
var init_env = __esm({
|
|
255
232
|
"src/commands/env.ts"() {
|
|
256
233
|
"use strict";
|
|
@@ -261,7 +238,7 @@ var init_env = __esm({
|
|
|
261
238
|
import_promises = __toESM(require("fs/promises"), 1);
|
|
262
239
|
import_path = __toESM(require("path"), 1);
|
|
263
240
|
init_config();
|
|
264
|
-
|
|
241
|
+
import_axios = __toESM(require("axios"), 1);
|
|
265
242
|
}
|
|
266
243
|
});
|
|
267
244
|
|
|
@@ -276,7 +253,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
276
253
|
let success = true;
|
|
277
254
|
try {
|
|
278
255
|
spinner.text = "Fetching project info...";
|
|
279
|
-
const projectRes = await
|
|
256
|
+
const projectRes = await import_axios2.default.get(`${apiUrl}/api/v1/projects`, {
|
|
280
257
|
params: { project_id: projectId },
|
|
281
258
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
282
259
|
});
|
|
@@ -289,7 +266,7 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
289
266
|
spinner.succeed(import_chalk3.default.yellow(` [DRY-RUN] Would sync: ${project.name}`));
|
|
290
267
|
return true;
|
|
291
268
|
}
|
|
292
|
-
const syncResponse = await
|
|
269
|
+
const syncResponse = await import_axios2.default.post(`${apiUrl}/api/v1/rules/sync`, {
|
|
293
270
|
project_id: project.id
|
|
294
271
|
}, {
|
|
295
272
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -343,7 +320,7 @@ function createSyncRulesCommand() {
|
|
|
343
320
|
});
|
|
344
321
|
return syncRules;
|
|
345
322
|
}
|
|
346
|
-
var import_commander3, import_chalk3, import_ora2,
|
|
323
|
+
var import_commander3, import_chalk3, import_ora2, import_axios2;
|
|
347
324
|
var init_sync_rules = __esm({
|
|
348
325
|
"src/commands/sync-rules.ts"() {
|
|
349
326
|
"use strict";
|
|
@@ -352,7 +329,7 @@ var init_sync_rules = __esm({
|
|
|
352
329
|
import_chalk3 = __toESM(require("chalk"), 1);
|
|
353
330
|
import_ora2 = __toESM(require("ora"), 1);
|
|
354
331
|
init_config();
|
|
355
|
-
|
|
332
|
+
import_axios2 = __toESM(require("axios"), 1);
|
|
356
333
|
}
|
|
357
334
|
});
|
|
358
335
|
|
|
@@ -363,7 +340,7 @@ __export(suggest_exports, {
|
|
|
363
340
|
});
|
|
364
341
|
async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
365
342
|
try {
|
|
366
|
-
const response = await
|
|
343
|
+
const response = await import_axios3.default.get(`${apiUrl}/api/v1/roadmap/chunks`, {
|
|
367
344
|
params: {
|
|
368
345
|
project_id: projectId,
|
|
369
346
|
status: "PENDING",
|
|
@@ -395,13 +372,13 @@ async function suggestNextMove(projectId, apiKey, apiUrl) {
|
|
|
395
372
|
} catch (e) {
|
|
396
373
|
}
|
|
397
374
|
}
|
|
398
|
-
var import_chalk4,
|
|
375
|
+
var import_chalk4, import_axios3;
|
|
399
376
|
var init_suggest = __esm({
|
|
400
377
|
"src/commands/suggest.ts"() {
|
|
401
378
|
"use strict";
|
|
402
379
|
init_cjs_shims();
|
|
403
380
|
import_chalk4 = __toESM(require("chalk"), 1);
|
|
404
|
-
|
|
381
|
+
import_axios3 = __toESM(require("axios"), 1);
|
|
405
382
|
}
|
|
406
383
|
});
|
|
407
384
|
|
|
@@ -545,7 +522,7 @@ __export(skills_provisioner_exports, {
|
|
|
545
522
|
async function provisionSkills(apiUrl, apiKey, projectId, rootDir) {
|
|
546
523
|
const skills = [];
|
|
547
524
|
try {
|
|
548
|
-
const response = await
|
|
525
|
+
const response = await import_axios6.default.get(`${apiUrl}/api/v1/skills`, {
|
|
549
526
|
params: { project_id: projectId },
|
|
550
527
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
551
528
|
});
|
|
@@ -636,12 +613,12 @@ async function jitProvisionSkill(skillId, apiUrl, apiKey, projectId, rootDir) {
|
|
|
636
613
|
return false;
|
|
637
614
|
}
|
|
638
615
|
}
|
|
639
|
-
var
|
|
616
|
+
var import_axios6, import_promises7, import_path7, import_chalk9;
|
|
640
617
|
var init_skills_provisioner = __esm({
|
|
641
618
|
"src/utils/skills-provisioner.ts"() {
|
|
642
619
|
"use strict";
|
|
643
620
|
init_cjs_shims();
|
|
644
|
-
|
|
621
|
+
import_axios6 = __toESM(require("axios"), 1);
|
|
645
622
|
import_promises7 = __toESM(require("fs/promises"), 1);
|
|
646
623
|
import_path7 = __toESM(require("path"), 1);
|
|
647
624
|
import_chalk9 = __toESM(require("chalk"), 1);
|
|
@@ -770,7 +747,7 @@ async function fetchRulesFromApi(projectId) {
|
|
|
770
747
|
try {
|
|
771
748
|
const apiUrl = getApiUrl();
|
|
772
749
|
const apiKey = getApiKey();
|
|
773
|
-
const response = await
|
|
750
|
+
const response = await import_axios7.default.get(`${apiUrl}/api/v1/guardian/rules`, {
|
|
774
751
|
params: { project_id: projectId },
|
|
775
752
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
776
753
|
timeout: 1e4
|
|
@@ -870,7 +847,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
870
847
|
limitValue: lmax,
|
|
871
848
|
severity: "CRITICAL"
|
|
872
849
|
}));
|
|
873
|
-
await
|
|
850
|
+
await import_axios7.default.post(`${apiUrl}/api/v1/guardian/sync`, {
|
|
874
851
|
projectId,
|
|
875
852
|
violations: payloadViolations,
|
|
876
853
|
warnings
|
|
@@ -883,7 +860,7 @@ async function runGuardianWatchdog(rootPath, settings = {}, projectId) {
|
|
|
883
860
|
}
|
|
884
861
|
}
|
|
885
862
|
}
|
|
886
|
-
var import_promises9, import_path9, import_chalk11,
|
|
863
|
+
var import_promises9, import_path9, import_chalk11, import_axios7, DEFAULT_LMAX, DEFAULT_LMAX_WARNING, CACHE_FILE;
|
|
887
864
|
var init_watchdog = __esm({
|
|
888
865
|
"src/utils/watchdog.ts"() {
|
|
889
866
|
"use strict";
|
|
@@ -891,7 +868,7 @@ var init_watchdog = __esm({
|
|
|
891
868
|
import_promises9 = __toESM(require("fs/promises"), 1);
|
|
892
869
|
import_path9 = __toESM(require("path"), 1);
|
|
893
870
|
import_chalk11 = __toESM(require("chalk"), 1);
|
|
894
|
-
|
|
871
|
+
import_axios7 = __toESM(require("axios"), 1);
|
|
895
872
|
init_config();
|
|
896
873
|
DEFAULT_LMAX = 400;
|
|
897
874
|
DEFAULT_LMAX_WARNING = 350;
|
|
@@ -1866,9 +1843,9 @@ function createLinkCommand() {
|
|
|
1866
1843
|
console.log("");
|
|
1867
1844
|
console.log(import_chalk6.default.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(import_chalk6.default.blue("\u{1F510} Checking Vault for secrets..."));
|
|
1874
1851
|
const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
|
|
@@ -1923,7 +1900,7 @@ init_cjs_shims();
|
|
|
1923
1900
|
var import_commander6 = require("commander");
|
|
1924
1901
|
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
1925
1902
|
var import_ora3 = __toESM(require("ora"), 1);
|
|
1926
|
-
var
|
|
1903
|
+
var import_axios4 = __toESM(require("axios"), 1);
|
|
1927
1904
|
var import_glob = require("glob");
|
|
1928
1905
|
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
1929
1906
|
var import_path5 = __toESM(require("path"), 1);
|
|
@@ -2044,7 +2021,7 @@ function createScanCommand() {
|
|
|
2044
2021
|
spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
|
|
2045
2022
|
try {
|
|
2046
2023
|
const content = await import_promises5.default.readFile(filePath, "utf-8");
|
|
2047
|
-
const response = await
|
|
2024
|
+
const response = await import_axios4.default.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 (import_axios4.default.isAxiosError(fileError)) {
|
|
2082
2059
|
console.warn(import_chalk7.default.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(import_chalk7.default.red("\u274C Scan failed"));
|
|
2106
|
-
if (
|
|
2083
|
+
if (import_axios4.default.isAxiosError(error)) {
|
|
2107
2084
|
if (error.response) {
|
|
2108
2085
|
console.error(import_chalk7.default.red("API Error:"), error.response.data);
|
|
2109
2086
|
} else if (error.request) {
|
|
@@ -2179,7 +2156,7 @@ init_cjs_shims();
|
|
|
2179
2156
|
var import_commander7 = require("commander");
|
|
2180
2157
|
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
2181
2158
|
var import_ora4 = __toESM(require("ora"), 1);
|
|
2182
|
-
var
|
|
2159
|
+
var import_axios5 = __toESM(require("axios"), 1);
|
|
2183
2160
|
var import_glob2 = require("glob");
|
|
2184
2161
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
2185
2162
|
var import_path6 = __toESM(require("path"), 1);
|
|
@@ -2219,7 +2196,7 @@ function createFixCommand() {
|
|
|
2219
2196
|
spinner.start(`Analyzing ${relativePath}...`);
|
|
2220
2197
|
try {
|
|
2221
2198
|
const content = await import_promises6.default.readFile(filePath, "utf-8");
|
|
2222
|
-
const response = await
|
|
2199
|
+
const response = await import_axios5.default.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 @@ ${import_chalk8.default.bold(relativePath)}: Found ${fixableIssues.length} fixab
|
|
|
2255
2232
|
}]);
|
|
2256
2233
|
if (completeStep) {
|
|
2257
2234
|
try {
|
|
2258
|
-
await
|
|
2235
|
+
await import_axios5.default.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 @@ var import_commander8 = require("commander");
|
|
|
2296
2273
|
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
2297
2274
|
var import_ora5 = __toESM(require("ora"), 1);
|
|
2298
2275
|
init_config();
|
|
2299
|
-
var
|
|
2276
|
+
var import_axios8 = __toESM(require("axios"), 1);
|
|
2300
2277
|
var import_promises10 = __toESM(require("fs/promises"), 1);
|
|
2301
2278
|
var import_path10 = __toESM(require("path"), 1);
|
|
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 import_axios8.default.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 import_promises10.default.readFile(logPath, "utf-8");
|
|
2390
2367
|
const logData = JSON.parse(logContent);
|
|
2391
2368
|
if (logData.task_summary) {
|
|
2392
|
-
await
|
|
2369
|
+
await import_axios8.default.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(import_chalk12.default.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
|
|
2414
2391
|
try {
|
|
2415
|
-
const bridgeResponse = await
|
|
2392
|
+
const bridgeResponse = await import_axios8.default.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 import_axios8.default.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 import_axios8.default.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(import_chalk12.default.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
|
|
2496
2473
|
await checkSystemIntegrity(apiUrl, apiKey, projectId);
|
|
2497
2474
|
} catch (error) {
|
|
2498
|
-
if (
|
|
2475
|
+
if (import_axios8.default.isAxiosError(error)) {
|
|
2499
2476
|
const message = error.response?.data?.error || error.message;
|
|
2500
2477
|
spinner.fail(import_chalk12.default.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 import_axios8.default.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
|
-
var
|
|
2554
|
+
var import_axios9 = __toESM(require("axios"), 1);
|
|
2578
2555
|
function createInitCommand() {
|
|
2579
2556
|
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) => {
|
|
2580
2557
|
const spinner = (0, import_ora6.default)("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 import_axios9.default.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 import_axios9.default.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 import_axios9.default.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 import_axios9.default.post(`${apiUrl}/api/v1/rules/generate`, {
|
|
2739
2716
|
project_id: projectId
|
|
2740
2717
|
}, {
|
|
2741
2718
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
@@ -2787,7 +2764,7 @@ init_cjs_shims();
|
|
|
2787
2764
|
var import_commander10 = require("commander");
|
|
2788
2765
|
var import_chalk15 = __toESM(require("chalk"), 1);
|
|
2789
2766
|
var import_ora7 = __toESM(require("ora"), 1);
|
|
2790
|
-
var
|
|
2767
|
+
var import_axios10 = __toESM(require("axios"), 1);
|
|
2791
2768
|
var import_glob3 = require("glob");
|
|
2792
2769
|
var import_promises14 = __toESM(require("fs/promises"), 1);
|
|
2793
2770
|
var import_path14 = __toESM(require("path"), 1);
|
|
@@ -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 import_axios10.default.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_cjs_shims();
|
|
|
3295
3272
|
var import_promises15 = require("fs/promises");
|
|
3296
3273
|
var import_path16 = require("path");
|
|
3297
3274
|
var import_path17 = __toESM(require("path"), 1);
|
|
3298
|
-
var
|
|
3275
|
+
var import_axios11 = __toESM(require("axios"), 1);
|
|
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 (0, import_promises15.mkdir)((0, import_path16.dirname)(this.cachePath), { recursive: true });
|
|
3347
3324
|
const endpoint = `${apiUrl}/api/v1/skills/triggers`;
|
|
3348
|
-
const response = await
|
|
3325
|
+
const response = await import_axios11.default.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_cjs_shims();
|
|
3548
|
-
var
|
|
3525
|
+
var import_axios12 = __toESM(require("axios"), 1);
|
|
3549
3526
|
var import_chalk17 = __toESM(require("chalk"), 1);
|
|
3550
3527
|
var import_promises16 = __toESM(require("fs/promises"), 1);
|
|
3551
3528
|
var import_path18 = __toESM(require("path"), 1);
|
|
@@ -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 import_axios12.default.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(import_chalk17.default.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
|
|
3577
3554
|
try {
|
|
3578
|
-
const cloudResponse = await
|
|
3555
|
+
const cloudResponse = await import_axios12.default.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_cjs_shims();
|
|
3662
|
-
var
|
|
3639
|
+
var import_axios13 = __toESM(require("axios"), 1);
|
|
3663
3640
|
var import_events2 = require("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 import_axios13.default.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 import_axios13.default.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_cjs_shims();
|
|
3733
|
-
var
|
|
3710
|
+
var import_axios14 = __toESM(require("axios"), 1);
|
|
3734
3711
|
async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
|
|
3735
3712
|
try {
|
|
3736
|
-
await
|
|
3713
|
+
await import_axios14.default.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 import_events3.EventEmitter {
|
|
|
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();
|
|
@@ -4146,7 +4123,7 @@ init_cjs_shims();
|
|
|
4146
4123
|
var import_commander12 = require("commander");
|
|
4147
4124
|
var import_chalk20 = __toESM(require("chalk"), 1);
|
|
4148
4125
|
var import_ora9 = __toESM(require("ora"), 1);
|
|
4149
|
-
var
|
|
4126
|
+
var import_axios15 = __toESM(require("axios"), 1);
|
|
4150
4127
|
var import_inquirer2 = __toESM(require("inquirer"), 1);
|
|
4151
4128
|
init_config();
|
|
4152
4129
|
init_suggest();
|
|
@@ -4167,7 +4144,7 @@ async function listInteractive() {
|
|
|
4167
4144
|
const spinner = (0, import_ora9.default)("Fetching roadmap...").start();
|
|
4168
4145
|
try {
|
|
4169
4146
|
const { projectId, apiKey, apiUrl } = getContext();
|
|
4170
|
-
const response = await
|
|
4147
|
+
const response = await import_axios15.default.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 import_axios15.default.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 import_axios15.default.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 @@ var import_promises18 = __toESM(require("fs/promises"), 1);
|
|
|
4275
4252
|
var import_path20 = __toESM(require("path"), 1);
|
|
4276
4253
|
var import_child_process4 = require("child_process");
|
|
4277
4254
|
init_config();
|
|
4278
|
-
var
|
|
4255
|
+
var import_axios16 = __toESM(require("axios"), 1);
|
|
4279
4256
|
function createWatchCommand() {
|
|
4280
4257
|
const watch2 = new import_commander13.Command("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 import_axios16.default.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 import_axios16.default.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 @@ var import_commander14 = require("commander");
|
|
|
4482
4459
|
var import_chalk22 = __toESM(require("chalk"), 1);
|
|
4483
4460
|
var import_ora11 = __toESM(require("ora"), 1);
|
|
4484
4461
|
init_config();
|
|
4485
|
-
var
|
|
4462
|
+
var import_axios17 = __toESM(require("axios"), 1);
|
|
4486
4463
|
var import_child_process5 = require("child_process");
|
|
4487
4464
|
var import_promises19 = __toESM(require("fs/promises"), 1);
|
|
4488
4465
|
var import_path21 = __toESM(require("path"), 1);
|
|
@@ -4514,7 +4491,7 @@ function createFocusCommand() {
|
|
|
4514
4491
|
}
|
|
4515
4492
|
const apiUrl = getApiUrl();
|
|
4516
4493
|
try {
|
|
4517
|
-
const response = await
|
|
4494
|
+
const response = await import_axios17.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4518
4495
|
params: { project_id: projectId },
|
|
4519
4496
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4520
4497
|
});
|
|
@@ -4720,7 +4697,7 @@ var import_uuid = require("uuid");
|
|
|
4720
4697
|
|
|
4721
4698
|
// src/hive/gateway.ts
|
|
4722
4699
|
init_cjs_shims();
|
|
4723
|
-
var
|
|
4700
|
+
var import_axios18 = __toESM(require("axios"), 1);
|
|
4724
4701
|
|
|
4725
4702
|
// src/hive/scrubber.ts
|
|
4726
4703
|
init_cjs_shims();
|
|
@@ -4791,7 +4768,7 @@ var HiveGateway = class {
|
|
|
4791
4768
|
if (!this.enabled) {
|
|
4792
4769
|
console.log(import_chalk25.default.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
4793
4770
|
}
|
|
4794
|
-
this.client =
|
|
4771
|
+
this.client = import_axios18.default.create({
|
|
4795
4772
|
baseURL: baseUrl,
|
|
4796
4773
|
headers: {
|
|
4797
4774
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5041,7 +5018,7 @@ var import_commander18 = require("commander");
|
|
|
5041
5018
|
var import_chalk28 = __toESM(require("chalk"), 1);
|
|
5042
5019
|
init_governance();
|
|
5043
5020
|
init_config();
|
|
5044
|
-
var
|
|
5021
|
+
var import_axios19 = __toESM(require("axios"), 1);
|
|
5045
5022
|
function createOverrideCommand() {
|
|
5046
5023
|
const override = new import_commander18.Command("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 import_axios19.default.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}`,
|
|
@@ -5092,7 +5069,7 @@ init_cjs_shims();
|
|
|
5092
5069
|
var import_commander19 = require("commander");
|
|
5093
5070
|
var import_chalk29 = __toESM(require("chalk"), 1);
|
|
5094
5071
|
var import_ora12 = __toESM(require("ora"), 1);
|
|
5095
|
-
var
|
|
5072
|
+
var import_axios20 = __toESM(require("axios"), 1);
|
|
5096
5073
|
var import_inquirer4 = __toESM(require("inquirer"), 1);
|
|
5097
5074
|
init_config();
|
|
5098
5075
|
function createIdeaCommand() {
|
|
@@ -5127,7 +5104,7 @@ function createIdeaCommand() {
|
|
|
5127
5104
|
if (tags.length === 0) {
|
|
5128
5105
|
}
|
|
5129
5106
|
const spinner = (0, import_ora12.default)("Securing idea in the Lab...").start();
|
|
5130
|
-
const response = await
|
|
5107
|
+
const response = await import_axios20.default.post(
|
|
5131
5108
|
`${apiUrl}/api/v1/ideas`,
|
|
5132
5109
|
{
|
|
5133
5110
|
project_id: projectId,
|
|
@@ -9780,7 +9757,7 @@ init_cjs_shims();
|
|
|
9780
9757
|
var import_commander21 = require("commander");
|
|
9781
9758
|
var import_chalk31 = __toESM(require("chalk"), 1);
|
|
9782
9759
|
var import_ora14 = __toESM(require("ora"), 1);
|
|
9783
|
-
var
|
|
9760
|
+
var import_axios21 = __toESM(require("axios"), 1);
|
|
9784
9761
|
init_config();
|
|
9785
9762
|
function createRoadmapCommand() {
|
|
9786
9763
|
return new import_commander21.Command("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
@@ -9793,7 +9770,7 @@ function createRoadmapCommand() {
|
|
|
9793
9770
|
spinner.fail(import_chalk31.default.red('Project context missing. Run "rigstate link".'));
|
|
9794
9771
|
return;
|
|
9795
9772
|
}
|
|
9796
|
-
const response = await
|
|
9773
|
+
const response = await import_axios21.default.get(
|
|
9797
9774
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
9798
9775
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
9799
9776
|
);
|