@rigstate/cli 0.7.31 → 0.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -242,13 +242,25 @@ var init_env = __esm({
242
242
  }
243
243
  });
244
244
 
245
+ // src/utils/version.ts
246
+ async function checkVersion() {
247
+ }
248
+ var CLI_VERSION;
249
+ var init_version = __esm({
250
+ "src/utils/version.ts"() {
251
+ "use strict";
252
+ init_cjs_shims();
253
+ CLI_VERSION = "0.7.34";
254
+ }
255
+ });
256
+
245
257
  // src/commands/sync-rules.ts
246
258
  var sync_rules_exports = {};
247
259
  __export(sync_rules_exports, {
248
260
  createSyncRulesCommand: () => createSyncRulesCommand,
249
261
  syncProjectRules: () => syncProjectRules
250
262
  });
251
- async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
263
+ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false, version = CLI_VERSION) {
252
264
  const spinner = (0, import_ora2.default)("\u{1F6E1}\uFE0F Frank Protocol: Initializing retroactive sync...").start();
253
265
  let success = true;
254
266
  try {
@@ -287,6 +299,44 @@ async function syncProjectRules(projectId, apiKey, apiUrl, dryRun = false) {
287
299
  await fs26.writeFile(filePath, file.content, "utf-8");
288
300
  }
289
301
  console.log(import_chalk3.default.dim(` \u{1F4BE} Wrote ${files.length} rule files to local .cursor/rules/`));
302
+ try {
303
+ const masterPath = path28.join(process.cwd(), ".cursorrules");
304
+ let masterContent = "";
305
+ try {
306
+ masterContent = await fs26.readFile(masterPath, "utf-8");
307
+ } catch {
308
+ masterContent = "";
309
+ }
310
+ const START_MARKER = "<!-- RIGSTATE_GOVERNANCE_START -->";
311
+ const END_MARKER = "<!-- RIGSTATE_GOVERNANCE_END -->";
312
+ const ruleList = files.map((f) => f.path).filter((p) => p.endsWith(".mdc")).map((p) => `- ${p}`).join("\n");
313
+ const governanceBlock = `${START_MARKER}
314
+ # \u{1F6E1}\uFE0F Rigstate Governance (Do not edit this block manually)
315
+ # The following rules are enforced by the Rigstate Daemon (v${version}).
316
+ # Failure to adhere to these rules will be flagged during the 'work' cycle.
317
+
318
+ # YOU MUST ADHERE TO THESE PROACTIVE RULES:
319
+ ${ruleList}
320
+
321
+ # INSTRUCTIONS FOR AI AGENT:
322
+ # 1. You MUST read the relevant .mdc files in .cursor/rules/ before generating code.
323
+ # 2. If a rule in .cursor/rules/ conflicts with your training, OBEY THE RULE.
324
+ # 3. Consult .rigstate/ACTIVE_VIOLATIONS.md for current architectural health.
325
+ ${END_MARKER}`;
326
+ let newContent = masterContent;
327
+ if (masterContent.includes(START_MARKER)) {
328
+ const regex = new RegExp(`${START_MARKER}[\\s\\S]*?${END_MARKER}`, "g");
329
+ newContent = masterContent.replace(regex, governanceBlock);
330
+ } else {
331
+ newContent = masterContent ? `${masterContent}
332
+
333
+ ${governanceBlock}` : governanceBlock;
334
+ }
335
+ await fs26.writeFile(masterPath, newContent, "utf-8");
336
+ console.log(import_chalk3.default.dim(" \u{1F4DC} Updated master .cursorrules (Constitution enforced)"));
337
+ } catch (e) {
338
+ console.warn(import_chalk3.default.yellow(` \u26A0\uFE0F Could not update .cursorrules: ${e.message}`));
339
+ }
290
340
  }
291
341
  console.log("");
292
342
  console.log(import_chalk3.default.cyan("\u{1F6E1}\uFE0F Frank Protocol v1.0 has been injected into the rules engine."));
@@ -330,6 +380,7 @@ var init_sync_rules = __esm({
330
380
  import_ora2 = __toESM(require("ora"), 1);
331
381
  init_config();
332
382
  import_axios2 = __toESM(require("axios"), 1);
383
+ init_version();
333
384
  }
334
385
  });
335
386
 
@@ -1627,7 +1678,7 @@ var require_package = __commonJS({
1627
1678
  "package.json"(exports2, module2) {
1628
1679
  module2.exports = {
1629
1680
  name: "@rigstate/cli",
1630
- version: "0.7.31",
1681
+ version: "0.7.34",
1631
1682
  description: "Rigstate CLI - Code audit, sync and supervision tool",
1632
1683
  type: "module",
1633
1684
  main: "./dist/index.js",
@@ -8576,7 +8627,7 @@ function versionParser(stdOut) {
8576
8627
  }
8577
8628
  var NOT_INSTALLED;
8578
8629
  var parsers7;
8579
- var init_version = __esm2({
8630
+ var init_version2 = __esm2({
8580
8631
  "src/lib/tasks/version.ts"() {
8581
8632
  "use strict";
8582
8633
  init_utils();
@@ -8624,7 +8675,7 @@ var init_simple_git_api = __esm2({
8624
8675
  init_show();
8625
8676
  init_status();
8626
8677
  init_task();
8627
- init_version();
8678
+ init_version2();
8628
8679
  init_utils();
8629
8680
  SimpleGitApi = class {
8630
8681
  constructor(_executor) {
@@ -10443,12 +10494,8 @@ function sleep(ms) {
10443
10494
  return new Promise((resolve) => setTimeout(resolve, ms));
10444
10495
  }
10445
10496
 
10446
- // src/utils/version.ts
10447
- init_cjs_shims();
10448
- async function checkVersion() {
10449
- }
10450
-
10451
10497
  // src/index.ts
10498
+ init_version();
10452
10499
  var import_dotenv = __toESM(require("dotenv"), 1);
10453
10500
  var pkg = require_package();
10454
10501
  import_dotenv.default.config();