@rigstate/cli 0.7.29 → 0.7.31

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.js CHANGED
@@ -286,12 +286,12 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
286
286
  }
287
287
  const files = syncResponse.data.data.files;
288
288
  if (files && Array.isArray(files)) {
289
- const fs25 = await import("fs/promises");
290
- const path28 = await import("path");
289
+ const fs26 = await import("fs/promises");
290
+ const path29 = await import("path");
291
291
  for (const file of files) {
292
- const filePath = path28.join(process.cwd(), file.path);
293
- await fs25.mkdir(path28.dirname(filePath), { recursive: true });
294
- await fs25.writeFile(filePath, file.content, "utf-8");
292
+ const filePath = path29.join(process.cwd(), file.path);
293
+ await fs26.mkdir(path29.dirname(filePath), { recursive: true });
294
+ await fs26.writeFile(filePath, file.content, "utf-8");
295
295
  }
296
296
  console.log(chalk3.dim(` \u{1F4BE} Wrote ${files.length} rule files to local .cursor/rules/`));
297
297
  }
@@ -1533,10 +1533,10 @@ var require_src2 = __commonJS({
1533
1533
  var fs_1 = __require("fs");
1534
1534
  var debug_1 = __importDefault(require_src());
1535
1535
  var log = debug_1.default("@kwsites/file-exists");
1536
- function check(path28, isFile, isDirectory) {
1537
- log(`checking %s`, path28);
1536
+ function check(path29, isFile, isDirectory) {
1537
+ log(`checking %s`, path29);
1538
1538
  try {
1539
- const stat = fs_1.statSync(path28);
1539
+ const stat = fs_1.statSync(path29);
1540
1540
  if (stat.isFile() && isFile) {
1541
1541
  log(`[OK] path represents a file`);
1542
1542
  return true;
@@ -1556,8 +1556,8 @@ var require_src2 = __commonJS({
1556
1556
  throw e;
1557
1557
  }
1558
1558
  }
1559
- function exists2(path28, type = exports.READABLE) {
1560
- return check(path28, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
1559
+ function exists2(path29, type = exports.READABLE) {
1560
+ return check(path29, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
1561
1561
  }
1562
1562
  exports.exists = exists2;
1563
1563
  exports.FILE = 1;
@@ -1627,7 +1627,7 @@ var require_package = __commonJS({
1627
1627
  "package.json"(exports, module) {
1628
1628
  module.exports = {
1629
1629
  name: "@rigstate/cli",
1630
- version: "0.7.29",
1630
+ version: "0.7.31",
1631
1631
  description: "Rigstate CLI - Code audit, sync and supervision tool",
1632
1632
  type: "module",
1633
1633
  main: "./dist/index.js",
@@ -1773,8 +1773,8 @@ function createLinkCommand() {
1773
1773
  process.exit(1);
1774
1774
  }
1775
1775
  console.log(chalk5.dim("Fetching your projects..."));
1776
- const axios23 = (await import("axios")).default;
1777
- const response = await axios23.get(`${apiUrl}/api/v1/projects`, {
1776
+ const axios24 = (await import("axios")).default;
1777
+ const response = await axios24.get(`${apiUrl}/api/v1/projects`, {
1778
1778
  headers: { Authorization: `Bearer ${apiKey}` }
1779
1779
  });
1780
1780
  if (!response.data.success || !response.data.data.projects?.length) {
@@ -1846,9 +1846,9 @@ function createLinkCommand() {
1846
1846
  });
1847
1847
  }
1848
1848
  async function hardenGitIgnore(cwd) {
1849
- const fs25 = await import("fs/promises");
1850
- const path28 = await import("path");
1851
- const ignorePath = path28.join(cwd, ".gitignore");
1849
+ const fs26 = await import("fs/promises");
1850
+ const path29 = await import("path");
1851
+ const ignorePath = path29.join(cwd, ".gitignore");
1852
1852
  const REQUIRED_IGNORES = [
1853
1853
  "# Rigstate - Runtime Artifacts (Do not commit)",
1854
1854
  ".rigstate/ACTIVE_VIOLATIONS.md",
@@ -1863,7 +1863,7 @@ async function hardenGitIgnore(cwd) {
1863
1863
  try {
1864
1864
  let content = "";
1865
1865
  try {
1866
- content = await fs25.readFile(ignorePath, "utf-8");
1866
+ content = await fs26.readFile(ignorePath, "utf-8");
1867
1867
  } catch {
1868
1868
  content = "";
1869
1869
  }
@@ -1871,7 +1871,7 @@ async function hardenGitIgnore(cwd) {
1871
1871
  if (missing.length > 0) {
1872
1872
  console.log(chalk5.dim(" Configuring .gitignore for Rigstate safety..."));
1873
1873
  const toAppend = "\n\n" + REQUIRED_IGNORES.join("\n") + "\n";
1874
- await fs25.writeFile(ignorePath, content + toAppend, "utf-8");
1874
+ await fs26.writeFile(ignorePath, content + toAppend, "utf-8");
1875
1875
  console.log(chalk5.green(" \u2714 .gitignore updated (Artifacts protected)"));
1876
1876
  } else {
1877
1877
  console.log(chalk5.green(" \u2714 .gitignore already hardened"));
@@ -1881,21 +1881,21 @@ async function hardenGitIgnore(cwd) {
1881
1881
  }
1882
1882
  }
1883
1883
  async function installHooks(cwd) {
1884
- const fs25 = await import("fs/promises");
1885
- const path28 = await import("path");
1884
+ const fs26 = await import("fs/promises");
1885
+ const path29 = await import("path");
1886
1886
  try {
1887
- await fs25.access(path28.join(cwd, ".git"));
1887
+ await fs26.access(path29.join(cwd, ".git"));
1888
1888
  } catch {
1889
1889
  console.log(chalk5.dim(" (Not a git repository, skipping hooks)"));
1890
1890
  return;
1891
1891
  }
1892
- const hooksDir = path28.join(cwd, ".husky");
1892
+ const hooksDir = path29.join(cwd, ".husky");
1893
1893
  try {
1894
- const preCommitPath = path28.join(cwd, ".git/hooks/pre-commit");
1894
+ const preCommitPath = path29.join(cwd, ".git/hooks/pre-commit");
1895
1895
  let shouldInstall = false;
1896
1896
  try {
1897
- await fs25.access(preCommitPath);
1898
- const content = await fs25.readFile(preCommitPath, "utf-8");
1897
+ await fs26.access(preCommitPath);
1898
+ const content = await fs26.readFile(preCommitPath, "utf-8");
1899
1899
  if (content.includes("rigstate")) {
1900
1900
  console.log(chalk5.green(" \u2714 Git hooks already active"));
1901
1901
  } else {
@@ -1919,12 +1919,12 @@ echo "\u{1F6E1}\uFE0F Running Guardian checks..."
1919
1919
  rigstate check --staged --strict=critical
1920
1920
  exit $?
1921
1921
  `;
1922
- await fs25.mkdir(path28.dirname(preCommitPath), { recursive: true });
1922
+ await fs26.mkdir(path29.dirname(preCommitPath), { recursive: true });
1923
1923
  if (await fileExists(preCommitPath)) {
1924
- const existing = await fs25.readFile(preCommitPath, "utf-8");
1925
- await fs25.writeFile(preCommitPath, existing + "\n\n" + PRE_COMMIT_SCRIPT2.replace("#!/bin/sh\n", ""), { mode: 493 });
1924
+ const existing = await fs26.readFile(preCommitPath, "utf-8");
1925
+ await fs26.writeFile(preCommitPath, existing + "\n\n" + PRE_COMMIT_SCRIPT2.replace("#!/bin/sh\n", ""), { mode: 493 });
1926
1926
  } else {
1927
- await fs25.writeFile(preCommitPath, PRE_COMMIT_SCRIPT2, { mode: 493 });
1927
+ await fs26.writeFile(preCommitPath, PRE_COMMIT_SCRIPT2, { mode: 493 });
1928
1928
  }
1929
1929
  console.log(chalk5.green(" \u2714 Applied Guardian protection (git-hooks)"));
1930
1930
  }
@@ -1932,10 +1932,10 @@ exit $?
1932
1932
  console.log(chalk5.dim(" (Skipped hooks: " + e.message + ")"));
1933
1933
  }
1934
1934
  }
1935
- async function fileExists(path28) {
1936
- const fs25 = await import("fs/promises");
1935
+ async function fileExists(path29) {
1936
+ const fs26 = await import("fs/promises");
1937
1937
  try {
1938
- await fs25.access(path28);
1938
+ await fs26.access(path29);
1939
1939
  return true;
1940
1940
  } catch {
1941
1941
  return false;
@@ -3341,8 +3341,8 @@ init_esm_shims();
3341
3341
  import { Command as Command11 } from "commander";
3342
3342
  import chalk21 from "chalk";
3343
3343
  import ora8 from "ora";
3344
- import fs19 from "fs/promises";
3345
- import path22 from "path";
3344
+ import fs20 from "fs/promises";
3345
+ import path23 from "path";
3346
3346
 
3347
3347
  // src/daemon/factory.ts
3348
3348
  init_esm_shims();
@@ -3350,9 +3350,9 @@ init_esm_shims();
3350
3350
  // src/daemon/core.ts
3351
3351
  init_esm_shims();
3352
3352
  import chalk19 from "chalk";
3353
- import * as fs17 from "fs/promises";
3354
- import path20 from "path";
3355
- import { EventEmitter as EventEmitter3 } from "events";
3353
+ import * as fs18 from "fs/promises";
3354
+ import path21 from "path";
3355
+ import { EventEmitter as EventEmitter4 } from "events";
3356
3356
 
3357
3357
  // src/daemon/file-watcher.ts
3358
3358
  init_esm_shims();
@@ -3970,8 +3970,142 @@ ${chalk18.gray("[Circular or invalid object]")}`;
3970
3970
  }
3971
3971
  };
3972
3972
 
3973
+ // src/daemon/harvester.ts
3974
+ init_esm_shims();
3975
+ import { EventEmitter as EventEmitter3 } from "events";
3976
+ import chokidar2 from "chokidar";
3977
+ import path20 from "path";
3978
+ import fs17 from "fs/promises";
3979
+ import crypto from "crypto";
3980
+ import axios15 from "axios";
3981
+ var KnowledgeHarvester = class extends EventEmitter3 {
3982
+ watcher = null;
3983
+ config;
3984
+ ruleHashes = /* @__PURE__ */ new Map();
3985
+ isReady = false;
3986
+ processingQueue = /* @__PURE__ */ new Set();
3987
+ debounceTimers = /* @__PURE__ */ new Map();
3988
+ // Ignore list to prevent feedback loops with system rules
3989
+ IGNORED_PREFIXES = ["rigstate-identity", "rigstate-guardian"];
3990
+ constructor(config2) {
3991
+ super();
3992
+ this.config = config2;
3993
+ }
3994
+ async start() {
3995
+ await this.loadHashes();
3996
+ const rulesPath = path20.join(this.config.watchPath, ".cursor", "rules");
3997
+ const watchPattern = path20.join(rulesPath, "**", "*.mdc");
3998
+ Logger.debug(`\u{1F33E} Harvester watching: ${watchPattern}`);
3999
+ this.watcher = chokidar2.watch(watchPattern, {
4000
+ persistent: true,
4001
+ ignoreInitial: true,
4002
+ // Don't harvest what's already there on boot
4003
+ awaitWriteFinish: {
4004
+ stabilityThreshold: 2e3,
4005
+ pollInterval: 100
4006
+ }
4007
+ });
4008
+ this.watcher.on("add", (path29) => this.handleFileEvent(path29, "add")).on("change", (path29) => this.handleFileEvent(path29, "change"));
4009
+ this.isReady = true;
4010
+ }
4011
+ async stop() {
4012
+ if (this.watcher) {
4013
+ await this.watcher.close();
4014
+ this.watcher = null;
4015
+ }
4016
+ }
4017
+ async handleFileEvent(filePath, event) {
4018
+ const fileName = path20.basename(filePath);
4019
+ if (this.IGNORED_PREFIXES.some((prefix) => fileName.startsWith(prefix))) {
4020
+ return;
4021
+ }
4022
+ if (this.debounceTimers.has(filePath)) {
4023
+ clearTimeout(this.debounceTimers.get(filePath));
4024
+ }
4025
+ this.debounceTimers.set(filePath, setTimeout(async () => {
4026
+ this.processFile(filePath);
4027
+ this.debounceTimers.delete(filePath);
4028
+ }, 5e3));
4029
+ }
4030
+ async processFile(filePath) {
4031
+ if (this.processingQueue.has(filePath)) return;
4032
+ this.processingQueue.add(filePath);
4033
+ try {
4034
+ const content = await fs17.readFile(filePath, "utf-8");
4035
+ const currentHash = this.computeHash(content);
4036
+ if (this.ruleHashes.get(filePath) === currentHash) {
4037
+ Logger.debug(`Skipping ${path20.basename(filePath)} (unchanged hash)`);
4038
+ return;
4039
+ }
4040
+ if (content.length < 20) {
4041
+ Logger.debug(`Skipping ${path20.basename(filePath)} (too short)`);
4042
+ return;
4043
+ }
4044
+ await this.submitSignal(filePath, content);
4045
+ this.ruleHashes.set(filePath, currentHash);
4046
+ } catch (error) {
4047
+ Logger.warn(`Harvester failed to process ${path20.basename(filePath)}: ${error.message}`);
4048
+ } finally {
4049
+ this.processingQueue.delete(filePath);
4050
+ }
4051
+ }
4052
+ async submitSignal(filePath, content) {
4053
+ const title = path20.basename(filePath, ".mdc");
4054
+ const relativePath = path20.relative(process.cwd(), filePath);
4055
+ Logger.info(`\u{1F33E} Harvesting new knowledge: ${title}`);
4056
+ try {
4057
+ const descriptionMatch = content.match(/description:\s*(.*)/);
4058
+ const description = descriptionMatch ? descriptionMatch[1].trim() : "Auto-harvested from IDE interaction";
4059
+ const payload = {
4060
+ project_id: this.config.projectId,
4061
+ title,
4062
+ category: "ARCHITECTURE",
4063
+ // Default
4064
+ severity: "MEDIUM",
4065
+ instruction: content,
4066
+ reasoning: `Harvested from local file: ${relativePath}`,
4067
+ source_type: "IDE_HARVESTER"
4068
+ };
4069
+ const response = await axios15.post(`${this.config.apiUrl}/api/v1/curator/signals`, payload, {
4070
+ headers: { Authorization: `Bearer ${this.config.apiKey}` }
4071
+ });
4072
+ if (response.data.success) {
4073
+ Logger.info(`\u2705 Signal submitted for review: ${title}`);
4074
+ } else {
4075
+ throw new Error(response.data.error || "Unknown API error");
4076
+ }
4077
+ } catch (error) {
4078
+ if (error.response?.status === 404) {
4079
+ Logger.debug("Curator API not reachable (404). Signal stored locally (mock).");
4080
+ } else {
4081
+ Logger.error(`Failed to submit signal: ${error.message}`);
4082
+ this.ruleHashes.delete(filePath);
4083
+ throw error;
4084
+ }
4085
+ }
4086
+ }
4087
+ async loadHashes() {
4088
+ const rulesPath = path20.join(this.config.watchPath, ".cursor", "rules");
4089
+ try {
4090
+ await fs17.mkdir(rulesPath, { recursive: true });
4091
+ const files = await fs17.readdir(rulesPath);
4092
+ for (const file of files) {
4093
+ if (file.endsWith(".mdc")) {
4094
+ const fullPath = path20.join(rulesPath, file);
4095
+ const content = await fs17.readFile(fullPath, "utf-8");
4096
+ this.ruleHashes.set(fullPath, this.computeHash(content));
4097
+ }
4098
+ }
4099
+ } catch (e) {
4100
+ }
4101
+ }
4102
+ computeHash(content) {
4103
+ return crypto.createHash("sha256").update(content).digest("hex");
4104
+ }
4105
+ };
4106
+
3973
4107
  // src/daemon/core.ts
3974
- var GuardianDaemon = class extends EventEmitter3 {
4108
+ var GuardianDaemon = class extends EventEmitter4 {
3975
4109
  config;
3976
4110
  state;
3977
4111
  fileWatcher = null;
@@ -3979,6 +4113,8 @@ var GuardianDaemon = class extends EventEmitter3 {
3979
4113
  heuristicEngine = null;
3980
4114
  interventionProtocol = null;
3981
4115
  bridgeListener = null;
4116
+ harvester = null;
4117
+ syncInterval = null;
3982
4118
  constructor(config2) {
3983
4119
  super();
3984
4120
  this.config = config2;
@@ -4002,13 +4138,24 @@ var GuardianDaemon = class extends EventEmitter3 {
4002
4138
  this.heuristicEngine = createHeuristicEngine();
4003
4139
  this.interventionProtocol = createInterventionProtocol();
4004
4140
  this.guardianMonitor = createGuardianMonitor(this.config.projectId, this.config.apiUrl, this.config.apiKey);
4141
+ this.harvester = new KnowledgeHarvester({
4142
+ projectId: this.config.projectId,
4143
+ apiUrl: this.config.apiUrl,
4144
+ apiKey: this.config.apiKey,
4145
+ watchPath: process.cwd()
4146
+ });
4005
4147
  await this.guardianMonitor.loadRules();
4006
4148
  Logger.info(`Loaded ${this.guardianMonitor.getRuleCount()} rules`);
4007
4149
  Logger.info("Syncing Brain to IDE (.cursor/rules)...");
4008
- await syncProjectRules(this.config.projectId, this.config.apiKey, this.config.apiUrl);
4150
+ await this.runRuleSync();
4009
4151
  await this.syncHeuristics();
4010
4152
  if (this.config.checkOnChange) {
4011
4153
  this.setupFileWatcher();
4154
+ await this.harvester.start();
4155
+ Logger.info("Starting Auto-Sync Poller (5m interval)...");
4156
+ this.syncInterval = setInterval(() => {
4157
+ this.runRuleSync().catch((e) => Logger.error(`Auto-Sync failed: ${e.message}`));
4158
+ }, 5 * 60 * 1e3);
4012
4159
  }
4013
4160
  if (this.config.bridgeEnabled) {
4014
4161
  try {
@@ -4022,6 +4169,14 @@ var GuardianDaemon = class extends EventEmitter3 {
4022
4169
  await this.updateViolationReport([]);
4023
4170
  this.emit("started", this.state);
4024
4171
  }
4172
+ async runRuleSync() {
4173
+ try {
4174
+ await syncProjectRules(this.config.projectId, this.config.apiKey, this.config.apiUrl);
4175
+ Logger.debug("Auto-Sync completed successfully");
4176
+ } catch (error) {
4177
+ Logger.warn(`Rule sync hiccup: ${error.message}`);
4178
+ }
4179
+ }
4025
4180
  printWelcome() {
4026
4181
  console.log(chalk19.bold.blue("\n\u{1F6E1}\uFE0F Guardian Daemon Starting..."));
4027
4182
  console.log(chalk19.dim(`Project: ${this.config.projectId}`));
@@ -4042,7 +4197,7 @@ var GuardianDaemon = class extends EventEmitter3 {
4042
4197
  setupFileWatcher() {
4043
4198
  Logger.info("Starting file watcher...");
4044
4199
  this.fileWatcher = createFileWatcher(this.config.watchPath);
4045
- this.fileWatcher.on("change", (path28) => this.handleFileChange(path28));
4200
+ this.fileWatcher.on("change", (path29) => this.handleFileChange(path29));
4046
4201
  this.fileWatcher.start();
4047
4202
  Logger.info("File watcher active");
4048
4203
  }
@@ -4055,7 +4210,7 @@ var GuardianDaemon = class extends EventEmitter3 {
4055
4210
  }
4056
4211
  async getLineCount(filePath) {
4057
4212
  try {
4058
- const content = await fs17.readFile(filePath, "utf-8");
4213
+ const content = await fs18.readFile(filePath, "utf-8");
4059
4214
  return content.split("\n").length;
4060
4215
  } catch (e) {
4061
4216
  return 0;
@@ -4092,7 +4247,7 @@ var GuardianDaemon = class extends EventEmitter3 {
4092
4247
  }
4093
4248
  }
4094
4249
  async updateViolationReport(violations) {
4095
- const reportPath = path20.join(process.cwd(), ".rigstate", "ACTIVE_VIOLATIONS.md");
4250
+ const reportPath = path21.join(process.cwd(), ".rigstate", "ACTIVE_VIOLATIONS.md");
4096
4251
  const allViolations = Array.from(this.violationsMap.entries());
4097
4252
  const totalCount = allViolations.reduce((acc, [, v]) => acc + v.length, 0);
4098
4253
  let content = `# \u{1F6E1}\uFE0F Guardian Status: ${totalCount > 0 ? "\u26A0\uFE0F ATTENTION" : "\u2705 PASS"}
@@ -4108,7 +4263,7 @@ var GuardianDaemon = class extends EventEmitter3 {
4108
4263
  } else {
4109
4264
  content += "### \u{1F6A8} Active Violations\n\n";
4110
4265
  for (const [file, fileViolations] of allViolations) {
4111
- const relPath = path20.relative(process.cwd(), file);
4266
+ const relPath = path21.relative(process.cwd(), file);
4112
4267
  content += `#### \u{1F4C4} ${relPath}
4113
4268
  `;
4114
4269
  for (const v of fileViolations) {
@@ -4120,7 +4275,7 @@ var GuardianDaemon = class extends EventEmitter3 {
4120
4275
  content += "\n---\n*Rigstate Daemon is watching. Fix violations to clear this report.*";
4121
4276
  }
4122
4277
  try {
4123
- await fs17.writeFile(reportPath, content, "utf-8");
4278
+ await fs18.writeFile(reportPath, content, "utf-8");
4124
4279
  } catch (e) {
4125
4280
  }
4126
4281
  }
@@ -4157,6 +4312,8 @@ var GuardianDaemon = class extends EventEmitter3 {
4157
4312
  console.log(chalk19.dim("\n\u{1F6D1} Stopping Guardian Daemon..."));
4158
4313
  if (this.fileWatcher) await this.fileWatcher.stop();
4159
4314
  if (this.bridgeListener) await this.bridgeListener.disconnect();
4315
+ if (this.harvester) await this.harvester.stop();
4316
+ if (this.syncInterval) clearInterval(this.syncInterval);
4160
4317
  this.state.isRunning = false;
4161
4318
  console.log(chalk19.green("\u2713 Daemon stopped."));
4162
4319
  this.emit("stopped", this.state);
@@ -4198,8 +4355,8 @@ async function createDaemon(options) {
4198
4355
  // src/utils/service-manager.ts
4199
4356
  init_esm_shims();
4200
4357
  import chalk20 from "chalk";
4201
- import fs18 from "fs/promises";
4202
- import path21 from "path";
4358
+ import fs19 from "fs/promises";
4359
+ import path22 from "path";
4203
4360
  import { execSync as execSync3 } from "child_process";
4204
4361
  import { fileURLToPath as fileURLToPath2 } from "url";
4205
4362
  async function execShellCommand(cmd) {
@@ -4222,11 +4379,11 @@ async function enableDaemon() {
4222
4379
  console.error(chalk20.red("\u274C Could not determine HOME directory."));
4223
4380
  return;
4224
4381
  }
4225
- const agentsDir = path21.join(homeDir, "Library/LaunchAgents");
4226
- const logDir = path21.join(homeDir, ".rigstate/logs");
4227
- const plistPath = path21.join(agentsDir, "com.rigstate.daemon.plist");
4228
- await fs18.mkdir(agentsDir, { recursive: true });
4229
- await fs18.mkdir(logDir, { recursive: true });
4382
+ const agentsDir = path22.join(homeDir, "Library/LaunchAgents");
4383
+ const logDir = path22.join(homeDir, ".rigstate/logs");
4384
+ const plistPath = path22.join(agentsDir, "com.rigstate.daemon.plist");
4385
+ await fs19.mkdir(agentsDir, { recursive: true });
4386
+ await fs19.mkdir(logDir, { recursive: true });
4230
4387
  const scriptPath = fileURLToPath2(import.meta.url);
4231
4388
  const nodePath = process.execPath;
4232
4389
  const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
@@ -4245,9 +4402,9 @@ async function enableDaemon() {
4245
4402
  <key>WorkingDirectory</key>
4246
4403
  <string>${process.cwd()}</string>
4247
4404
  <key>StandardOutPath</key>
4248
- <string>${path21.join(logDir, "daemon.out.log")}</string>
4405
+ <string>${path22.join(logDir, "daemon.out.log")}</string>
4249
4406
  <key>StandardErrorPath</key>
4250
- <string>${path21.join(logDir, "daemon.err.log")}</string>
4407
+ <string>${path22.join(logDir, "daemon.err.log")}</string>
4251
4408
  <key>RunAtLoad</key>
4252
4409
  <true/>
4253
4410
  <key>KeepAlive</key>
@@ -4260,7 +4417,7 @@ async function enableDaemon() {
4260
4417
  </dict>
4261
4418
  </plist>`;
4262
4419
  try {
4263
- await fs18.writeFile(plistPath, plistContent);
4420
+ await fs19.writeFile(plistPath, plistContent);
4264
4421
  console.log(chalk20.dim(`Created plist at: ${plistPath}`));
4265
4422
  try {
4266
4423
  await execShellCommand(`launchctl unload ${plistPath}`);
@@ -4277,10 +4434,10 @@ async function enableDaemon() {
4277
4434
  async function disableDaemon() {
4278
4435
  console.log(chalk20.bold("\n\u2699\uFE0F Disabling Rigstate Background Service\n"));
4279
4436
  const homeDir = process.env.HOME || "";
4280
- const plistPath = path21.join(homeDir, "Library/LaunchAgents/com.rigstate.daemon.plist");
4437
+ const plistPath = path22.join(homeDir, "Library/LaunchAgents/com.rigstate.daemon.plist");
4281
4438
  try {
4282
4439
  await execShellCommand(`launchctl unload ${plistPath}`);
4283
- await fs18.unlink(plistPath);
4440
+ await fs19.unlink(plistPath);
4284
4441
  console.log(chalk20.green("\u2705 Successfully disabled background daemon."));
4285
4442
  } catch (error) {
4286
4443
  if (error.code === "ENOENT") {
@@ -4311,9 +4468,9 @@ function createDaemonCommand() {
4311
4468
  }
4312
4469
  const spinner = ora8();
4313
4470
  try {
4314
- const pidPath = path22.join(process.cwd(), PID_FILE);
4471
+ const pidPath = path23.join(process.cwd(), PID_FILE);
4315
4472
  try {
4316
- const content = await fs19.readFile(pidPath, "utf-8");
4473
+ const content = await fs20.readFile(pidPath, "utf-8");
4317
4474
  const pid = parseInt(content.trim(), 10);
4318
4475
  try {
4319
4476
  process.kill(pid, 0);
@@ -4321,7 +4478,7 @@ function createDaemonCommand() {
4321
4478
  console.log(chalk21.dim(` Run "rigstate daemon status" for details or Ctrl+C to stop.
4322
4479
  `));
4323
4480
  } catch {
4324
- await fs19.unlink(pidPath).catch(() => {
4481
+ await fs20.unlink(pidPath).catch(() => {
4325
4482
  });
4326
4483
  }
4327
4484
  } catch {
@@ -4365,14 +4522,14 @@ function createDaemonCommand() {
4365
4522
  }
4366
4523
  async function isRunning() {
4367
4524
  try {
4368
- const pidPath = path22.join(process.cwd(), PID_FILE);
4369
- const content = await fs19.readFile(pidPath, "utf-8");
4525
+ const pidPath = path23.join(process.cwd(), PID_FILE);
4526
+ const content = await fs20.readFile(pidPath, "utf-8");
4370
4527
  const pid = parseInt(content.trim(), 10);
4371
4528
  try {
4372
4529
  process.kill(pid, 0);
4373
4530
  return true;
4374
4531
  } catch {
4375
- await fs19.unlink(pidPath);
4532
+ await fs20.unlink(pidPath);
4376
4533
  return false;
4377
4534
  }
4378
4535
  } catch {
@@ -4381,25 +4538,25 @@ async function isRunning() {
4381
4538
  }
4382
4539
  async function writePidFile() {
4383
4540
  try {
4384
- const dir = path22.join(process.cwd(), ".rigstate");
4385
- await fs19.mkdir(dir, { recursive: true });
4386
- await fs19.writeFile(path22.join(dir, "daemon.pid"), process.pid.toString());
4541
+ const dir = path23.join(process.cwd(), ".rigstate");
4542
+ await fs20.mkdir(dir, { recursive: true });
4543
+ await fs20.writeFile(path23.join(dir, "daemon.pid"), process.pid.toString());
4387
4544
  } catch {
4388
4545
  }
4389
4546
  }
4390
4547
  async function cleanupPidFile() {
4391
4548
  try {
4392
- await fs19.unlink(path22.join(process.cwd(), PID_FILE));
4393
- await fs19.unlink(path22.join(process.cwd(), STATE_FILE));
4549
+ await fs20.unlink(path23.join(process.cwd(), PID_FILE));
4550
+ await fs20.unlink(path23.join(process.cwd(), STATE_FILE));
4394
4551
  } catch {
4395
4552
  }
4396
4553
  }
4397
4554
  async function writeStateFile(state) {
4398
4555
  try {
4399
- const dir = path22.join(process.cwd(), ".rigstate");
4400
- await fs19.mkdir(dir, { recursive: true });
4401
- await fs19.writeFile(
4402
- path22.join(dir, "daemon.state.json"),
4556
+ const dir = path23.join(process.cwd(), ".rigstate");
4557
+ await fs20.mkdir(dir, { recursive: true });
4558
+ await fs20.writeFile(
4559
+ path23.join(dir, "daemon.state.json"),
4403
4560
  JSON.stringify(state, null, 2)
4404
4561
  );
4405
4562
  } catch {
@@ -4415,8 +4572,8 @@ async function showStatus() {
4415
4572
  }
4416
4573
  console.log(chalk21.green("Status: Running"));
4417
4574
  try {
4418
- const statePath = path22.join(process.cwd(), STATE_FILE);
4419
- const content = await fs19.readFile(statePath, "utf-8");
4575
+ const statePath = path23.join(process.cwd(), STATE_FILE);
4576
+ const content = await fs20.readFile(statePath, "utf-8");
4420
4577
  const state = JSON.parse(content);
4421
4578
  console.log(chalk21.dim("\u2500".repeat(40)));
4422
4579
  console.log(`Started at: ${state.startedAt || "Unknown"}`);
@@ -4429,8 +4586,8 @@ async function showStatus() {
4429
4586
  console.log(chalk21.dim("(State file not found)"));
4430
4587
  }
4431
4588
  try {
4432
- const pidPath = path22.join(process.cwd(), PID_FILE);
4433
- const pid = await fs19.readFile(pidPath, "utf-8");
4589
+ const pidPath = path23.join(process.cwd(), PID_FILE);
4590
+ const pid = await fs20.readFile(pidPath, "utf-8");
4434
4591
  console.log(chalk21.dim(`PID: ${pid.trim()}`));
4435
4592
  } catch {
4436
4593
  }
@@ -4444,7 +4601,7 @@ init_suggest();
4444
4601
  import { Command as Command13 } from "commander";
4445
4602
  import chalk23 from "chalk";
4446
4603
  import ora10 from "ora";
4447
- import axios16 from "axios";
4604
+ import axios17 from "axios";
4448
4605
  import inquirer3 from "inquirer";
4449
4606
 
4450
4607
  // src/commands/plan.ts
@@ -4453,9 +4610,9 @@ init_config();
4453
4610
  import { Command as Command12 } from "commander";
4454
4611
  import chalk22 from "chalk";
4455
4612
  import ora9 from "ora";
4456
- import axios15 from "axios";
4457
- import fs20 from "fs/promises";
4458
- import path23 from "path";
4613
+ import axios16 from "axios";
4614
+ import fs21 from "fs/promises";
4615
+ import path24 from "path";
4459
4616
  import inquirer2 from "inquirer";
4460
4617
  function createPlanCommand() {
4461
4618
  const plan = new Command12("plan");
@@ -4473,7 +4630,7 @@ async function executePlan(taskId) {
4473
4630
  let taskDescription = "";
4474
4631
  if (!taskId) {
4475
4632
  spinner.text = "Fetching actionable tasks...";
4476
- const response = await axios15.get(
4633
+ const response = await axios16.get(
4477
4634
  `${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
4478
4635
  { headers: { "Authorization": `Bearer ${apiKey}` } }
4479
4636
  );
@@ -4500,7 +4657,7 @@ async function executePlan(taskId) {
4500
4657
  taskId = `T-${answer.task.step_number}`;
4501
4658
  } else {
4502
4659
  spinner.text = `Fetching details for ${taskId}...`;
4503
- const response = await axios15.get(
4660
+ const response = await axios16.get(
4504
4661
  `${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
4505
4662
  { headers: { "Authorization": `Bearer ${apiKey}` } }
4506
4663
  );
@@ -4513,7 +4670,7 @@ async function executePlan(taskId) {
4513
4670
  taskDescription = task.description;
4514
4671
  }
4515
4672
  spinner.start("Generating Context for Frank...");
4516
- const contextPath = path23.join(process.cwd(), ".rigstate", "CURRENT_CONTEXT.md");
4673
+ const contextPath = path24.join(process.cwd(), ".rigstate", "CURRENT_CONTEXT.md");
4517
4674
  const contextContent = `
4518
4675
  # \u{1F3AF} Active Mission: ${taskTitle}
4519
4676
  **ID:** ${taskId}
@@ -4528,10 +4685,10 @@ ${taskDescription}
4528
4685
 
4529
4686
  *Generated by Rigstate CLI at ${(/* @__PURE__ */ new Date()).toLocaleString()}*
4530
4687
  `;
4531
- await fs20.mkdir(path23.dirname(contextPath), { recursive: true });
4532
- await fs20.writeFile(contextPath, contextContent.trim());
4533
- const planPath = path23.join(process.cwd(), "IMPLEMENTATION_PLAN.md");
4534
- const planExists = await fs20.stat(planPath).then(() => true).catch(() => false);
4688
+ await fs21.mkdir(path24.dirname(contextPath), { recursive: true });
4689
+ await fs21.writeFile(contextPath, contextContent.trim());
4690
+ const planPath = path24.join(process.cwd(), "IMPLEMENTATION_PLAN.md");
4691
+ const planExists = await fs21.stat(planPath).then(() => true).catch(() => false);
4535
4692
  if (!planExists) {
4536
4693
  const planTemplate = `
4537
4694
  # \u{1F4CB} Implementation Plan: ${taskTitle}
@@ -4550,7 +4707,7 @@ ${taskDescription}
4550
4707
  ## 4. \u{1F680} Execution
4551
4708
  [Frank: Log your progress here]
4552
4709
  `;
4553
- await fs20.writeFile(planPath, planTemplate.trim());
4710
+ await fs21.writeFile(planPath, planTemplate.trim());
4554
4711
  spinner.succeed(chalk22.green("Created new IMPLEMENTATION_PLAN.md"));
4555
4712
  } else {
4556
4713
  spinner.info(chalk22.yellow("IMPLEMENTATION_PLAN.md already exists. Preserving it."));
@@ -4597,7 +4754,7 @@ async function listInteractive() {
4597
4754
  const spinner = ora10("Fetching roadmap...").start();
4598
4755
  try {
4599
4756
  const { projectId, apiKey, apiUrl } = getContext2();
4600
- const response = await axios16.get(
4757
+ const response = await axios17.get(
4601
4758
  `${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
4602
4759
  { headers: { "Authorization": `Bearer ${apiKey}` } }
4603
4760
  );
@@ -4657,12 +4814,12 @@ async function setTaskStatus(taskId, status) {
4657
4814
  let realId = taskId;
4658
4815
  if (taskId.startsWith("T-") || taskId.length < 10) {
4659
4816
  spinner.text = "Resolving Task ID...";
4660
- const lookup = await axios16.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
4817
+ const lookup = await axios17.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
4661
4818
  const task = lookup.data.data.roadmap.find((t) => `T-${t.step_number}` === taskId || t.step_number.toString() === taskId);
4662
4819
  if (!task) throw new Error(`Task ${taskId} not found.`);
4663
4820
  realId = task.id;
4664
4821
  }
4665
- await axios16.post(
4822
+ await axios17.post(
4666
4823
  `${apiUrl}/api/v1/roadmap/update-status`,
4667
4824
  { step_id: realId, status, project_id: projectId },
4668
4825
  { headers: { "Authorization": `Bearer ${apiKey}` } }
@@ -4705,11 +4862,11 @@ init_config();
4705
4862
  import { Command as Command14 } from "commander";
4706
4863
  import chalk24 from "chalk";
4707
4864
  import ora11 from "ora";
4708
- import chokidar2 from "chokidar";
4709
- import fs21 from "fs/promises";
4710
- import path24 from "path";
4865
+ import chokidar3 from "chokidar";
4866
+ import fs22 from "fs/promises";
4867
+ import path25 from "path";
4711
4868
  import { execSync as execSync4 } from "child_process";
4712
- import axios17 from "axios";
4869
+ import axios18 from "axios";
4713
4870
  function createWatchCommand() {
4714
4871
  const watch2 = new Command14("watch");
4715
4872
  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) => {
@@ -4727,8 +4884,8 @@ function createWatchCommand() {
4727
4884
  projectId = getProjectId();
4728
4885
  if (!projectId) {
4729
4886
  try {
4730
- const manifestPath = path24.join(process.cwd(), ".rigstate");
4731
- const content = await fs21.readFile(manifestPath, "utf-8");
4887
+ const manifestPath = path25.join(process.cwd(), ".rigstate");
4888
+ const content = await fs22.readFile(manifestPath, "utf-8");
4732
4889
  const manifest = JSON.parse(content);
4733
4890
  projectId = manifest.project_id;
4734
4891
  } catch (e) {
@@ -4750,7 +4907,7 @@ function createWatchCommand() {
4750
4907
  console.log("");
4751
4908
  const fetchActiveTask = async () => {
4752
4909
  try {
4753
- const response = await axios17.get(`${apiUrl}/api/v1/roadmap`, {
4910
+ const response = await axios18.get(`${apiUrl}/api/v1/roadmap`, {
4754
4911
  params: { project_id: projectId },
4755
4912
  headers: { Authorization: `Bearer ${apiKey}` }
4756
4913
  });
@@ -4774,17 +4931,17 @@ function createWatchCommand() {
4774
4931
  };
4775
4932
  const checkCriteria = async (criteria) => {
4776
4933
  try {
4777
- const fullPath = path24.resolve(process.cwd(), criteria.path);
4934
+ const fullPath = path25.resolve(process.cwd(), criteria.path);
4778
4935
  switch (criteria.type) {
4779
4936
  case "file_exists":
4780
- await fs21.access(fullPath);
4937
+ await fs22.access(fullPath);
4781
4938
  return true;
4782
4939
  case "file_content":
4783
- const content = await fs21.readFile(fullPath, "utf-8");
4940
+ const content = await fs22.readFile(fullPath, "utf-8");
4784
4941
  return content.length > 0;
4785
4942
  case "content_match":
4786
4943
  if (!criteria.match) return false;
4787
- const fileContent = await fs21.readFile(fullPath, "utf-8");
4944
+ const fileContent = await fs22.readFile(fullPath, "utf-8");
4788
4945
  return fileContent.includes(criteria.match);
4789
4946
  default:
4790
4947
  return false;
@@ -4806,7 +4963,7 @@ function createWatchCommand() {
4806
4963
  return;
4807
4964
  }
4808
4965
  }
4809
- await axios17.post(`${apiUrl}/api/v1/roadmap/update-status`, {
4966
+ await axios18.post(`${apiUrl}/api/v1/roadmap/update-status`, {
4810
4967
  project_id: projectId,
4811
4968
  chunk_id: taskId,
4812
4969
  status: "COMPLETED"
@@ -4881,7 +5038,7 @@ function createWatchCommand() {
4881
5038
  isProcessing = false;
4882
5039
  };
4883
5040
  await processActiveTask();
4884
- const watcher = chokidar2.watch(".", {
5041
+ const watcher = chokidar3.watch(".", {
4885
5042
  ignored: [
4886
5043
  /(^|[\/\\])\../,
4887
5044
  // dotfiles
@@ -4916,10 +5073,10 @@ init_config();
4916
5073
  import { Command as Command15 } from "commander";
4917
5074
  import chalk25 from "chalk";
4918
5075
  import ora12 from "ora";
4919
- import axios18 from "axios";
5076
+ import axios19 from "axios";
4920
5077
  import { execSync as execSync5 } from "child_process";
4921
- import fs22 from "fs/promises";
4922
- import path25 from "path";
5078
+ import fs23 from "fs/promises";
5079
+ import path26 from "path";
4923
5080
  function createFocusCommand() {
4924
5081
  const focus = new Command15("focus");
4925
5082
  focus.alias("task").description("Get the next active roadmap task and copy its prompt to clipboard").option("--no-copy", "Do not copy to clipboard").action(async (options) => {
@@ -4935,8 +5092,8 @@ function createFocusCommand() {
4935
5092
  projectId = getProjectId();
4936
5093
  if (!projectId) {
4937
5094
  try {
4938
- const manifestPath = path25.join(process.cwd(), ".rigstate");
4939
- const content = await fs22.readFile(manifestPath, "utf-8");
5095
+ const manifestPath = path26.join(process.cwd(), ".rigstate");
5096
+ const content = await fs23.readFile(manifestPath, "utf-8");
4940
5097
  const manifest = JSON.parse(content);
4941
5098
  projectId = manifest.project_id;
4942
5099
  } catch (e) {
@@ -4948,7 +5105,7 @@ function createFocusCommand() {
4948
5105
  }
4949
5106
  const apiUrl = getApiUrl();
4950
5107
  try {
4951
- const response = await axios18.get(`${apiUrl}/api/v1/roadmap`, {
5108
+ const response = await axios19.get(`${apiUrl}/api/v1/roadmap`, {
4952
5109
  params: { project_id: projectId },
4953
5110
  headers: { Authorization: `Bearer ${apiKey}` }
4954
5111
  });
@@ -5091,25 +5248,25 @@ init_config();
5091
5248
  import { Command as Command17 } from "commander";
5092
5249
  import chalk27 from "chalk";
5093
5250
  import { spawn } from "child_process";
5094
- import path26 from "path";
5095
- import fs23 from "fs";
5251
+ import path27 from "path";
5252
+ import fs24 from "fs";
5096
5253
  import { fileURLToPath as fileURLToPath3 } from "url";
5097
5254
  var __filename2 = fileURLToPath3(import.meta.url);
5098
- var __dirname2 = path26.dirname(__filename2);
5255
+ var __dirname2 = path27.dirname(__filename2);
5099
5256
  function createMcpCommand() {
5100
5257
  const mcp = new Command17("mcp");
5101
5258
  mcp.description("Run the Rigstate MCP server for AI editors").action(async () => {
5102
5259
  const possiblePaths = [
5103
5260
  // From packages/cli -> packages/mcp (sibling package)
5104
- path26.resolve(__dirname2, "../../mcp/dist/index.js"),
5261
+ path27.resolve(__dirname2, "../../mcp/dist/index.js"),
5105
5262
  // If installed globally or via npm
5106
- path26.resolve(__dirname2, "../../../mcp/dist/index.js"),
5263
+ path27.resolve(__dirname2, "../../../mcp/dist/index.js"),
5107
5264
  // Development path from packages/cli/dist
5108
- path26.resolve(__dirname2, "../../../packages/mcp/dist/index.js")
5265
+ path27.resolve(__dirname2, "../../../packages/mcp/dist/index.js")
5109
5266
  ];
5110
5267
  let serverPath = "";
5111
5268
  for (const p of possiblePaths) {
5112
- if (fs23.existsSync(p)) {
5269
+ if (fs24.existsSync(p)) {
5113
5270
  serverPath = p;
5114
5271
  break;
5115
5272
  }
@@ -5161,12 +5318,12 @@ import chalk29 from "chalk";
5161
5318
 
5162
5319
  // src/nexus/dispatcher.ts
5163
5320
  init_esm_shims();
5164
- import EventEmitter4 from "events";
5321
+ import EventEmitter5 from "events";
5165
5322
  import { v4 as uuidv4 } from "uuid";
5166
5323
 
5167
5324
  // src/hive/gateway.ts
5168
5325
  init_esm_shims();
5169
- import axios19 from "axios";
5326
+ import axios20 from "axios";
5170
5327
 
5171
5328
  // src/hive/scrubber.ts
5172
5329
  init_esm_shims();
@@ -5237,7 +5394,7 @@ var HiveGateway = class {
5237
5394
  if (!this.enabled) {
5238
5395
  console.log(chalk28.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
5239
5396
  }
5240
- this.client = axios19.create({
5397
+ this.client = axios20.create({
5241
5398
  baseURL: baseUrl,
5242
5399
  headers: {
5243
5400
  "Authorization": `Bearer ${token}`,
@@ -5278,7 +5435,7 @@ var HiveGateway = class {
5278
5435
  };
5279
5436
 
5280
5437
  // src/nexus/dispatcher.ts
5281
- var NexusDispatcher = class extends EventEmitter4 {
5438
+ var NexusDispatcher = class extends EventEmitter5 {
5282
5439
  context;
5283
5440
  orderQueue = [];
5284
5441
  orderHistory = [];
@@ -5431,7 +5588,7 @@ init_governance();
5431
5588
  init_config();
5432
5589
  import { Command as Command19 } from "commander";
5433
5590
  import chalk30 from "chalk";
5434
- import axios20 from "axios";
5591
+ import axios21 from "axios";
5435
5592
  function createOverrideCommand() {
5436
5593
  const override = new Command19("override");
5437
5594
  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) => {
@@ -5454,7 +5611,7 @@ function createOverrideCommand() {
5454
5611
  if (projectId) {
5455
5612
  const apiUrl = getApiUrl();
5456
5613
  const apiKey = getApiKey();
5457
- await axios20.post(`${apiUrl}/api/v1/execution-logs`, {
5614
+ await axios21.post(`${apiUrl}/api/v1/execution-logs`, {
5458
5615
  project_id: projectId,
5459
5616
  task_id: "OVERRIDE-" + Date.now(),
5460
5617
  task_title: `Governance Override: ${violationId}`,
@@ -5483,7 +5640,7 @@ init_config();
5483
5640
  import { Command as Command20 } from "commander";
5484
5641
  import chalk31 from "chalk";
5485
5642
  import ora13 from "ora";
5486
- import axios21 from "axios";
5643
+ import axios22 from "axios";
5487
5644
  import inquirer5 from "inquirer";
5488
5645
  function createIdeaCommand() {
5489
5646
  return new Command20("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) => {
@@ -5517,7 +5674,7 @@ function createIdeaCommand() {
5517
5674
  if (tags.length === 0) {
5518
5675
  }
5519
5676
  const spinner = ora13("Securing idea in the Lab...").start();
5520
- const response = await axios21.post(
5677
+ const response = await axios22.post(
5521
5678
  `${apiUrl}/api/v1/ideas`,
5522
5679
  {
5523
5680
  project_id: projectId,
@@ -5548,8 +5705,8 @@ import { Command as Command21 } from "commander";
5548
5705
  import chalk32 from "chalk";
5549
5706
  import ora14 from "ora";
5550
5707
  import inquirer6 from "inquirer";
5551
- import fs24 from "fs/promises";
5552
- import path27 from "path";
5708
+ import fs25 from "fs/promises";
5709
+ import path28 from "path";
5553
5710
 
5554
5711
  // ../../node_modules/simple-git/dist/esm/index.js
5555
5712
  init_esm_shims();
@@ -5560,7 +5717,7 @@ var import_promise_deferred2 = __toESM(require_dist2(), 1);
5560
5717
  import { Buffer as Buffer2 } from "buffer";
5561
5718
  import { spawn as spawn2 } from "child_process";
5562
5719
  import { normalize } from "path";
5563
- import { EventEmitter as EventEmitter5 } from "events";
5720
+ import { EventEmitter as EventEmitter6 } from "events";
5564
5721
  var __defProp2 = Object.defineProperty;
5565
5722
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
5566
5723
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -5589,8 +5746,8 @@ function pathspec(...paths) {
5589
5746
  cache.set(key, paths);
5590
5747
  return key;
5591
5748
  }
5592
- function isPathSpec(path28) {
5593
- return path28 instanceof String && cache.has(path28);
5749
+ function isPathSpec(path29) {
5750
+ return path29 instanceof String && cache.has(path29);
5594
5751
  }
5595
5752
  function toPaths(pathSpec) {
5596
5753
  return cache.get(pathSpec) || [];
@@ -5679,8 +5836,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
5679
5836
  function forEachLineWithContent(input, callback) {
5680
5837
  return toLinesWithContent(input, true).map((line) => callback(line));
5681
5838
  }
5682
- function folderExists(path28) {
5683
- return (0, import_file_exists.exists)(path28, import_file_exists.FOLDER);
5839
+ function folderExists(path29) {
5840
+ return (0, import_file_exists.exists)(path29, import_file_exists.FOLDER);
5684
5841
  }
5685
5842
  function append(target, item) {
5686
5843
  if (Array.isArray(target)) {
@@ -6084,8 +6241,8 @@ function checkIsRepoRootTask() {
6084
6241
  commands,
6085
6242
  format: "utf-8",
6086
6243
  onError,
6087
- parser(path28) {
6088
- return /^\.(git)?$/.test(path28.trim());
6244
+ parser(path29) {
6245
+ return /^\.(git)?$/.test(path29.trim());
6089
6246
  }
6090
6247
  };
6091
6248
  }
@@ -6519,11 +6676,11 @@ function parseGrep(grep) {
6519
6676
  const paths = /* @__PURE__ */ new Set();
6520
6677
  const results = {};
6521
6678
  forEachLineWithContent(grep, (input) => {
6522
- const [path28, line, preview] = input.split(NULL);
6523
- paths.add(path28);
6524
- (results[path28] = results[path28] || []).push({
6679
+ const [path29, line, preview] = input.split(NULL);
6680
+ paths.add(path29);
6681
+ (results[path29] = results[path29] || []).push({
6525
6682
  line: asNumber(line),
6526
- path: path28,
6683
+ path: path29,
6527
6684
  preview
6528
6685
  });
6529
6686
  });
@@ -7288,14 +7445,14 @@ var init_hash_object = __esm2({
7288
7445
  init_task();
7289
7446
  }
7290
7447
  });
7291
- function parseInit(bare, path28, text) {
7448
+ function parseInit(bare, path29, text) {
7292
7449
  const response = String(text).trim();
7293
7450
  let result;
7294
7451
  if (result = initResponseRegex.exec(response)) {
7295
- return new InitSummary(bare, path28, false, result[1]);
7452
+ return new InitSummary(bare, path29, false, result[1]);
7296
7453
  }
7297
7454
  if (result = reInitResponseRegex.exec(response)) {
7298
- return new InitSummary(bare, path28, true, result[1]);
7455
+ return new InitSummary(bare, path29, true, result[1]);
7299
7456
  }
7300
7457
  let gitDir = "";
7301
7458
  const tokens = response.split(" ");
@@ -7306,7 +7463,7 @@ function parseInit(bare, path28, text) {
7306
7463
  break;
7307
7464
  }
7308
7465
  }
7309
- return new InitSummary(bare, path28, /^re/i.test(response), gitDir);
7466
+ return new InitSummary(bare, path29, /^re/i.test(response), gitDir);
7310
7467
  }
7311
7468
  var InitSummary;
7312
7469
  var initResponseRegex;
@@ -7315,9 +7472,9 @@ var init_InitSummary = __esm2({
7315
7472
  "src/lib/responses/InitSummary.ts"() {
7316
7473
  "use strict";
7317
7474
  InitSummary = class {
7318
- constructor(bare, path28, existing, gitDir) {
7475
+ constructor(bare, path29, existing, gitDir) {
7319
7476
  this.bare = bare;
7320
- this.path = path28;
7477
+ this.path = path29;
7321
7478
  this.existing = existing;
7322
7479
  this.gitDir = gitDir;
7323
7480
  }
@@ -7329,7 +7486,7 @@ var init_InitSummary = __esm2({
7329
7486
  function hasBareCommand(command) {
7330
7487
  return command.includes(bareCommand);
7331
7488
  }
7332
- function initTask(bare = false, path28, customArgs) {
7489
+ function initTask(bare = false, path29, customArgs) {
7333
7490
  const commands = ["init", ...customArgs];
7334
7491
  if (bare && !hasBareCommand(commands)) {
7335
7492
  commands.splice(1, 0, bareCommand);
@@ -7338,7 +7495,7 @@ function initTask(bare = false, path28, customArgs) {
7338
7495
  commands,
7339
7496
  format: "utf-8",
7340
7497
  parser(text) {
7341
- return parseInit(commands.includes("--bare"), path28, text);
7498
+ return parseInit(commands.includes("--bare"), path29, text);
7342
7499
  }
7343
7500
  };
7344
7501
  }
@@ -8154,12 +8311,12 @@ var init_FileStatusSummary = __esm2({
8154
8311
  "use strict";
8155
8312
  fromPathRegex = /^(.+)\0(.+)$/;
8156
8313
  FileStatusSummary = class {
8157
- constructor(path28, index, working_dir) {
8158
- this.path = path28;
8314
+ constructor(path29, index, working_dir) {
8315
+ this.path = path29;
8159
8316
  this.index = index;
8160
8317
  this.working_dir = working_dir;
8161
8318
  if (index === "R" || working_dir === "R") {
8162
- const detail = fromPathRegex.exec(path28) || [null, path28, path28];
8319
+ const detail = fromPathRegex.exec(path29) || [null, path29, path29];
8163
8320
  this.from = detail[2] || "";
8164
8321
  this.path = detail[1] || "";
8165
8322
  }
@@ -8190,14 +8347,14 @@ function splitLine(result, lineStr) {
8190
8347
  default:
8191
8348
  return;
8192
8349
  }
8193
- function data(index, workingDir, path28) {
8350
+ function data(index, workingDir, path29) {
8194
8351
  const raw = `${index}${workingDir}`;
8195
8352
  const handler = parsers6.get(raw);
8196
8353
  if (handler) {
8197
- handler(result, path28);
8354
+ handler(result, path29);
8198
8355
  }
8199
8356
  if (raw !== "##" && raw !== "!!") {
8200
- result.files.push(new FileStatusSummary(path28, index, workingDir));
8357
+ result.files.push(new FileStatusSummary(path29, index, workingDir));
8201
8358
  }
8202
8359
  }
8203
8360
  }
@@ -8510,9 +8667,9 @@ var init_simple_git_api = __esm2({
8510
8667
  next
8511
8668
  );
8512
8669
  }
8513
- hashObject(path28, write) {
8670
+ hashObject(path29, write) {
8514
8671
  return this._runTask(
8515
- hashObjectTask(path28, write === true),
8672
+ hashObjectTask(path29, write === true),
8516
8673
  trailingFunctionArgument(arguments)
8517
8674
  );
8518
8675
  }
@@ -8865,8 +9022,8 @@ var init_branch = __esm2({
8865
9022
  }
8866
9023
  });
8867
9024
  function toPath(input) {
8868
- const path28 = input.trim().replace(/^["']|["']$/g, "");
8869
- return path28 && normalize(path28);
9025
+ const path29 = input.trim().replace(/^["']|["']$/g, "");
9026
+ return path29 && normalize(path29);
8870
9027
  }
8871
9028
  var parseCheckIgnore;
8872
9029
  var init_CheckIgnore = __esm2({
@@ -9180,8 +9337,8 @@ __export2(sub_module_exports, {
9180
9337
  subModuleTask: () => subModuleTask,
9181
9338
  updateSubModuleTask: () => updateSubModuleTask
9182
9339
  });
9183
- function addSubModuleTask(repo, path28) {
9184
- return subModuleTask(["add", repo, path28]);
9340
+ function addSubModuleTask(repo, path29) {
9341
+ return subModuleTask(["add", repo, path29]);
9185
9342
  }
9186
9343
  function initSubModuleTask(customArgs) {
9187
9344
  return subModuleTask(["init", ...customArgs]);
@@ -9511,8 +9668,8 @@ var require_git = __commonJS2({
9511
9668
  }
9512
9669
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
9513
9670
  };
9514
- Git2.prototype.submoduleAdd = function(repo, path28, then) {
9515
- return this._runTask(addSubModuleTask2(repo, path28), trailingFunctionArgument2(arguments));
9671
+ Git2.prototype.submoduleAdd = function(repo, path29, then) {
9672
+ return this._runTask(addSubModuleTask2(repo, path29), trailingFunctionArgument2(arguments));
9516
9673
  };
9517
9674
  Git2.prototype.submoduleUpdate = function(args, then) {
9518
9675
  return this._runTask(
@@ -9926,7 +10083,7 @@ init_utils();
9926
10083
  var PluginStore = class {
9927
10084
  constructor() {
9928
10085
  this.plugins = /* @__PURE__ */ new Set();
9929
- this.events = new EventEmitter5();
10086
+ this.events = new EventEmitter6();
9930
10087
  }
9931
10088
  on(type, listener) {
9932
10089
  this.events.on(type, listener);
@@ -10112,8 +10269,8 @@ function createReleaseCommand() {
10112
10269
  return;
10113
10270
  }
10114
10271
  spinner.text = "Scanning completed tasks...";
10115
- const pkgPath = path27.resolve(process.cwd(), "package.json");
10116
- const pkgContent = await fs24.readFile(pkgPath, "utf-8");
10272
+ const pkgPath = path28.resolve(process.cwd(), "package.json");
10273
+ const pkgContent = await fs25.readFile(pkgPath, "utf-8");
10117
10274
  const pkg2 = JSON.parse(pkgContent);
10118
10275
  const currentVersion = pkg2.version;
10119
10276
  const [major, minor, patch] = currentVersion.split(".").map(Number);
@@ -10133,17 +10290,17 @@ function createReleaseCommand() {
10133
10290
  return;
10134
10291
  }
10135
10292
  pkg2.version = newVersion;
10136
- await fs24.writeFile(pkgPath, JSON.stringify(pkg2, null, 4));
10137
- const changelogPath = path27.resolve(process.cwd(), "CHANGELOG.md");
10293
+ await fs25.writeFile(pkgPath, JSON.stringify(pkg2, null, 4));
10294
+ const changelogPath = path28.resolve(process.cwd(), "CHANGELOG.md");
10138
10295
  const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
10139
10296
  const entry = `
10140
10297
  ## [${newVersion}] - ${date}
10141
10298
  - Automated release via Rigstate.
10142
10299
  `;
10143
10300
  try {
10144
- await fs24.appendFile(changelogPath, entry);
10301
+ await fs25.appendFile(changelogPath, entry);
10145
10302
  } catch {
10146
- await fs24.writeFile(changelogPath, "# Changelog\n" + entry);
10303
+ await fs25.writeFile(changelogPath, "# Changelog\n" + entry);
10147
10304
  }
10148
10305
  spinner.start("Tagging and pushing...");
10149
10306
  await git.add(["package.json", "CHANGELOG.md"]);
@@ -10171,7 +10328,7 @@ init_config();
10171
10328
  import { Command as Command22 } from "commander";
10172
10329
  import chalk33 from "chalk";
10173
10330
  import ora15 from "ora";
10174
- import axios22 from "axios";
10331
+ import axios23 from "axios";
10175
10332
  function createRoadmapCommand() {
10176
10333
  return new Command22("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
10177
10334
  const spinner = ora15("Fetching tactical overview...").start();
@@ -10183,7 +10340,7 @@ function createRoadmapCommand() {
10183
10340
  spinner.fail(chalk33.red('Project context missing. Run "rigstate link".'));
10184
10341
  return;
10185
10342
  }
10186
- const response = await axios22.get(
10343
+ const response = await axios23.get(
10187
10344
  `${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
10188
10345
  { headers: { Authorization: `Bearer ${apiKey}` } }
10189
10346
  );
@@ -10318,7 +10475,6 @@ program.addCommand(createOverrideCommand());
10318
10475
  program.addCommand(createIdeaCommand());
10319
10476
  program.addCommand(createReleaseCommand());
10320
10477
  program.addCommand(createRoadmapCommand());
10321
- program.addCommand(createRoadmapCommand());
10322
10478
  program.addCommand(createCouncilCommand());
10323
10479
  program.addCommand(createPlanCommand());
10324
10480
  program.hook("preAction", async () => {