@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 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, import_axios, config;
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: "http://localhost:3000"
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 import_axios2.default.post(`${apiUrl}/api/v1/vault/sync`, {
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, import_axios2;
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
- import_axios2 = __toESM(require("axios"), 1);
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 import_axios3.default.get(`${apiUrl}/api/v1/projects`, {
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 import_axios3.default.post(`${apiUrl}/api/v1/rules/sync`, {
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, import_axios3;
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
- import_axios3 = __toESM(require("axios"), 1);
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 import_axios4.default.get(`${apiUrl}/api/v1/roadmap/chunks`, {
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, import_axios4;
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
- import_axios4 = __toESM(require("axios"), 1);
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 import_axios7.default.get(`${apiUrl}/api/v1/skills`, {
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 import_axios7, import_promises7, import_path7, import_chalk9;
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
- import_axios7 = __toESM(require("axios"), 1);
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 import_axios8.default.get(`${apiUrl}/api/v1/guardian/rules`, {
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 import_axios8.default.post(`${apiUrl}/api/v1/guardian/sync`, {
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, import_axios8, DEFAULT_LMAX, DEFAULT_LMAX_WARNING, CACHE_FILE;
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
- import_axios8 = __toESM(require("axios"), 1);
871
+ import_axios7 = __toESM(require("axios"), 1);
895
872
  init_config();
896
873
  DEFAULT_LMAX = 400;
897
874
  DEFAULT_LMAX_WARNING = 350;
@@ -1835,6 +1812,7 @@ var import_promises3 = __toESM(require("fs/promises"), 1);
1835
1812
  var import_path3 = __toESM(require("path"), 1);
1836
1813
  var import_chalk6 = __toESM(require("chalk"), 1);
1837
1814
  var import_os = __toESM(require("os"), 1);
1815
+ init_config();
1838
1816
  function createLinkCommand() {
1839
1817
  return new import_commander5.Command("link").description("Link current directory to a Rigstate project").argument("<projectId>", "Project ID to link").action(async (projectId) => {
1840
1818
  try {
@@ -1856,7 +1834,7 @@ function createLinkCommand() {
1856
1834
  const manifestPath = import_path3.default.join(process.cwd(), ".rigstate");
1857
1835
  const content = {
1858
1836
  project_id: projectId,
1859
- api_url: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
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(import_chalk6.default.bold("\u{1F916} Rigstate Automation Detected"));
1868
1846
  console.log("");
1869
- const { getApiKey: getApiKey2, getApiUrl: getApiUrl3 } = await Promise.resolve().then(() => (init_config(), config_exports));
1870
- const apiKey = getApiKey2();
1871
- const apiUrl = getApiUrl3();
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(import_chalk6.default.blue("\u{1F510} Checking Vault for secrets..."));
1874
1852
  const { syncEnv: syncEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
@@ -1923,7 +1901,7 @@ init_cjs_shims();
1923
1901
  var import_commander6 = require("commander");
1924
1902
  var import_chalk7 = __toESM(require("chalk"), 1);
1925
1903
  var import_ora3 = __toESM(require("ora"), 1);
1926
- var import_axios5 = __toESM(require("axios"), 1);
1904
+ var import_axios4 = __toESM(require("axios"), 1);
1927
1905
  var import_glob = require("glob");
1928
1906
  var import_promises5 = __toESM(require("fs/promises"), 1);
1929
1907
  var import_path5 = __toESM(require("path"), 1);
@@ -2044,7 +2022,7 @@ function createScanCommand() {
2044
2022
  spinner.text = `Scanning ${i + 1}/${codeFiles.length}: ${relativePath}`;
2045
2023
  try {
2046
2024
  const content = await import_promises5.default.readFile(filePath, "utf-8");
2047
- const response = await import_axios5.default.post(
2025
+ const response = await import_axios4.default.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 (import_axios5.default.isAxiosError(fileError)) {
2059
+ if (import_axios4.default.isAxiosError(fileError)) {
2082
2060
  console.warn(import_chalk7.default.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(import_chalk7.default.red("\u274C Scan failed"));
2106
- if (import_axios5.default.isAxiosError(error)) {
2084
+ if (import_axios4.default.isAxiosError(error)) {
2107
2085
  if (error.response) {
2108
2086
  console.error(import_chalk7.default.red("API Error:"), error.response.data);
2109
2087
  } else if (error.request) {
@@ -2179,7 +2157,7 @@ init_cjs_shims();
2179
2157
  var import_commander7 = require("commander");
2180
2158
  var import_chalk8 = __toESM(require("chalk"), 1);
2181
2159
  var import_ora4 = __toESM(require("ora"), 1);
2182
- var import_axios6 = __toESM(require("axios"), 1);
2160
+ var import_axios5 = __toESM(require("axios"), 1);
2183
2161
  var import_glob2 = require("glob");
2184
2162
  var import_promises6 = __toESM(require("fs/promises"), 1);
2185
2163
  var import_path6 = __toESM(require("path"), 1);
@@ -2219,7 +2197,7 @@ function createFixCommand() {
2219
2197
  spinner.start(`Analyzing ${relativePath}...`);
2220
2198
  try {
2221
2199
  const content = await import_promises6.default.readFile(filePath, "utf-8");
2222
- const response = await import_axios6.default.post(
2200
+ const response = await import_axios5.default.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 @@ ${import_chalk8.default.bold(relativePath)}: Found ${fixableIssues.length} fixab
2255
2233
  }]);
2256
2234
  if (completeStep) {
2257
2235
  try {
2258
- await import_axios6.default.post(
2236
+ await import_axios5.default.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 @@ var import_commander8 = require("commander");
2296
2274
  var import_chalk12 = __toESM(require("chalk"), 1);
2297
2275
  var import_ora5 = __toESM(require("ora"), 1);
2298
2276
  init_config();
2299
- var import_axios9 = __toESM(require("axios"), 1);
2277
+ var import_axios8 = __toESM(require("axios"), 1);
2300
2278
  var import_promises10 = __toESM(require("fs/promises"), 1);
2301
2279
  var import_path10 = __toESM(require("path"), 1);
2302
2280
  function createSyncCommand() {
@@ -2330,7 +2308,7 @@ function createSyncCommand() {
2330
2308
  return;
2331
2309
  }
2332
2310
  const apiUrl = getApiUrl();
2333
- const response = await import_axios9.default.get(`${apiUrl}/api/v1/roadmap`, {
2311
+ const response = await import_axios8.default.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 import_promises10.default.readFile(logPath, "utf-8");
2390
2368
  const logData = JSON.parse(logContent);
2391
2369
  if (logData.task_summary) {
2392
- await import_axios9.default.post(`${apiUrl}/api/v1/execution-logs`, {
2370
+ await import_axios8.default.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(import_chalk12.default.bold("\n\u{1F4E1} Agent Bridge Heartbeat..."));
2414
2392
  try {
2415
- const bridgeResponse = await import_axios9.default.get(`${apiUrl}/api/v1/agent/bridge`, {
2393
+ const bridgeResponse = await import_axios8.default.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 import_axios9.default.post(`${apiUrl}/api/v1/agent/bridge`, {
2409
+ await import_axios8.default.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 import_axios9.default.post(
2439
+ const vaultResponse = await import_axios8.default.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(import_chalk12.default.dim("\n\u{1F6E1}\uFE0F System Integrity Check..."));
2496
2474
  await checkSystemIntegrity(apiUrl, apiKey, projectId);
2497
2475
  } catch (error) {
2498
- if (import_axios9.default.isAxiosError(error)) {
2476
+ if (import_axios8.default.isAxiosError(error)) {
2499
2477
  const message = error.response?.data?.error || error.message;
2500
2478
  spinner.fail(import_chalk12.default.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 import_axios9.default.get(`${apiUrl}/api/v1/system/integrity`, {
2488
+ const response = await import_axios8.default.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
- var import_axios10 = __toESM(require("axios"), 1);
2555
+ var import_axios9 = __toESM(require("axios"), 1);
2578
2556
  function createInitCommand() {
2579
2557
  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
2558
  const spinner = (0, import_ora6.default)("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 import_axios10.default.get(`${apiUrl}/api/v1/projects`, {
2585
+ const projectsResponse = await import_axios9.default.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 import_axios10.default.get(`${apiUrl}/api/v1/organizations`, {
2637
+ const orgsResponse = await import_axios9.default.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 import_axios10.default.post(`${apiUrl}/api/v1/projects`, {
2665
+ const createResponse = await import_axios9.default.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 import_axios10.default.post(`${apiUrl}/api/v1/rules/generate`, {
2716
+ const response = await import_axios9.default.post(`${apiUrl}/api/v1/rules/generate`, {
2739
2717
  project_id: projectId
2740
2718
  }, {
2741
2719
  headers: { Authorization: `Bearer ${apiKey}` }
@@ -2787,7 +2765,7 @@ init_cjs_shims();
2787
2765
  var import_commander10 = require("commander");
2788
2766
  var import_chalk15 = __toESM(require("chalk"), 1);
2789
2767
  var import_ora7 = __toESM(require("ora"), 1);
2790
- var import_axios11 = __toESM(require("axios"), 1);
2768
+ var import_axios10 = __toESM(require("axios"), 1);
2791
2769
  var import_glob3 = require("glob");
2792
2770
  var import_promises14 = __toESM(require("fs/promises"), 1);
2793
2771
  var import_path14 = __toESM(require("path"), 1);
@@ -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 import_axios11.default.get(`${apiUrl}/api/v1/guardian/rules`, {
3005
+ const response = await import_axios10.default.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_cjs_shims();
3295
3273
  var import_promises15 = require("fs/promises");
3296
3274
  var import_path16 = require("path");
3297
3275
  var import_path17 = __toESM(require("path"), 1);
3298
- var import_axios12 = __toESM(require("axios"), 1);
3276
+ var import_axios11 = __toESM(require("axios"), 1);
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 (0, import_promises15.mkdir)((0, import_path16.dirname)(this.cachePath), { recursive: true });
3347
3325
  const endpoint = `${apiUrl}/api/v1/skills/triggers`;
3348
- const response = await import_axios12.default.get(endpoint, {
3326
+ const response = await import_axios11.default.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_cjs_shims();
3548
- var import_axios13 = __toESM(require("axios"), 1);
3526
+ var import_axios12 = __toESM(require("axios"), 1);
3549
3527
  var import_chalk17 = __toESM(require("chalk"), 1);
3550
3528
  var import_promises16 = __toESM(require("fs/promises"), 1);
3551
3529
  var import_path18 = __toESM(require("path"), 1);
@@ -3559,7 +3537,7 @@ function createGuardianMonitor(projectId, apiUrl, apiKey) {
3559
3537
  return;
3560
3538
  }
3561
3539
  try {
3562
- const response = await import_axios13.default.get(`${apiUrl}/api/v1/guardian/rules`, {
3540
+ const response = await import_axios12.default.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(import_chalk17.default.blue(` \u2601\uFE0F Local API not found. Attempting Cloud Fallback (${cloudUrl})...`));
3577
3555
  try {
3578
- const cloudResponse = await import_axios13.default.get(`${cloudUrl}/api/v1/guardian/rules`, {
3556
+ const cloudResponse = await import_axios12.default.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_cjs_shims();
3662
- var import_axios14 = __toESM(require("axios"), 1);
3640
+ var import_axios13 = __toESM(require("axios"), 1);
3663
3641
  var import_events2 = require("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 import_axios14.default.get(`${apiUrl}/api/v1/agent/bridge`, {
3650
+ const response = await import_axios13.default.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 import_axios14.default.post(`${apiUrl}/api/v1/agent/bridge`, {
3678
+ await import_axios13.default.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_cjs_shims();
3733
- var import_axios15 = __toESM(require("axios"), 1);
3711
+ var import_axios14 = __toESM(require("axios"), 1);
3734
3712
  async function trackSkillUsage(apiUrl, apiKey, projectId, skillId) {
3735
3713
  try {
3736
- await import_axios15.default.post(`${apiUrl}/api/v1/skills/usage`, {
3714
+ await import_axios14.default.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 import_events3.EventEmitter {
3891
3869
  // src/daemon/factory.ts
3892
3870
  init_config();
3893
3871
  async function createDaemon(options) {
3894
- const apiUrl = await discoverApiUrl();
3872
+ const apiUrl = getApiUrl();
3895
3873
  let projectId = options.project;
3896
3874
  if (!projectId) {
3897
3875
  const manifest = await loadManifest();
@@ -4146,7 +4124,7 @@ init_cjs_shims();
4146
4124
  var import_commander12 = require("commander");
4147
4125
  var import_chalk20 = __toESM(require("chalk"), 1);
4148
4126
  var import_ora9 = __toESM(require("ora"), 1);
4149
- var import_axios16 = __toESM(require("axios"), 1);
4127
+ var import_axios15 = __toESM(require("axios"), 1);
4150
4128
  var import_inquirer2 = __toESM(require("inquirer"), 1);
4151
4129
  init_config();
4152
4130
  init_suggest();
@@ -4167,7 +4145,7 @@ async function listInteractive() {
4167
4145
  const spinner = (0, import_ora9.default)("Fetching roadmap...").start();
4168
4146
  try {
4169
4147
  const { projectId, apiKey, apiUrl } = getContext();
4170
- const response = await import_axios16.default.get(
4148
+ const response = await import_axios15.default.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 import_axios16.default.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
4204
+ const lookup = await import_axios15.default.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 import_axios16.default.post(
4209
+ await import_axios15.default.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 @@ var import_promises18 = __toESM(require("fs/promises"), 1);
4275
4253
  var import_path20 = __toESM(require("path"), 1);
4276
4254
  var import_child_process4 = require("child_process");
4277
4255
  init_config();
4278
- var import_axios17 = __toESM(require("axios"), 1);
4256
+ var import_axios16 = __toESM(require("axios"), 1);
4279
4257
  function createWatchCommand() {
4280
4258
  const watch2 = new import_commander13.Command("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 import_axios17.default.get(`${apiUrl}/api/v1/roadmap`, {
4297
+ const response = await import_axios16.default.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 import_axios17.default.post(`${apiUrl}/api/v1/roadmap/update-status`, {
4353
+ await import_axios16.default.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 @@ var import_commander14 = require("commander");
4482
4460
  var import_chalk22 = __toESM(require("chalk"), 1);
4483
4461
  var import_ora11 = __toESM(require("ora"), 1);
4484
4462
  init_config();
4485
- var import_axios18 = __toESM(require("axios"), 1);
4463
+ var import_axios17 = __toESM(require("axios"), 1);
4486
4464
  var import_child_process5 = require("child_process");
4487
4465
  var import_promises19 = __toESM(require("fs/promises"), 1);
4488
4466
  var import_path21 = __toESM(require("path"), 1);
@@ -4514,7 +4492,7 @@ function createFocusCommand() {
4514
4492
  }
4515
4493
  const apiUrl = getApiUrl();
4516
4494
  try {
4517
- const response = await import_axios18.default.get(`${apiUrl}/api/v1/roadmap`, {
4495
+ const response = await import_axios17.default.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(import_chalk23.default.green(`\u2705 project_id updated`));
4641
4619
  break;
4642
4620
  case "api_url":
4643
- console.log(import_chalk23.default.yellow("api_url is set via RIGSTATE_API_URL environment variable"));
4621
+ setApiUrl(value);
4622
+ console.log(import_chalk23.default.green(`\u2705 api_url updated`));
4644
4623
  break;
4645
4624
  default:
4646
4625
  console.log(import_chalk23.default.red(`Unknown config key: ${key}`));
4647
- console.log(import_chalk23.default.dim("Valid keys: api_key, project_id"));
4626
+ console.log(import_chalk23.default.dim("Valid keys: api_key, project_id, api_url"));
4648
4627
  }
4649
4628
  });
4650
4629
  return config2;
@@ -4720,7 +4699,7 @@ var import_uuid = require("uuid");
4720
4699
 
4721
4700
  // src/hive/gateway.ts
4722
4701
  init_cjs_shims();
4723
- var import_axios19 = __toESM(require("axios"), 1);
4702
+ var import_axios18 = __toESM(require("axios"), 1);
4724
4703
 
4725
4704
  // src/hive/scrubber.ts
4726
4705
  init_cjs_shims();
@@ -4791,7 +4770,7 @@ var HiveGateway = class {
4791
4770
  if (!this.enabled) {
4792
4771
  console.log(import_chalk25.default.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
4793
4772
  }
4794
- this.client = import_axios19.default.create({
4773
+ this.client = import_axios18.default.create({
4795
4774
  baseURL: baseUrl,
4796
4775
  headers: {
4797
4776
  "Authorization": `Bearer ${token}`,
@@ -5041,7 +5020,7 @@ var import_commander18 = require("commander");
5041
5020
  var import_chalk28 = __toESM(require("chalk"), 1);
5042
5021
  init_governance();
5043
5022
  init_config();
5044
- var import_axios20 = __toESM(require("axios"), 1);
5023
+ var import_axios19 = __toESM(require("axios"), 1);
5045
5024
  function createOverrideCommand() {
5046
5025
  const override = new import_commander18.Command("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 import_axios20.default.post(`${apiUrl}/api/v1/execution-logs`, {
5046
+ await import_axios19.default.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}`,
@@ -5092,7 +5071,7 @@ init_cjs_shims();
5092
5071
  var import_commander19 = require("commander");
5093
5072
  var import_chalk29 = __toESM(require("chalk"), 1);
5094
5073
  var import_ora12 = __toESM(require("ora"), 1);
5095
- var import_axios21 = __toESM(require("axios"), 1);
5074
+ var import_axios20 = __toESM(require("axios"), 1);
5096
5075
  var import_inquirer4 = __toESM(require("inquirer"), 1);
5097
5076
  init_config();
5098
5077
  function createIdeaCommand() {
@@ -5127,7 +5106,7 @@ function createIdeaCommand() {
5127
5106
  if (tags.length === 0) {
5128
5107
  }
5129
5108
  const spinner = (0, import_ora12.default)("Securing idea in the Lab...").start();
5130
- const response = await import_axios21.default.post(
5109
+ const response = await import_axios20.default.post(
5131
5110
  `${apiUrl}/api/v1/ideas`,
5132
5111
  {
5133
5112
  project_id: projectId,
@@ -9780,7 +9759,7 @@ init_cjs_shims();
9780
9759
  var import_commander21 = require("commander");
9781
9760
  var import_chalk31 = __toESM(require("chalk"), 1);
9782
9761
  var import_ora14 = __toESM(require("ora"), 1);
9783
- var import_axios22 = __toESM(require("axios"), 1);
9762
+ var import_axios21 = __toESM(require("axios"), 1);
9784
9763
  init_config();
9785
9764
  function createRoadmapCommand() {
9786
9765
  return new import_commander21.Command("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
@@ -9793,7 +9772,7 @@ function createRoadmapCommand() {
9793
9772
  spinner.fail(import_chalk31.default.red('Project context missing. Run "rigstate link".'));
9794
9773
  return;
9795
9774
  }
9796
- const response = await import_axios22.default.get(
9775
+ const response = await import_axios21.default.get(
9797
9776
  `${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
9798
9777
  { headers: { Authorization: `Bearer ${apiKey}` } }
9799
9778
  );