@rigstate/cli 0.7.30 → 0.7.32
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 +362 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +366 -168
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/sync-rules.ts +54 -0
- package/src/daemon/core.ts +38 -1
- package/src/daemon/harvester.ts +199 -0
package/dist/index.cjs
CHANGED
|
@@ -279,14 +279,52 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
|
|
|
279
279
|
}
|
|
280
280
|
const files = syncResponse.data.data.files;
|
|
281
281
|
if (files && Array.isArray(files)) {
|
|
282
|
-
const
|
|
283
|
-
const
|
|
282
|
+
const fs26 = await import("fs/promises");
|
|
283
|
+
const path28 = await import("path");
|
|
284
284
|
for (const file of files) {
|
|
285
|
-
const filePath =
|
|
286
|
-
await
|
|
287
|
-
await
|
|
285
|
+
const filePath = path28.join(process.cwd(), file.path);
|
|
286
|
+
await fs26.mkdir(path28.dirname(filePath), { recursive: true });
|
|
287
|
+
await fs26.writeFile(filePath, file.content, "utf-8");
|
|
288
288
|
}
|
|
289
289
|
console.log(import_chalk3.default.dim(` \u{1F4BE} Wrote ${files.length} rule files to local .cursor/rules/`));
|
|
290
|
+
try {
|
|
291
|
+
const masterPath = path28.join(process.cwd(), ".cursorrules");
|
|
292
|
+
let masterContent = "";
|
|
293
|
+
try {
|
|
294
|
+
masterContent = await fs26.readFile(masterPath, "utf-8");
|
|
295
|
+
} catch {
|
|
296
|
+
masterContent = "";
|
|
297
|
+
}
|
|
298
|
+
const START_MARKER = "<!-- RIGSTATE_GOVERNANCE_START -->";
|
|
299
|
+
const END_MARKER = "<!-- RIGSTATE_GOVERNANCE_END -->";
|
|
300
|
+
const ruleList = files.map((f) => f.path).filter((p) => p.endsWith(".mdc")).map((p) => `- ${p}`).join("\n");
|
|
301
|
+
const governanceBlock = `${START_MARKER}
|
|
302
|
+
# \u{1F6E1}\uFE0F Rigstate Governance (Do not edit this block manually)
|
|
303
|
+
# The following rules are enforced by the Rigstate Daemon (v${require2("../../package.json").version}).
|
|
304
|
+
# Failure to adhere to these rules will be flagged during the 'work' cycle.
|
|
305
|
+
|
|
306
|
+
# YOU MUST ADHERE TO THESE PROACTIVE RULES:
|
|
307
|
+
${ruleList}
|
|
308
|
+
|
|
309
|
+
# INSTRUCTIONS FOR AI AGENT:
|
|
310
|
+
# 1. You MUST read the relevant .mdc files in .cursor/rules/ before generating code.
|
|
311
|
+
# 2. If a rule in .cursor/rules/ conflicts with your training, OBEY THE RULE.
|
|
312
|
+
# 3. Consult .rigstate/ACTIVE_VIOLATIONS.md for current architectural health.
|
|
313
|
+
${END_MARKER}`;
|
|
314
|
+
let newContent = masterContent;
|
|
315
|
+
if (masterContent.includes(START_MARKER)) {
|
|
316
|
+
const regex = new RegExp(`${START_MARKER}[\\s\\S]*?${END_MARKER}`, "g");
|
|
317
|
+
newContent = masterContent.replace(regex, governanceBlock);
|
|
318
|
+
} else {
|
|
319
|
+
newContent = masterContent ? `${masterContent}
|
|
320
|
+
|
|
321
|
+
${governanceBlock}` : governanceBlock;
|
|
322
|
+
}
|
|
323
|
+
await fs26.writeFile(masterPath, newContent, "utf-8");
|
|
324
|
+
console.log(import_chalk3.default.dim(" \u{1F4DC} Updated master .cursorrules (Constitution enforced)"));
|
|
325
|
+
} catch (e) {
|
|
326
|
+
console.warn(import_chalk3.default.yellow(` \u26A0\uFE0F Could not update .cursorrules: ${e.message}`));
|
|
327
|
+
}
|
|
290
328
|
}
|
|
291
329
|
console.log("");
|
|
292
330
|
console.log(import_chalk3.default.cyan("\u{1F6E1}\uFE0F Frank Protocol v1.0 has been injected into the rules engine."));
|
|
@@ -320,7 +358,7 @@ function createSyncRulesCommand() {
|
|
|
320
358
|
});
|
|
321
359
|
return syncRules;
|
|
322
360
|
}
|
|
323
|
-
var import_commander3, import_chalk3, import_ora2, import_axios2;
|
|
361
|
+
var import_commander3, import_chalk3, import_ora2, import_axios2, import_module, require2;
|
|
324
362
|
var init_sync_rules = __esm({
|
|
325
363
|
"src/commands/sync-rules.ts"() {
|
|
326
364
|
"use strict";
|
|
@@ -330,6 +368,8 @@ var init_sync_rules = __esm({
|
|
|
330
368
|
import_ora2 = __toESM(require("ora"), 1);
|
|
331
369
|
init_config();
|
|
332
370
|
import_axios2 = __toESM(require("axios"), 1);
|
|
371
|
+
import_module = require("module");
|
|
372
|
+
require2 = (0, import_module.createRequire)(importMetaUrl);
|
|
333
373
|
}
|
|
334
374
|
});
|
|
335
375
|
|
|
@@ -1533,10 +1573,10 @@ var require_src2 = __commonJS({
|
|
|
1533
1573
|
var fs_1 = require("fs");
|
|
1534
1574
|
var debug_1 = __importDefault(require_src());
|
|
1535
1575
|
var log = debug_1.default("@kwsites/file-exists");
|
|
1536
|
-
function check(
|
|
1537
|
-
log(`checking %s`,
|
|
1576
|
+
function check(path28, isFile, isDirectory) {
|
|
1577
|
+
log(`checking %s`, path28);
|
|
1538
1578
|
try {
|
|
1539
|
-
const stat = fs_1.statSync(
|
|
1579
|
+
const stat = fs_1.statSync(path28);
|
|
1540
1580
|
if (stat.isFile() && isFile) {
|
|
1541
1581
|
log(`[OK] path represents a file`);
|
|
1542
1582
|
return true;
|
|
@@ -1556,8 +1596,8 @@ var require_src2 = __commonJS({
|
|
|
1556
1596
|
throw e;
|
|
1557
1597
|
}
|
|
1558
1598
|
}
|
|
1559
|
-
function exists2(
|
|
1560
|
-
return check(
|
|
1599
|
+
function exists2(path28, type = exports2.READABLE) {
|
|
1600
|
+
return check(path28, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
|
|
1561
1601
|
}
|
|
1562
1602
|
exports2.exists = exists2;
|
|
1563
1603
|
exports2.FILE = 1;
|
|
@@ -1627,7 +1667,7 @@ var require_package = __commonJS({
|
|
|
1627
1667
|
"package.json"(exports2, module2) {
|
|
1628
1668
|
module2.exports = {
|
|
1629
1669
|
name: "@rigstate/cli",
|
|
1630
|
-
version: "0.7.
|
|
1670
|
+
version: "0.7.32",
|
|
1631
1671
|
description: "Rigstate CLI - Code audit, sync and supervision tool",
|
|
1632
1672
|
type: "module",
|
|
1633
1673
|
main: "./dist/index.js",
|
|
@@ -1773,8 +1813,8 @@ function createLinkCommand() {
|
|
|
1773
1813
|
process.exit(1);
|
|
1774
1814
|
}
|
|
1775
1815
|
console.log(import_chalk5.default.dim("Fetching your projects..."));
|
|
1776
|
-
const
|
|
1777
|
-
const response = await
|
|
1816
|
+
const axios24 = (await import("axios")).default;
|
|
1817
|
+
const response = await axios24.get(`${apiUrl}/api/v1/projects`, {
|
|
1778
1818
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
1779
1819
|
});
|
|
1780
1820
|
if (!response.data.success || !response.data.data.projects?.length) {
|
|
@@ -1846,9 +1886,9 @@ function createLinkCommand() {
|
|
|
1846
1886
|
});
|
|
1847
1887
|
}
|
|
1848
1888
|
async function hardenGitIgnore(cwd) {
|
|
1849
|
-
const
|
|
1850
|
-
const
|
|
1851
|
-
const ignorePath =
|
|
1889
|
+
const fs26 = await import("fs/promises");
|
|
1890
|
+
const path28 = await import("path");
|
|
1891
|
+
const ignorePath = path28.join(cwd, ".gitignore");
|
|
1852
1892
|
const REQUIRED_IGNORES = [
|
|
1853
1893
|
"# Rigstate - Runtime Artifacts (Do not commit)",
|
|
1854
1894
|
".rigstate/ACTIVE_VIOLATIONS.md",
|
|
@@ -1863,7 +1903,7 @@ async function hardenGitIgnore(cwd) {
|
|
|
1863
1903
|
try {
|
|
1864
1904
|
let content = "";
|
|
1865
1905
|
try {
|
|
1866
|
-
content = await
|
|
1906
|
+
content = await fs26.readFile(ignorePath, "utf-8");
|
|
1867
1907
|
} catch {
|
|
1868
1908
|
content = "";
|
|
1869
1909
|
}
|
|
@@ -1871,7 +1911,7 @@ async function hardenGitIgnore(cwd) {
|
|
|
1871
1911
|
if (missing.length > 0) {
|
|
1872
1912
|
console.log(import_chalk5.default.dim(" Configuring .gitignore for Rigstate safety..."));
|
|
1873
1913
|
const toAppend = "\n\n" + REQUIRED_IGNORES.join("\n") + "\n";
|
|
1874
|
-
await
|
|
1914
|
+
await fs26.writeFile(ignorePath, content + toAppend, "utf-8");
|
|
1875
1915
|
console.log(import_chalk5.default.green(" \u2714 .gitignore updated (Artifacts protected)"));
|
|
1876
1916
|
} else {
|
|
1877
1917
|
console.log(import_chalk5.default.green(" \u2714 .gitignore already hardened"));
|
|
@@ -1881,21 +1921,21 @@ async function hardenGitIgnore(cwd) {
|
|
|
1881
1921
|
}
|
|
1882
1922
|
}
|
|
1883
1923
|
async function installHooks(cwd) {
|
|
1884
|
-
const
|
|
1885
|
-
const
|
|
1924
|
+
const fs26 = await import("fs/promises");
|
|
1925
|
+
const path28 = await import("path");
|
|
1886
1926
|
try {
|
|
1887
|
-
await
|
|
1927
|
+
await fs26.access(path28.join(cwd, ".git"));
|
|
1888
1928
|
} catch {
|
|
1889
1929
|
console.log(import_chalk5.default.dim(" (Not a git repository, skipping hooks)"));
|
|
1890
1930
|
return;
|
|
1891
1931
|
}
|
|
1892
|
-
const hooksDir =
|
|
1932
|
+
const hooksDir = path28.join(cwd, ".husky");
|
|
1893
1933
|
try {
|
|
1894
|
-
const preCommitPath =
|
|
1934
|
+
const preCommitPath = path28.join(cwd, ".git/hooks/pre-commit");
|
|
1895
1935
|
let shouldInstall = false;
|
|
1896
1936
|
try {
|
|
1897
|
-
await
|
|
1898
|
-
const content = await
|
|
1937
|
+
await fs26.access(preCommitPath);
|
|
1938
|
+
const content = await fs26.readFile(preCommitPath, "utf-8");
|
|
1899
1939
|
if (content.includes("rigstate")) {
|
|
1900
1940
|
console.log(import_chalk5.default.green(" \u2714 Git hooks already active"));
|
|
1901
1941
|
} else {
|
|
@@ -1919,12 +1959,12 @@ echo "\u{1F6E1}\uFE0F Running Guardian checks..."
|
|
|
1919
1959
|
rigstate check --staged --strict=critical
|
|
1920
1960
|
exit $?
|
|
1921
1961
|
`;
|
|
1922
|
-
await
|
|
1962
|
+
await fs26.mkdir(path28.dirname(preCommitPath), { recursive: true });
|
|
1923
1963
|
if (await fileExists(preCommitPath)) {
|
|
1924
|
-
const existing = await
|
|
1925
|
-
await
|
|
1964
|
+
const existing = await fs26.readFile(preCommitPath, "utf-8");
|
|
1965
|
+
await fs26.writeFile(preCommitPath, existing + "\n\n" + PRE_COMMIT_SCRIPT2.replace("#!/bin/sh\n", ""), { mode: 493 });
|
|
1926
1966
|
} else {
|
|
1927
|
-
await
|
|
1967
|
+
await fs26.writeFile(preCommitPath, PRE_COMMIT_SCRIPT2, { mode: 493 });
|
|
1928
1968
|
}
|
|
1929
1969
|
console.log(import_chalk5.default.green(" \u2714 Applied Guardian protection (git-hooks)"));
|
|
1930
1970
|
}
|
|
@@ -1932,10 +1972,10 @@ exit $?
|
|
|
1932
1972
|
console.log(import_chalk5.default.dim(" (Skipped hooks: " + e.message + ")"));
|
|
1933
1973
|
}
|
|
1934
1974
|
}
|
|
1935
|
-
async function fileExists(
|
|
1936
|
-
const
|
|
1975
|
+
async function fileExists(path28) {
|
|
1976
|
+
const fs26 = await import("fs/promises");
|
|
1937
1977
|
try {
|
|
1938
|
-
await
|
|
1978
|
+
await fs26.access(path28);
|
|
1939
1979
|
return true;
|
|
1940
1980
|
} catch {
|
|
1941
1981
|
return false;
|
|
@@ -3341,8 +3381,8 @@ init_cjs_shims();
|
|
|
3341
3381
|
var import_commander11 = require("commander");
|
|
3342
3382
|
var import_chalk21 = __toESM(require("chalk"), 1);
|
|
3343
3383
|
var import_ora8 = __toESM(require("ora"), 1);
|
|
3344
|
-
var
|
|
3345
|
-
var
|
|
3384
|
+
var import_promises19 = __toESM(require("fs/promises"), 1);
|
|
3385
|
+
var import_path22 = __toESM(require("path"), 1);
|
|
3346
3386
|
|
|
3347
3387
|
// src/daemon/factory.ts
|
|
3348
3388
|
init_cjs_shims();
|
|
@@ -3350,9 +3390,9 @@ init_cjs_shims();
|
|
|
3350
3390
|
// src/daemon/core.ts
|
|
3351
3391
|
init_cjs_shims();
|
|
3352
3392
|
var import_chalk19 = __toESM(require("chalk"), 1);
|
|
3353
|
-
var
|
|
3354
|
-
var
|
|
3355
|
-
var
|
|
3393
|
+
var fs18 = __toESM(require("fs/promises"), 1);
|
|
3394
|
+
var import_path20 = __toESM(require("path"), 1);
|
|
3395
|
+
var import_events4 = require("events");
|
|
3356
3396
|
|
|
3357
3397
|
// src/daemon/file-watcher.ts
|
|
3358
3398
|
init_cjs_shims();
|
|
@@ -3970,8 +4010,142 @@ ${import_chalk18.default.gray("[Circular or invalid object]")}`;
|
|
|
3970
4010
|
}
|
|
3971
4011
|
};
|
|
3972
4012
|
|
|
4013
|
+
// src/daemon/harvester.ts
|
|
4014
|
+
init_cjs_shims();
|
|
4015
|
+
var import_events3 = require("events");
|
|
4016
|
+
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
4017
|
+
var import_path19 = __toESM(require("path"), 1);
|
|
4018
|
+
var import_promises17 = __toESM(require("fs/promises"), 1);
|
|
4019
|
+
var import_crypto = __toESM(require("crypto"), 1);
|
|
4020
|
+
var import_axios15 = __toESM(require("axios"), 1);
|
|
4021
|
+
var KnowledgeHarvester = class extends import_events3.EventEmitter {
|
|
4022
|
+
watcher = null;
|
|
4023
|
+
config;
|
|
4024
|
+
ruleHashes = /* @__PURE__ */ new Map();
|
|
4025
|
+
isReady = false;
|
|
4026
|
+
processingQueue = /* @__PURE__ */ new Set();
|
|
4027
|
+
debounceTimers = /* @__PURE__ */ new Map();
|
|
4028
|
+
// Ignore list to prevent feedback loops with system rules
|
|
4029
|
+
IGNORED_PREFIXES = ["rigstate-identity", "rigstate-guardian"];
|
|
4030
|
+
constructor(config2) {
|
|
4031
|
+
super();
|
|
4032
|
+
this.config = config2;
|
|
4033
|
+
}
|
|
4034
|
+
async start() {
|
|
4035
|
+
await this.loadHashes();
|
|
4036
|
+
const rulesPath = import_path19.default.join(this.config.watchPath, ".cursor", "rules");
|
|
4037
|
+
const watchPattern = import_path19.default.join(rulesPath, "**", "*.mdc");
|
|
4038
|
+
Logger.debug(`\u{1F33E} Harvester watching: ${watchPattern}`);
|
|
4039
|
+
this.watcher = import_chokidar.default.watch(watchPattern, {
|
|
4040
|
+
persistent: true,
|
|
4041
|
+
ignoreInitial: true,
|
|
4042
|
+
// Don't harvest what's already there on boot
|
|
4043
|
+
awaitWriteFinish: {
|
|
4044
|
+
stabilityThreshold: 2e3,
|
|
4045
|
+
pollInterval: 100
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
4048
|
+
this.watcher.on("add", (path28) => this.handleFileEvent(path28, "add")).on("change", (path28) => this.handleFileEvent(path28, "change"));
|
|
4049
|
+
this.isReady = true;
|
|
4050
|
+
}
|
|
4051
|
+
async stop() {
|
|
4052
|
+
if (this.watcher) {
|
|
4053
|
+
await this.watcher.close();
|
|
4054
|
+
this.watcher = null;
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
async handleFileEvent(filePath, event) {
|
|
4058
|
+
const fileName = import_path19.default.basename(filePath);
|
|
4059
|
+
if (this.IGNORED_PREFIXES.some((prefix) => fileName.startsWith(prefix))) {
|
|
4060
|
+
return;
|
|
4061
|
+
}
|
|
4062
|
+
if (this.debounceTimers.has(filePath)) {
|
|
4063
|
+
clearTimeout(this.debounceTimers.get(filePath));
|
|
4064
|
+
}
|
|
4065
|
+
this.debounceTimers.set(filePath, setTimeout(async () => {
|
|
4066
|
+
this.processFile(filePath);
|
|
4067
|
+
this.debounceTimers.delete(filePath);
|
|
4068
|
+
}, 5e3));
|
|
4069
|
+
}
|
|
4070
|
+
async processFile(filePath) {
|
|
4071
|
+
if (this.processingQueue.has(filePath)) return;
|
|
4072
|
+
this.processingQueue.add(filePath);
|
|
4073
|
+
try {
|
|
4074
|
+
const content = await import_promises17.default.readFile(filePath, "utf-8");
|
|
4075
|
+
const currentHash = this.computeHash(content);
|
|
4076
|
+
if (this.ruleHashes.get(filePath) === currentHash) {
|
|
4077
|
+
Logger.debug(`Skipping ${import_path19.default.basename(filePath)} (unchanged hash)`);
|
|
4078
|
+
return;
|
|
4079
|
+
}
|
|
4080
|
+
if (content.length < 20) {
|
|
4081
|
+
Logger.debug(`Skipping ${import_path19.default.basename(filePath)} (too short)`);
|
|
4082
|
+
return;
|
|
4083
|
+
}
|
|
4084
|
+
await this.submitSignal(filePath, content);
|
|
4085
|
+
this.ruleHashes.set(filePath, currentHash);
|
|
4086
|
+
} catch (error) {
|
|
4087
|
+
Logger.warn(`Harvester failed to process ${import_path19.default.basename(filePath)}: ${error.message}`);
|
|
4088
|
+
} finally {
|
|
4089
|
+
this.processingQueue.delete(filePath);
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
async submitSignal(filePath, content) {
|
|
4093
|
+
const title = import_path19.default.basename(filePath, ".mdc");
|
|
4094
|
+
const relativePath = import_path19.default.relative(process.cwd(), filePath);
|
|
4095
|
+
Logger.info(`\u{1F33E} Harvesting new knowledge: ${title}`);
|
|
4096
|
+
try {
|
|
4097
|
+
const descriptionMatch = content.match(/description:\s*(.*)/);
|
|
4098
|
+
const description = descriptionMatch ? descriptionMatch[1].trim() : "Auto-harvested from IDE interaction";
|
|
4099
|
+
const payload = {
|
|
4100
|
+
project_id: this.config.projectId,
|
|
4101
|
+
title,
|
|
4102
|
+
category: "ARCHITECTURE",
|
|
4103
|
+
// Default
|
|
4104
|
+
severity: "MEDIUM",
|
|
4105
|
+
instruction: content,
|
|
4106
|
+
reasoning: `Harvested from local file: ${relativePath}`,
|
|
4107
|
+
source_type: "IDE_HARVESTER"
|
|
4108
|
+
};
|
|
4109
|
+
const response = await import_axios15.default.post(`${this.config.apiUrl}/api/v1/curator/signals`, payload, {
|
|
4110
|
+
headers: { Authorization: `Bearer ${this.config.apiKey}` }
|
|
4111
|
+
});
|
|
4112
|
+
if (response.data.success) {
|
|
4113
|
+
Logger.info(`\u2705 Signal submitted for review: ${title}`);
|
|
4114
|
+
} else {
|
|
4115
|
+
throw new Error(response.data.error || "Unknown API error");
|
|
4116
|
+
}
|
|
4117
|
+
} catch (error) {
|
|
4118
|
+
if (error.response?.status === 404) {
|
|
4119
|
+
Logger.debug("Curator API not reachable (404). Signal stored locally (mock).");
|
|
4120
|
+
} else {
|
|
4121
|
+
Logger.error(`Failed to submit signal: ${error.message}`);
|
|
4122
|
+
this.ruleHashes.delete(filePath);
|
|
4123
|
+
throw error;
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
async loadHashes() {
|
|
4128
|
+
const rulesPath = import_path19.default.join(this.config.watchPath, ".cursor", "rules");
|
|
4129
|
+
try {
|
|
4130
|
+
await import_promises17.default.mkdir(rulesPath, { recursive: true });
|
|
4131
|
+
const files = await import_promises17.default.readdir(rulesPath);
|
|
4132
|
+
for (const file of files) {
|
|
4133
|
+
if (file.endsWith(".mdc")) {
|
|
4134
|
+
const fullPath = import_path19.default.join(rulesPath, file);
|
|
4135
|
+
const content = await import_promises17.default.readFile(fullPath, "utf-8");
|
|
4136
|
+
this.ruleHashes.set(fullPath, this.computeHash(content));
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
} catch (e) {
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
computeHash(content) {
|
|
4143
|
+
return import_crypto.default.createHash("sha256").update(content).digest("hex");
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
|
|
3973
4147
|
// src/daemon/core.ts
|
|
3974
|
-
var GuardianDaemon = class extends
|
|
4148
|
+
var GuardianDaemon = class extends import_events4.EventEmitter {
|
|
3975
4149
|
config;
|
|
3976
4150
|
state;
|
|
3977
4151
|
fileWatcher = null;
|
|
@@ -3979,6 +4153,8 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
3979
4153
|
heuristicEngine = null;
|
|
3980
4154
|
interventionProtocol = null;
|
|
3981
4155
|
bridgeListener = null;
|
|
4156
|
+
harvester = null;
|
|
4157
|
+
syncInterval = null;
|
|
3982
4158
|
constructor(config2) {
|
|
3983
4159
|
super();
|
|
3984
4160
|
this.config = config2;
|
|
@@ -4002,13 +4178,24 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4002
4178
|
this.heuristicEngine = createHeuristicEngine();
|
|
4003
4179
|
this.interventionProtocol = createInterventionProtocol();
|
|
4004
4180
|
this.guardianMonitor = createGuardianMonitor(this.config.projectId, this.config.apiUrl, this.config.apiKey);
|
|
4181
|
+
this.harvester = new KnowledgeHarvester({
|
|
4182
|
+
projectId: this.config.projectId,
|
|
4183
|
+
apiUrl: this.config.apiUrl,
|
|
4184
|
+
apiKey: this.config.apiKey,
|
|
4185
|
+
watchPath: process.cwd()
|
|
4186
|
+
});
|
|
4005
4187
|
await this.guardianMonitor.loadRules();
|
|
4006
4188
|
Logger.info(`Loaded ${this.guardianMonitor.getRuleCount()} rules`);
|
|
4007
4189
|
Logger.info("Syncing Brain to IDE (.cursor/rules)...");
|
|
4008
|
-
await
|
|
4190
|
+
await this.runRuleSync();
|
|
4009
4191
|
await this.syncHeuristics();
|
|
4010
4192
|
if (this.config.checkOnChange) {
|
|
4011
4193
|
this.setupFileWatcher();
|
|
4194
|
+
await this.harvester.start();
|
|
4195
|
+
Logger.info("Starting Auto-Sync Poller (5m interval)...");
|
|
4196
|
+
this.syncInterval = setInterval(() => {
|
|
4197
|
+
this.runRuleSync().catch((e) => Logger.error(`Auto-Sync failed: ${e.message}`));
|
|
4198
|
+
}, 5 * 60 * 1e3);
|
|
4012
4199
|
}
|
|
4013
4200
|
if (this.config.bridgeEnabled) {
|
|
4014
4201
|
try {
|
|
@@ -4022,6 +4209,14 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4022
4209
|
await this.updateViolationReport([]);
|
|
4023
4210
|
this.emit("started", this.state);
|
|
4024
4211
|
}
|
|
4212
|
+
async runRuleSync() {
|
|
4213
|
+
try {
|
|
4214
|
+
await syncProjectRules(this.config.projectId, this.config.apiKey, this.config.apiUrl);
|
|
4215
|
+
Logger.debug("Auto-Sync completed successfully");
|
|
4216
|
+
} catch (error) {
|
|
4217
|
+
Logger.warn(`Rule sync hiccup: ${error.message}`);
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4025
4220
|
printWelcome() {
|
|
4026
4221
|
console.log(import_chalk19.default.bold.blue("\n\u{1F6E1}\uFE0F Guardian Daemon Starting..."));
|
|
4027
4222
|
console.log(import_chalk19.default.dim(`Project: ${this.config.projectId}`));
|
|
@@ -4042,7 +4237,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4042
4237
|
setupFileWatcher() {
|
|
4043
4238
|
Logger.info("Starting file watcher...");
|
|
4044
4239
|
this.fileWatcher = createFileWatcher(this.config.watchPath);
|
|
4045
|
-
this.fileWatcher.on("change", (
|
|
4240
|
+
this.fileWatcher.on("change", (path28) => this.handleFileChange(path28));
|
|
4046
4241
|
this.fileWatcher.start();
|
|
4047
4242
|
Logger.info("File watcher active");
|
|
4048
4243
|
}
|
|
@@ -4055,7 +4250,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4055
4250
|
}
|
|
4056
4251
|
async getLineCount(filePath) {
|
|
4057
4252
|
try {
|
|
4058
|
-
const content = await
|
|
4253
|
+
const content = await fs18.readFile(filePath, "utf-8");
|
|
4059
4254
|
return content.split("\n").length;
|
|
4060
4255
|
} catch (e) {
|
|
4061
4256
|
return 0;
|
|
@@ -4092,7 +4287,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4092
4287
|
}
|
|
4093
4288
|
}
|
|
4094
4289
|
async updateViolationReport(violations) {
|
|
4095
|
-
const reportPath =
|
|
4290
|
+
const reportPath = import_path20.default.join(process.cwd(), ".rigstate", "ACTIVE_VIOLATIONS.md");
|
|
4096
4291
|
const allViolations = Array.from(this.violationsMap.entries());
|
|
4097
4292
|
const totalCount = allViolations.reduce((acc, [, v]) => acc + v.length, 0);
|
|
4098
4293
|
let content = `# \u{1F6E1}\uFE0F Guardian Status: ${totalCount > 0 ? "\u26A0\uFE0F ATTENTION" : "\u2705 PASS"}
|
|
@@ -4108,7 +4303,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4108
4303
|
} else {
|
|
4109
4304
|
content += "### \u{1F6A8} Active Violations\n\n";
|
|
4110
4305
|
for (const [file, fileViolations] of allViolations) {
|
|
4111
|
-
const relPath =
|
|
4306
|
+
const relPath = import_path20.default.relative(process.cwd(), file);
|
|
4112
4307
|
content += `#### \u{1F4C4} ${relPath}
|
|
4113
4308
|
`;
|
|
4114
4309
|
for (const v of fileViolations) {
|
|
@@ -4120,7 +4315,7 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4120
4315
|
content += "\n---\n*Rigstate Daemon is watching. Fix violations to clear this report.*";
|
|
4121
4316
|
}
|
|
4122
4317
|
try {
|
|
4123
|
-
await
|
|
4318
|
+
await fs18.writeFile(reportPath, content, "utf-8");
|
|
4124
4319
|
} catch (e) {
|
|
4125
4320
|
}
|
|
4126
4321
|
}
|
|
@@ -4157,6 +4352,8 @@ var GuardianDaemon = class extends import_events3.EventEmitter {
|
|
|
4157
4352
|
console.log(import_chalk19.default.dim("\n\u{1F6D1} Stopping Guardian Daemon..."));
|
|
4158
4353
|
if (this.fileWatcher) await this.fileWatcher.stop();
|
|
4159
4354
|
if (this.bridgeListener) await this.bridgeListener.disconnect();
|
|
4355
|
+
if (this.harvester) await this.harvester.stop();
|
|
4356
|
+
if (this.syncInterval) clearInterval(this.syncInterval);
|
|
4160
4357
|
this.state.isRunning = false;
|
|
4161
4358
|
console.log(import_chalk19.default.green("\u2713 Daemon stopped."));
|
|
4162
4359
|
this.emit("stopped", this.state);
|
|
@@ -4198,8 +4395,8 @@ async function createDaemon(options) {
|
|
|
4198
4395
|
// src/utils/service-manager.ts
|
|
4199
4396
|
init_cjs_shims();
|
|
4200
4397
|
var import_chalk20 = __toESM(require("chalk"), 1);
|
|
4201
|
-
var
|
|
4202
|
-
var
|
|
4398
|
+
var import_promises18 = __toESM(require("fs/promises"), 1);
|
|
4399
|
+
var import_path21 = __toESM(require("path"), 1);
|
|
4203
4400
|
var import_child_process3 = require("child_process");
|
|
4204
4401
|
var import_url = require("url");
|
|
4205
4402
|
async function execShellCommand(cmd) {
|
|
@@ -4222,11 +4419,11 @@ async function enableDaemon() {
|
|
|
4222
4419
|
console.error(import_chalk20.default.red("\u274C Could not determine HOME directory."));
|
|
4223
4420
|
return;
|
|
4224
4421
|
}
|
|
4225
|
-
const agentsDir =
|
|
4226
|
-
const logDir =
|
|
4227
|
-
const plistPath =
|
|
4228
|
-
await
|
|
4229
|
-
await
|
|
4422
|
+
const agentsDir = import_path21.default.join(homeDir, "Library/LaunchAgents");
|
|
4423
|
+
const logDir = import_path21.default.join(homeDir, ".rigstate/logs");
|
|
4424
|
+
const plistPath = import_path21.default.join(agentsDir, "com.rigstate.daemon.plist");
|
|
4425
|
+
await import_promises18.default.mkdir(agentsDir, { recursive: true });
|
|
4426
|
+
await import_promises18.default.mkdir(logDir, { recursive: true });
|
|
4230
4427
|
const scriptPath = (0, import_url.fileURLToPath)(importMetaUrl);
|
|
4231
4428
|
const nodePath = process.execPath;
|
|
4232
4429
|
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -4245,9 +4442,9 @@ async function enableDaemon() {
|
|
|
4245
4442
|
<key>WorkingDirectory</key>
|
|
4246
4443
|
<string>${process.cwd()}</string>
|
|
4247
4444
|
<key>StandardOutPath</key>
|
|
4248
|
-
<string>${
|
|
4445
|
+
<string>${import_path21.default.join(logDir, "daemon.out.log")}</string>
|
|
4249
4446
|
<key>StandardErrorPath</key>
|
|
4250
|
-
<string>${
|
|
4447
|
+
<string>${import_path21.default.join(logDir, "daemon.err.log")}</string>
|
|
4251
4448
|
<key>RunAtLoad</key>
|
|
4252
4449
|
<true/>
|
|
4253
4450
|
<key>KeepAlive</key>
|
|
@@ -4260,7 +4457,7 @@ async function enableDaemon() {
|
|
|
4260
4457
|
</dict>
|
|
4261
4458
|
</plist>`;
|
|
4262
4459
|
try {
|
|
4263
|
-
await
|
|
4460
|
+
await import_promises18.default.writeFile(plistPath, plistContent);
|
|
4264
4461
|
console.log(import_chalk20.default.dim(`Created plist at: ${plistPath}`));
|
|
4265
4462
|
try {
|
|
4266
4463
|
await execShellCommand(`launchctl unload ${plistPath}`);
|
|
@@ -4277,10 +4474,10 @@ async function enableDaemon() {
|
|
|
4277
4474
|
async function disableDaemon() {
|
|
4278
4475
|
console.log(import_chalk20.default.bold("\n\u2699\uFE0F Disabling Rigstate Background Service\n"));
|
|
4279
4476
|
const homeDir = process.env.HOME || "";
|
|
4280
|
-
const plistPath =
|
|
4477
|
+
const plistPath = import_path21.default.join(homeDir, "Library/LaunchAgents/com.rigstate.daemon.plist");
|
|
4281
4478
|
try {
|
|
4282
4479
|
await execShellCommand(`launchctl unload ${plistPath}`);
|
|
4283
|
-
await
|
|
4480
|
+
await import_promises18.default.unlink(plistPath);
|
|
4284
4481
|
console.log(import_chalk20.default.green("\u2705 Successfully disabled background daemon."));
|
|
4285
4482
|
} catch (error) {
|
|
4286
4483
|
if (error.code === "ENOENT") {
|
|
@@ -4311,9 +4508,9 @@ function createDaemonCommand() {
|
|
|
4311
4508
|
}
|
|
4312
4509
|
const spinner = (0, import_ora8.default)();
|
|
4313
4510
|
try {
|
|
4314
|
-
const pidPath =
|
|
4511
|
+
const pidPath = import_path22.default.join(process.cwd(), PID_FILE);
|
|
4315
4512
|
try {
|
|
4316
|
-
const content = await
|
|
4513
|
+
const content = await import_promises19.default.readFile(pidPath, "utf-8");
|
|
4317
4514
|
const pid = parseInt(content.trim(), 10);
|
|
4318
4515
|
try {
|
|
4319
4516
|
process.kill(pid, 0);
|
|
@@ -4321,7 +4518,7 @@ function createDaemonCommand() {
|
|
|
4321
4518
|
console.log(import_chalk21.default.dim(` Run "rigstate daemon status" for details or Ctrl+C to stop.
|
|
4322
4519
|
`));
|
|
4323
4520
|
} catch {
|
|
4324
|
-
await
|
|
4521
|
+
await import_promises19.default.unlink(pidPath).catch(() => {
|
|
4325
4522
|
});
|
|
4326
4523
|
}
|
|
4327
4524
|
} catch {
|
|
@@ -4365,14 +4562,14 @@ function createDaemonCommand() {
|
|
|
4365
4562
|
}
|
|
4366
4563
|
async function isRunning() {
|
|
4367
4564
|
try {
|
|
4368
|
-
const pidPath =
|
|
4369
|
-
const content = await
|
|
4565
|
+
const pidPath = import_path22.default.join(process.cwd(), PID_FILE);
|
|
4566
|
+
const content = await import_promises19.default.readFile(pidPath, "utf-8");
|
|
4370
4567
|
const pid = parseInt(content.trim(), 10);
|
|
4371
4568
|
try {
|
|
4372
4569
|
process.kill(pid, 0);
|
|
4373
4570
|
return true;
|
|
4374
4571
|
} catch {
|
|
4375
|
-
await
|
|
4572
|
+
await import_promises19.default.unlink(pidPath);
|
|
4376
4573
|
return false;
|
|
4377
4574
|
}
|
|
4378
4575
|
} catch {
|
|
@@ -4381,25 +4578,25 @@ async function isRunning() {
|
|
|
4381
4578
|
}
|
|
4382
4579
|
async function writePidFile() {
|
|
4383
4580
|
try {
|
|
4384
|
-
const dir =
|
|
4385
|
-
await
|
|
4386
|
-
await
|
|
4581
|
+
const dir = import_path22.default.join(process.cwd(), ".rigstate");
|
|
4582
|
+
await import_promises19.default.mkdir(dir, { recursive: true });
|
|
4583
|
+
await import_promises19.default.writeFile(import_path22.default.join(dir, "daemon.pid"), process.pid.toString());
|
|
4387
4584
|
} catch {
|
|
4388
4585
|
}
|
|
4389
4586
|
}
|
|
4390
4587
|
async function cleanupPidFile() {
|
|
4391
4588
|
try {
|
|
4392
|
-
await
|
|
4393
|
-
await
|
|
4589
|
+
await import_promises19.default.unlink(import_path22.default.join(process.cwd(), PID_FILE));
|
|
4590
|
+
await import_promises19.default.unlink(import_path22.default.join(process.cwd(), STATE_FILE));
|
|
4394
4591
|
} catch {
|
|
4395
4592
|
}
|
|
4396
4593
|
}
|
|
4397
4594
|
async function writeStateFile(state) {
|
|
4398
4595
|
try {
|
|
4399
|
-
const dir =
|
|
4400
|
-
await
|
|
4401
|
-
await
|
|
4402
|
-
|
|
4596
|
+
const dir = import_path22.default.join(process.cwd(), ".rigstate");
|
|
4597
|
+
await import_promises19.default.mkdir(dir, { recursive: true });
|
|
4598
|
+
await import_promises19.default.writeFile(
|
|
4599
|
+
import_path22.default.join(dir, "daemon.state.json"),
|
|
4403
4600
|
JSON.stringify(state, null, 2)
|
|
4404
4601
|
);
|
|
4405
4602
|
} catch {
|
|
@@ -4415,8 +4612,8 @@ async function showStatus() {
|
|
|
4415
4612
|
}
|
|
4416
4613
|
console.log(import_chalk21.default.green("Status: Running"));
|
|
4417
4614
|
try {
|
|
4418
|
-
const statePath =
|
|
4419
|
-
const content = await
|
|
4615
|
+
const statePath = import_path22.default.join(process.cwd(), STATE_FILE);
|
|
4616
|
+
const content = await import_promises19.default.readFile(statePath, "utf-8");
|
|
4420
4617
|
const state = JSON.parse(content);
|
|
4421
4618
|
console.log(import_chalk21.default.dim("\u2500".repeat(40)));
|
|
4422
4619
|
console.log(`Started at: ${state.startedAt || "Unknown"}`);
|
|
@@ -4429,8 +4626,8 @@ async function showStatus() {
|
|
|
4429
4626
|
console.log(import_chalk21.default.dim("(State file not found)"));
|
|
4430
4627
|
}
|
|
4431
4628
|
try {
|
|
4432
|
-
const pidPath =
|
|
4433
|
-
const pid = await
|
|
4629
|
+
const pidPath = import_path22.default.join(process.cwd(), PID_FILE);
|
|
4630
|
+
const pid = await import_promises19.default.readFile(pidPath, "utf-8");
|
|
4434
4631
|
console.log(import_chalk21.default.dim(`PID: ${pid.trim()}`));
|
|
4435
4632
|
} catch {
|
|
4436
4633
|
}
|
|
@@ -4442,7 +4639,7 @@ init_cjs_shims();
|
|
|
4442
4639
|
var import_commander13 = require("commander");
|
|
4443
4640
|
var import_chalk23 = __toESM(require("chalk"), 1);
|
|
4444
4641
|
var import_ora10 = __toESM(require("ora"), 1);
|
|
4445
|
-
var
|
|
4642
|
+
var import_axios17 = __toESM(require("axios"), 1);
|
|
4446
4643
|
var import_inquirer3 = __toESM(require("inquirer"), 1);
|
|
4447
4644
|
init_config();
|
|
4448
4645
|
init_suggest();
|
|
@@ -4452,9 +4649,9 @@ init_cjs_shims();
|
|
|
4452
4649
|
var import_commander12 = require("commander");
|
|
4453
4650
|
var import_chalk22 = __toESM(require("chalk"), 1);
|
|
4454
4651
|
var import_ora9 = __toESM(require("ora"), 1);
|
|
4455
|
-
var
|
|
4456
|
-
var
|
|
4457
|
-
var
|
|
4652
|
+
var import_axios16 = __toESM(require("axios"), 1);
|
|
4653
|
+
var import_promises20 = __toESM(require("fs/promises"), 1);
|
|
4654
|
+
var import_path23 = __toESM(require("path"), 1);
|
|
4458
4655
|
var import_inquirer2 = __toESM(require("inquirer"), 1);
|
|
4459
4656
|
init_config();
|
|
4460
4657
|
function createPlanCommand() {
|
|
@@ -4473,7 +4670,7 @@ async function executePlan(taskId) {
|
|
|
4473
4670
|
let taskDescription = "";
|
|
4474
4671
|
if (!taskId) {
|
|
4475
4672
|
spinner.text = "Fetching actionable tasks...";
|
|
4476
|
-
const response = await
|
|
4673
|
+
const response = await import_axios16.default.get(
|
|
4477
4674
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4478
4675
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4479
4676
|
);
|
|
@@ -4500,7 +4697,7 @@ async function executePlan(taskId) {
|
|
|
4500
4697
|
taskId = `T-${answer.task.step_number}`;
|
|
4501
4698
|
} else {
|
|
4502
4699
|
spinner.text = `Fetching details for ${taskId}...`;
|
|
4503
|
-
const response = await
|
|
4700
|
+
const response = await import_axios16.default.get(
|
|
4504
4701
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4505
4702
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4506
4703
|
);
|
|
@@ -4513,7 +4710,7 @@ async function executePlan(taskId) {
|
|
|
4513
4710
|
taskDescription = task.description;
|
|
4514
4711
|
}
|
|
4515
4712
|
spinner.start("Generating Context for Frank...");
|
|
4516
|
-
const contextPath =
|
|
4713
|
+
const contextPath = import_path23.default.join(process.cwd(), ".rigstate", "CURRENT_CONTEXT.md");
|
|
4517
4714
|
const contextContent = `
|
|
4518
4715
|
# \u{1F3AF} Active Mission: ${taskTitle}
|
|
4519
4716
|
**ID:** ${taskId}
|
|
@@ -4528,10 +4725,10 @@ ${taskDescription}
|
|
|
4528
4725
|
|
|
4529
4726
|
*Generated by Rigstate CLI at ${(/* @__PURE__ */ new Date()).toLocaleString()}*
|
|
4530
4727
|
`;
|
|
4531
|
-
await
|
|
4532
|
-
await
|
|
4533
|
-
const planPath =
|
|
4534
|
-
const planExists = await
|
|
4728
|
+
await import_promises20.default.mkdir(import_path23.default.dirname(contextPath), { recursive: true });
|
|
4729
|
+
await import_promises20.default.writeFile(contextPath, contextContent.trim());
|
|
4730
|
+
const planPath = import_path23.default.join(process.cwd(), "IMPLEMENTATION_PLAN.md");
|
|
4731
|
+
const planExists = await import_promises20.default.stat(planPath).then(() => true).catch(() => false);
|
|
4535
4732
|
if (!planExists) {
|
|
4536
4733
|
const planTemplate = `
|
|
4537
4734
|
# \u{1F4CB} Implementation Plan: ${taskTitle}
|
|
@@ -4550,7 +4747,7 @@ ${taskDescription}
|
|
|
4550
4747
|
## 4. \u{1F680} Execution
|
|
4551
4748
|
[Frank: Log your progress here]
|
|
4552
4749
|
`;
|
|
4553
|
-
await
|
|
4750
|
+
await import_promises20.default.writeFile(planPath, planTemplate.trim());
|
|
4554
4751
|
spinner.succeed(import_chalk22.default.green("Created new IMPLEMENTATION_PLAN.md"));
|
|
4555
4752
|
} else {
|
|
4556
4753
|
spinner.info(import_chalk22.default.yellow("IMPLEMENTATION_PLAN.md already exists. Preserving it."));
|
|
@@ -4597,7 +4794,7 @@ async function listInteractive() {
|
|
|
4597
4794
|
const spinner = (0, import_ora10.default)("Fetching roadmap...").start();
|
|
4598
4795
|
try {
|
|
4599
4796
|
const { projectId, apiKey, apiUrl } = getContext2();
|
|
4600
|
-
const response = await
|
|
4797
|
+
const response = await import_axios17.default.get(
|
|
4601
4798
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
4602
4799
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
4603
4800
|
);
|
|
@@ -4657,12 +4854,12 @@ async function setTaskStatus(taskId, status) {
|
|
|
4657
4854
|
let realId = taskId;
|
|
4658
4855
|
if (taskId.startsWith("T-") || taskId.length < 10) {
|
|
4659
4856
|
spinner.text = "Resolving Task ID...";
|
|
4660
|
-
const lookup = await
|
|
4857
|
+
const lookup = await import_axios17.default.get(`${apiUrl}/api/v1/roadmap?project_id=${projectId}`, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
4661
4858
|
const task = lookup.data.data.roadmap.find((t) => `T-${t.step_number}` === taskId || t.step_number.toString() === taskId);
|
|
4662
4859
|
if (!task) throw new Error(`Task ${taskId} not found.`);
|
|
4663
4860
|
realId = task.id;
|
|
4664
4861
|
}
|
|
4665
|
-
await
|
|
4862
|
+
await import_axios17.default.post(
|
|
4666
4863
|
`${apiUrl}/api/v1/roadmap/update-status`,
|
|
4667
4864
|
{ step_id: realId, status, project_id: projectId },
|
|
4668
4865
|
{ headers: { "Authorization": `Bearer ${apiKey}` } }
|
|
@@ -4704,12 +4901,12 @@ init_cjs_shims();
|
|
|
4704
4901
|
var import_commander14 = require("commander");
|
|
4705
4902
|
var import_chalk24 = __toESM(require("chalk"), 1);
|
|
4706
4903
|
var import_ora11 = __toESM(require("ora"), 1);
|
|
4707
|
-
var
|
|
4708
|
-
var
|
|
4709
|
-
var
|
|
4904
|
+
var import_chokidar2 = __toESM(require("chokidar"), 1);
|
|
4905
|
+
var import_promises21 = __toESM(require("fs/promises"), 1);
|
|
4906
|
+
var import_path24 = __toESM(require("path"), 1);
|
|
4710
4907
|
var import_child_process4 = require("child_process");
|
|
4711
4908
|
init_config();
|
|
4712
|
-
var
|
|
4909
|
+
var import_axios18 = __toESM(require("axios"), 1);
|
|
4713
4910
|
function createWatchCommand() {
|
|
4714
4911
|
const watch2 = new import_commander14.Command("watch");
|
|
4715
4912
|
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 +4924,8 @@ function createWatchCommand() {
|
|
|
4727
4924
|
projectId = getProjectId();
|
|
4728
4925
|
if (!projectId) {
|
|
4729
4926
|
try {
|
|
4730
|
-
const manifestPath =
|
|
4731
|
-
const content = await
|
|
4927
|
+
const manifestPath = import_path24.default.join(process.cwd(), ".rigstate");
|
|
4928
|
+
const content = await import_promises21.default.readFile(manifestPath, "utf-8");
|
|
4732
4929
|
const manifest = JSON.parse(content);
|
|
4733
4930
|
projectId = manifest.project_id;
|
|
4734
4931
|
} catch (e) {
|
|
@@ -4750,7 +4947,7 @@ function createWatchCommand() {
|
|
|
4750
4947
|
console.log("");
|
|
4751
4948
|
const fetchActiveTask = async () => {
|
|
4752
4949
|
try {
|
|
4753
|
-
const response = await
|
|
4950
|
+
const response = await import_axios18.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4754
4951
|
params: { project_id: projectId },
|
|
4755
4952
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4756
4953
|
});
|
|
@@ -4774,17 +4971,17 @@ function createWatchCommand() {
|
|
|
4774
4971
|
};
|
|
4775
4972
|
const checkCriteria = async (criteria) => {
|
|
4776
4973
|
try {
|
|
4777
|
-
const fullPath =
|
|
4974
|
+
const fullPath = import_path24.default.resolve(process.cwd(), criteria.path);
|
|
4778
4975
|
switch (criteria.type) {
|
|
4779
4976
|
case "file_exists":
|
|
4780
|
-
await
|
|
4977
|
+
await import_promises21.default.access(fullPath);
|
|
4781
4978
|
return true;
|
|
4782
4979
|
case "file_content":
|
|
4783
|
-
const content = await
|
|
4980
|
+
const content = await import_promises21.default.readFile(fullPath, "utf-8");
|
|
4784
4981
|
return content.length > 0;
|
|
4785
4982
|
case "content_match":
|
|
4786
4983
|
if (!criteria.match) return false;
|
|
4787
|
-
const fileContent = await
|
|
4984
|
+
const fileContent = await import_promises21.default.readFile(fullPath, "utf-8");
|
|
4788
4985
|
return fileContent.includes(criteria.match);
|
|
4789
4986
|
default:
|
|
4790
4987
|
return false;
|
|
@@ -4806,7 +5003,7 @@ function createWatchCommand() {
|
|
|
4806
5003
|
return;
|
|
4807
5004
|
}
|
|
4808
5005
|
}
|
|
4809
|
-
await
|
|
5006
|
+
await import_axios18.default.post(`${apiUrl}/api/v1/roadmap/update-status`, {
|
|
4810
5007
|
project_id: projectId,
|
|
4811
5008
|
chunk_id: taskId,
|
|
4812
5009
|
status: "COMPLETED"
|
|
@@ -4881,7 +5078,7 @@ function createWatchCommand() {
|
|
|
4881
5078
|
isProcessing = false;
|
|
4882
5079
|
};
|
|
4883
5080
|
await processActiveTask();
|
|
4884
|
-
const watcher =
|
|
5081
|
+
const watcher = import_chokidar2.default.watch(".", {
|
|
4885
5082
|
ignored: [
|
|
4886
5083
|
/(^|[\/\\])\../,
|
|
4887
5084
|
// dotfiles
|
|
@@ -4916,10 +5113,10 @@ var import_commander15 = require("commander");
|
|
|
4916
5113
|
var import_chalk25 = __toESM(require("chalk"), 1);
|
|
4917
5114
|
var import_ora12 = __toESM(require("ora"), 1);
|
|
4918
5115
|
init_config();
|
|
4919
|
-
var
|
|
5116
|
+
var import_axios19 = __toESM(require("axios"), 1);
|
|
4920
5117
|
var import_child_process5 = require("child_process");
|
|
4921
|
-
var
|
|
4922
|
-
var
|
|
5118
|
+
var import_promises22 = __toESM(require("fs/promises"), 1);
|
|
5119
|
+
var import_path25 = __toESM(require("path"), 1);
|
|
4923
5120
|
function createFocusCommand() {
|
|
4924
5121
|
const focus = new import_commander15.Command("focus");
|
|
4925
5122
|
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 +5132,8 @@ function createFocusCommand() {
|
|
|
4935
5132
|
projectId = getProjectId();
|
|
4936
5133
|
if (!projectId) {
|
|
4937
5134
|
try {
|
|
4938
|
-
const manifestPath =
|
|
4939
|
-
const content = await
|
|
5135
|
+
const manifestPath = import_path25.default.join(process.cwd(), ".rigstate");
|
|
5136
|
+
const content = await import_promises22.default.readFile(manifestPath, "utf-8");
|
|
4940
5137
|
const manifest = JSON.parse(content);
|
|
4941
5138
|
projectId = manifest.project_id;
|
|
4942
5139
|
} catch (e) {
|
|
@@ -4948,7 +5145,7 @@ function createFocusCommand() {
|
|
|
4948
5145
|
}
|
|
4949
5146
|
const apiUrl = getApiUrl();
|
|
4950
5147
|
try {
|
|
4951
|
-
const response = await
|
|
5148
|
+
const response = await import_axios19.default.get(`${apiUrl}/api/v1/roadmap`, {
|
|
4952
5149
|
params: { project_id: projectId },
|
|
4953
5150
|
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4954
5151
|
});
|
|
@@ -5090,22 +5287,22 @@ init_cjs_shims();
|
|
|
5090
5287
|
var import_commander17 = require("commander");
|
|
5091
5288
|
var import_chalk27 = __toESM(require("chalk"), 1);
|
|
5092
5289
|
var import_child_process6 = require("child_process");
|
|
5093
|
-
var
|
|
5290
|
+
var import_path26 = __toESM(require("path"), 1);
|
|
5094
5291
|
var import_fs = __toESM(require("fs"), 1);
|
|
5095
5292
|
var import_url2 = require("url");
|
|
5096
5293
|
init_config();
|
|
5097
5294
|
var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
5098
|
-
var __dirname =
|
|
5295
|
+
var __dirname = import_path26.default.dirname(__filename2);
|
|
5099
5296
|
function createMcpCommand() {
|
|
5100
5297
|
const mcp = new import_commander17.Command("mcp");
|
|
5101
5298
|
mcp.description("Run the Rigstate MCP server for AI editors").action(async () => {
|
|
5102
5299
|
const possiblePaths = [
|
|
5103
5300
|
// From packages/cli -> packages/mcp (sibling package)
|
|
5104
|
-
|
|
5301
|
+
import_path26.default.resolve(__dirname, "../../mcp/dist/index.js"),
|
|
5105
5302
|
// If installed globally or via npm
|
|
5106
|
-
|
|
5303
|
+
import_path26.default.resolve(__dirname, "../../../mcp/dist/index.js"),
|
|
5107
5304
|
// Development path from packages/cli/dist
|
|
5108
|
-
|
|
5305
|
+
import_path26.default.resolve(__dirname, "../../../packages/mcp/dist/index.js")
|
|
5109
5306
|
];
|
|
5110
5307
|
let serverPath = "";
|
|
5111
5308
|
for (const p of possiblePaths) {
|
|
@@ -5161,12 +5358,12 @@ var import_chalk29 = __toESM(require("chalk"), 1);
|
|
|
5161
5358
|
|
|
5162
5359
|
// src/nexus/dispatcher.ts
|
|
5163
5360
|
init_cjs_shims();
|
|
5164
|
-
var
|
|
5361
|
+
var import_events5 = __toESM(require("events"), 1);
|
|
5165
5362
|
var import_uuid = require("uuid");
|
|
5166
5363
|
|
|
5167
5364
|
// src/hive/gateway.ts
|
|
5168
5365
|
init_cjs_shims();
|
|
5169
|
-
var
|
|
5366
|
+
var import_axios20 = __toESM(require("axios"), 1);
|
|
5170
5367
|
|
|
5171
5368
|
// src/hive/scrubber.ts
|
|
5172
5369
|
init_cjs_shims();
|
|
@@ -5237,7 +5434,7 @@ var HiveGateway = class {
|
|
|
5237
5434
|
if (!this.enabled) {
|
|
5238
5435
|
console.log(import_chalk28.default.dim("\u26A0\uFE0F Hive Gateway disabled (No Token provided). Running in localized mode."));
|
|
5239
5436
|
}
|
|
5240
|
-
this.client =
|
|
5437
|
+
this.client = import_axios20.default.create({
|
|
5241
5438
|
baseURL: baseUrl,
|
|
5242
5439
|
headers: {
|
|
5243
5440
|
"Authorization": `Bearer ${token}`,
|
|
@@ -5278,7 +5475,7 @@ var HiveGateway = class {
|
|
|
5278
5475
|
};
|
|
5279
5476
|
|
|
5280
5477
|
// src/nexus/dispatcher.ts
|
|
5281
|
-
var NexusDispatcher = class extends
|
|
5478
|
+
var NexusDispatcher = class extends import_events5.default {
|
|
5282
5479
|
context;
|
|
5283
5480
|
orderQueue = [];
|
|
5284
5481
|
orderHistory = [];
|
|
@@ -5431,7 +5628,7 @@ var import_commander19 = require("commander");
|
|
|
5431
5628
|
var import_chalk30 = __toESM(require("chalk"), 1);
|
|
5432
5629
|
init_governance();
|
|
5433
5630
|
init_config();
|
|
5434
|
-
var
|
|
5631
|
+
var import_axios21 = __toESM(require("axios"), 1);
|
|
5435
5632
|
function createOverrideCommand() {
|
|
5436
5633
|
const override = new import_commander19.Command("override");
|
|
5437
5634
|
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 +5651,7 @@ function createOverrideCommand() {
|
|
|
5454
5651
|
if (projectId) {
|
|
5455
5652
|
const apiUrl = getApiUrl();
|
|
5456
5653
|
const apiKey = getApiKey();
|
|
5457
|
-
await
|
|
5654
|
+
await import_axios21.default.post(`${apiUrl}/api/v1/execution-logs`, {
|
|
5458
5655
|
project_id: projectId,
|
|
5459
5656
|
task_id: "OVERRIDE-" + Date.now(),
|
|
5460
5657
|
task_title: `Governance Override: ${violationId}`,
|
|
@@ -5482,7 +5679,7 @@ init_cjs_shims();
|
|
|
5482
5679
|
var import_commander20 = require("commander");
|
|
5483
5680
|
var import_chalk31 = __toESM(require("chalk"), 1);
|
|
5484
5681
|
var import_ora13 = __toESM(require("ora"), 1);
|
|
5485
|
-
var
|
|
5682
|
+
var import_axios22 = __toESM(require("axios"), 1);
|
|
5486
5683
|
var import_inquirer5 = __toESM(require("inquirer"), 1);
|
|
5487
5684
|
init_config();
|
|
5488
5685
|
function createIdeaCommand() {
|
|
@@ -5517,7 +5714,7 @@ function createIdeaCommand() {
|
|
|
5517
5714
|
if (tags.length === 0) {
|
|
5518
5715
|
}
|
|
5519
5716
|
const spinner = (0, import_ora13.default)("Securing idea in the Lab...").start();
|
|
5520
|
-
const response = await
|
|
5717
|
+
const response = await import_axios22.default.post(
|
|
5521
5718
|
`${apiUrl}/api/v1/ideas`,
|
|
5522
5719
|
{
|
|
5523
5720
|
project_id: projectId,
|
|
@@ -5547,8 +5744,8 @@ var import_commander21 = require("commander");
|
|
|
5547
5744
|
var import_chalk32 = __toESM(require("chalk"), 1);
|
|
5548
5745
|
var import_ora14 = __toESM(require("ora"), 1);
|
|
5549
5746
|
var import_inquirer6 = __toESM(require("inquirer"), 1);
|
|
5550
|
-
var
|
|
5551
|
-
var
|
|
5747
|
+
var import_promises23 = __toESM(require("fs/promises"), 1);
|
|
5748
|
+
var import_path27 = __toESM(require("path"), 1);
|
|
5552
5749
|
init_config();
|
|
5553
5750
|
|
|
5554
5751
|
// ../../node_modules/simple-git/dist/esm/index.js
|
|
@@ -5589,8 +5786,8 @@ function pathspec(...paths) {
|
|
|
5589
5786
|
cache.set(key, paths);
|
|
5590
5787
|
return key;
|
|
5591
5788
|
}
|
|
5592
|
-
function isPathSpec(
|
|
5593
|
-
return
|
|
5789
|
+
function isPathSpec(path28) {
|
|
5790
|
+
return path28 instanceof String && cache.has(path28);
|
|
5594
5791
|
}
|
|
5595
5792
|
function toPaths(pathSpec) {
|
|
5596
5793
|
return cache.get(pathSpec) || [];
|
|
@@ -5679,8 +5876,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
5679
5876
|
function forEachLineWithContent(input, callback) {
|
|
5680
5877
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
5681
5878
|
}
|
|
5682
|
-
function folderExists(
|
|
5683
|
-
return (0, import_file_exists.exists)(
|
|
5879
|
+
function folderExists(path28) {
|
|
5880
|
+
return (0, import_file_exists.exists)(path28, import_file_exists.FOLDER);
|
|
5684
5881
|
}
|
|
5685
5882
|
function append(target, item) {
|
|
5686
5883
|
if (Array.isArray(target)) {
|
|
@@ -6084,8 +6281,8 @@ function checkIsRepoRootTask() {
|
|
|
6084
6281
|
commands,
|
|
6085
6282
|
format: "utf-8",
|
|
6086
6283
|
onError,
|
|
6087
|
-
parser(
|
|
6088
|
-
return /^\.(git)?$/.test(
|
|
6284
|
+
parser(path28) {
|
|
6285
|
+
return /^\.(git)?$/.test(path28.trim());
|
|
6089
6286
|
}
|
|
6090
6287
|
};
|
|
6091
6288
|
}
|
|
@@ -6519,11 +6716,11 @@ function parseGrep(grep) {
|
|
|
6519
6716
|
const paths = /* @__PURE__ */ new Set();
|
|
6520
6717
|
const results = {};
|
|
6521
6718
|
forEachLineWithContent(grep, (input) => {
|
|
6522
|
-
const [
|
|
6523
|
-
paths.add(
|
|
6524
|
-
(results[
|
|
6719
|
+
const [path28, line, preview] = input.split(NULL);
|
|
6720
|
+
paths.add(path28);
|
|
6721
|
+
(results[path28] = results[path28] || []).push({
|
|
6525
6722
|
line: asNumber(line),
|
|
6526
|
-
path:
|
|
6723
|
+
path: path28,
|
|
6527
6724
|
preview
|
|
6528
6725
|
});
|
|
6529
6726
|
});
|
|
@@ -7288,14 +7485,14 @@ var init_hash_object = __esm2({
|
|
|
7288
7485
|
init_task();
|
|
7289
7486
|
}
|
|
7290
7487
|
});
|
|
7291
|
-
function parseInit(bare,
|
|
7488
|
+
function parseInit(bare, path28, text) {
|
|
7292
7489
|
const response = String(text).trim();
|
|
7293
7490
|
let result;
|
|
7294
7491
|
if (result = initResponseRegex.exec(response)) {
|
|
7295
|
-
return new InitSummary(bare,
|
|
7492
|
+
return new InitSummary(bare, path28, false, result[1]);
|
|
7296
7493
|
}
|
|
7297
7494
|
if (result = reInitResponseRegex.exec(response)) {
|
|
7298
|
-
return new InitSummary(bare,
|
|
7495
|
+
return new InitSummary(bare, path28, true, result[1]);
|
|
7299
7496
|
}
|
|
7300
7497
|
let gitDir = "";
|
|
7301
7498
|
const tokens = response.split(" ");
|
|
@@ -7306,7 +7503,7 @@ function parseInit(bare, path27, text) {
|
|
|
7306
7503
|
break;
|
|
7307
7504
|
}
|
|
7308
7505
|
}
|
|
7309
|
-
return new InitSummary(bare,
|
|
7506
|
+
return new InitSummary(bare, path28, /^re/i.test(response), gitDir);
|
|
7310
7507
|
}
|
|
7311
7508
|
var InitSummary;
|
|
7312
7509
|
var initResponseRegex;
|
|
@@ -7315,9 +7512,9 @@ var init_InitSummary = __esm2({
|
|
|
7315
7512
|
"src/lib/responses/InitSummary.ts"() {
|
|
7316
7513
|
"use strict";
|
|
7317
7514
|
InitSummary = class {
|
|
7318
|
-
constructor(bare,
|
|
7515
|
+
constructor(bare, path28, existing, gitDir) {
|
|
7319
7516
|
this.bare = bare;
|
|
7320
|
-
this.path =
|
|
7517
|
+
this.path = path28;
|
|
7321
7518
|
this.existing = existing;
|
|
7322
7519
|
this.gitDir = gitDir;
|
|
7323
7520
|
}
|
|
@@ -7329,7 +7526,7 @@ var init_InitSummary = __esm2({
|
|
|
7329
7526
|
function hasBareCommand(command) {
|
|
7330
7527
|
return command.includes(bareCommand);
|
|
7331
7528
|
}
|
|
7332
|
-
function initTask(bare = false,
|
|
7529
|
+
function initTask(bare = false, path28, customArgs) {
|
|
7333
7530
|
const commands = ["init", ...customArgs];
|
|
7334
7531
|
if (bare && !hasBareCommand(commands)) {
|
|
7335
7532
|
commands.splice(1, 0, bareCommand);
|
|
@@ -7338,7 +7535,7 @@ function initTask(bare = false, path27, customArgs) {
|
|
|
7338
7535
|
commands,
|
|
7339
7536
|
format: "utf-8",
|
|
7340
7537
|
parser(text) {
|
|
7341
|
-
return parseInit(commands.includes("--bare"),
|
|
7538
|
+
return parseInit(commands.includes("--bare"), path28, text);
|
|
7342
7539
|
}
|
|
7343
7540
|
};
|
|
7344
7541
|
}
|
|
@@ -8154,12 +8351,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
8154
8351
|
"use strict";
|
|
8155
8352
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
8156
8353
|
FileStatusSummary = class {
|
|
8157
|
-
constructor(
|
|
8158
|
-
this.path =
|
|
8354
|
+
constructor(path28, index, working_dir) {
|
|
8355
|
+
this.path = path28;
|
|
8159
8356
|
this.index = index;
|
|
8160
8357
|
this.working_dir = working_dir;
|
|
8161
8358
|
if (index === "R" || working_dir === "R") {
|
|
8162
|
-
const detail = fromPathRegex.exec(
|
|
8359
|
+
const detail = fromPathRegex.exec(path28) || [null, path28, path28];
|
|
8163
8360
|
this.from = detail[2] || "";
|
|
8164
8361
|
this.path = detail[1] || "";
|
|
8165
8362
|
}
|
|
@@ -8190,14 +8387,14 @@ function splitLine(result, lineStr) {
|
|
|
8190
8387
|
default:
|
|
8191
8388
|
return;
|
|
8192
8389
|
}
|
|
8193
|
-
function data(index, workingDir,
|
|
8390
|
+
function data(index, workingDir, path28) {
|
|
8194
8391
|
const raw = `${index}${workingDir}`;
|
|
8195
8392
|
const handler = parsers6.get(raw);
|
|
8196
8393
|
if (handler) {
|
|
8197
|
-
handler(result,
|
|
8394
|
+
handler(result, path28);
|
|
8198
8395
|
}
|
|
8199
8396
|
if (raw !== "##" && raw !== "!!") {
|
|
8200
|
-
result.files.push(new FileStatusSummary(
|
|
8397
|
+
result.files.push(new FileStatusSummary(path28, index, workingDir));
|
|
8201
8398
|
}
|
|
8202
8399
|
}
|
|
8203
8400
|
}
|
|
@@ -8510,9 +8707,9 @@ var init_simple_git_api = __esm2({
|
|
|
8510
8707
|
next
|
|
8511
8708
|
);
|
|
8512
8709
|
}
|
|
8513
|
-
hashObject(
|
|
8710
|
+
hashObject(path28, write) {
|
|
8514
8711
|
return this._runTask(
|
|
8515
|
-
hashObjectTask(
|
|
8712
|
+
hashObjectTask(path28, write === true),
|
|
8516
8713
|
trailingFunctionArgument(arguments)
|
|
8517
8714
|
);
|
|
8518
8715
|
}
|
|
@@ -8865,8 +9062,8 @@ var init_branch = __esm2({
|
|
|
8865
9062
|
}
|
|
8866
9063
|
});
|
|
8867
9064
|
function toPath(input) {
|
|
8868
|
-
const
|
|
8869
|
-
return
|
|
9065
|
+
const path28 = input.trim().replace(/^["']|["']$/g, "");
|
|
9066
|
+
return path28 && (0, import_node_path.normalize)(path28);
|
|
8870
9067
|
}
|
|
8871
9068
|
var parseCheckIgnore;
|
|
8872
9069
|
var init_CheckIgnore = __esm2({
|
|
@@ -9180,8 +9377,8 @@ __export2(sub_module_exports, {
|
|
|
9180
9377
|
subModuleTask: () => subModuleTask,
|
|
9181
9378
|
updateSubModuleTask: () => updateSubModuleTask
|
|
9182
9379
|
});
|
|
9183
|
-
function addSubModuleTask(repo,
|
|
9184
|
-
return subModuleTask(["add", repo,
|
|
9380
|
+
function addSubModuleTask(repo, path28) {
|
|
9381
|
+
return subModuleTask(["add", repo, path28]);
|
|
9185
9382
|
}
|
|
9186
9383
|
function initSubModuleTask(customArgs) {
|
|
9187
9384
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -9511,8 +9708,8 @@ var require_git = __commonJS2({
|
|
|
9511
9708
|
}
|
|
9512
9709
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
9513
9710
|
};
|
|
9514
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
9515
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
9711
|
+
Git2.prototype.submoduleAdd = function(repo, path28, then) {
|
|
9712
|
+
return this._runTask(addSubModuleTask2(repo, path28), trailingFunctionArgument2(arguments));
|
|
9516
9713
|
};
|
|
9517
9714
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
9518
9715
|
return this._runTask(
|
|
@@ -10112,8 +10309,8 @@ function createReleaseCommand() {
|
|
|
10112
10309
|
return;
|
|
10113
10310
|
}
|
|
10114
10311
|
spinner.text = "Scanning completed tasks...";
|
|
10115
|
-
const pkgPath =
|
|
10116
|
-
const pkgContent = await
|
|
10312
|
+
const pkgPath = import_path27.default.resolve(process.cwd(), "package.json");
|
|
10313
|
+
const pkgContent = await import_promises23.default.readFile(pkgPath, "utf-8");
|
|
10117
10314
|
const pkg2 = JSON.parse(pkgContent);
|
|
10118
10315
|
const currentVersion = pkg2.version;
|
|
10119
10316
|
const [major, minor, patch] = currentVersion.split(".").map(Number);
|
|
@@ -10133,17 +10330,17 @@ function createReleaseCommand() {
|
|
|
10133
10330
|
return;
|
|
10134
10331
|
}
|
|
10135
10332
|
pkg2.version = newVersion;
|
|
10136
|
-
await
|
|
10137
|
-
const changelogPath =
|
|
10333
|
+
await import_promises23.default.writeFile(pkgPath, JSON.stringify(pkg2, null, 4));
|
|
10334
|
+
const changelogPath = import_path27.default.resolve(process.cwd(), "CHANGELOG.md");
|
|
10138
10335
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
10139
10336
|
const entry = `
|
|
10140
10337
|
## [${newVersion}] - ${date}
|
|
10141
10338
|
- Automated release via Rigstate.
|
|
10142
10339
|
`;
|
|
10143
10340
|
try {
|
|
10144
|
-
await
|
|
10341
|
+
await import_promises23.default.appendFile(changelogPath, entry);
|
|
10145
10342
|
} catch {
|
|
10146
|
-
await
|
|
10343
|
+
await import_promises23.default.writeFile(changelogPath, "# Changelog\n" + entry);
|
|
10147
10344
|
}
|
|
10148
10345
|
spinner.start("Tagging and pushing...");
|
|
10149
10346
|
await git.add(["package.json", "CHANGELOG.md"]);
|
|
@@ -10170,7 +10367,7 @@ init_cjs_shims();
|
|
|
10170
10367
|
var import_commander22 = require("commander");
|
|
10171
10368
|
var import_chalk33 = __toESM(require("chalk"), 1);
|
|
10172
10369
|
var import_ora15 = __toESM(require("ora"), 1);
|
|
10173
|
-
var
|
|
10370
|
+
var import_axios23 = __toESM(require("axios"), 1);
|
|
10174
10371
|
init_config();
|
|
10175
10372
|
function createRoadmapCommand() {
|
|
10176
10373
|
return new import_commander22.Command("roadmap").alias("tactical").description("View project roadmap and task status (Tactical View)").action(async () => {
|
|
@@ -10183,7 +10380,7 @@ function createRoadmapCommand() {
|
|
|
10183
10380
|
spinner.fail(import_chalk33.default.red('Project context missing. Run "rigstate link".'));
|
|
10184
10381
|
return;
|
|
10185
10382
|
}
|
|
10186
|
-
const response = await
|
|
10383
|
+
const response = await import_axios23.default.get(
|
|
10187
10384
|
`${apiUrl}/api/v1/roadmap?project_id=${projectId}`,
|
|
10188
10385
|
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
10189
10386
|
);
|