rex-claude 2.1.0 → 2.2.0

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
@@ -369,7 +369,7 @@ async function main() {
369
369
  break;
370
370
  }
371
371
  case "init": {
372
- const { init } = await import("./init-S7BKM2N2.js");
372
+ const { init } = await import("./init-NXU37FCV.js");
373
373
  await init();
374
374
  break;
375
375
  }
@@ -414,18 +414,18 @@ async function main() {
414
414
  break;
415
415
  }
416
416
  case "startup": {
417
- const { installStartup } = await import("./init-S7BKM2N2.js");
417
+ const { installStartup } = await import("./init-NXU37FCV.js");
418
418
  installStartup();
419
419
  break;
420
420
  }
421
421
  case "startup-remove": {
422
- const { uninstallStartup } = await import("./init-S7BKM2N2.js");
422
+ const { uninstallStartup } = await import("./init-NXU37FCV.js");
423
423
  uninstallStartup();
424
424
  break;
425
425
  }
426
426
  case "--version":
427
427
  case "-v":
428
- console.log("rex-claude v2.1.0");
428
+ console.log("rex-claude v2.2.0");
429
429
  break;
430
430
  case "help":
431
431
  default:
@@ -41,6 +41,105 @@ function ensureDir(dir) {
41
41
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
42
42
  }
43
43
  var PLIST_LABEL = "com.dstudio.rex";
44
+ var INGEST_PLIST_LABEL = "com.dstudio.rex-ingest";
45
+ function installIngestAgent() {
46
+ if (process.platform !== "darwin") {
47
+ info("Auto-ingest only supported on macOS");
48
+ return;
49
+ }
50
+ const launchAgentsDir = join(homedir(), "Library", "LaunchAgents");
51
+ ensureDir(launchAgentsDir);
52
+ const plistPath = join(launchAgentsDir, `${INGEST_PLIST_LABEL}.plist`);
53
+ let rexBin = "";
54
+ try {
55
+ rexBin = execSync("which rex", { encoding: "utf-8" }).trim();
56
+ } catch {
57
+ }
58
+ if (!rexBin) {
59
+ info("rex binary not in PATH \u2014 skipping ingest LaunchAgent");
60
+ return;
61
+ }
62
+ if (existsSync(plistPath)) {
63
+ skip("Ingest LaunchAgent already installed (auto-ingest every hour)");
64
+ return;
65
+ }
66
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
67
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
68
+ <plist version="1.0">
69
+ <dict>
70
+ <key>Label</key>
71
+ <string>${INGEST_PLIST_LABEL}</string>
72
+ <key>ProgramArguments</key>
73
+ <array>
74
+ <string>${rexBin}</string>
75
+ <string>ingest</string>
76
+ </array>
77
+ <key>RunAtLoad</key>
78
+ <true/>
79
+ <key>StartInterval</key>
80
+ <integer>3600</integer>
81
+ <key>StandardOutPath</key>
82
+ <string>${join(homedir(), ".claude", "rex-ingest.log")}</string>
83
+ <key>StandardErrorPath</key>
84
+ <string>${join(homedir(), ".claude", "rex-ingest.log")}</string>
85
+ <key>EnvironmentVariables</key>
86
+ <dict>
87
+ <key>PATH</key>
88
+ <string>/usr/local/bin:/usr/bin:/bin:${dirname(rexBin)}</string>
89
+ </dict>
90
+ </dict>
91
+ </plist>
92
+ `;
93
+ writeFileSync(plistPath, plist);
94
+ try {
95
+ execSync(`launchctl load ${plistPath}`, { stdio: "ignore" });
96
+ } catch {
97
+ }
98
+ ok("Ingest LaunchAgent installed \u2014 auto-ingest every hour");
99
+ }
100
+ function uninstallIngestAgent() {
101
+ if (process.platform !== "darwin") return;
102
+ const plistPath = join(homedir(), "Library", "LaunchAgents", `${INGEST_PLIST_LABEL}.plist`);
103
+ if (!existsSync(plistPath)) {
104
+ info("Ingest LaunchAgent not installed");
105
+ return;
106
+ }
107
+ try {
108
+ execSync(`launchctl unload ${plistPath}`, { stdio: "ignore" });
109
+ } catch {
110
+ }
111
+ try {
112
+ unlinkSync(plistPath);
113
+ } catch {
114
+ }
115
+ ok("Ingest LaunchAgent removed");
116
+ }
117
+ function installApp() {
118
+ if (process.platform !== "darwin") return;
119
+ const thisDir = new URL(".", import.meta.url).pathname;
120
+ const buildApp = join(thisDir, "..", "..", "app", "src-tauri", "target", "release", "bundle", "macos", "REX.app");
121
+ const installedApp = "/Applications/REX.app";
122
+ if (existsSync(installedApp)) {
123
+ skip("REX.app already in /Applications");
124
+ } else if (existsSync(buildApp)) {
125
+ try {
126
+ execSync(`cp -R "${buildApp}" "${installedApp}"`, { stdio: "ignore" });
127
+ ok("REX.app installed to /Applications");
128
+ } catch {
129
+ info("Could not copy REX.app to /Applications (try manually)");
130
+ return;
131
+ }
132
+ } else {
133
+ info("REX.app not built \u2014 run `pnpm tauri build` in packages/app first");
134
+ return;
135
+ }
136
+ try {
137
+ execSync(`osascript -e 'tell application "System Events" to make login item at end with properties {path:"${installedApp}", hidden:false}'`, { stdio: "ignore" });
138
+ ok("REX.app added to Login Items (auto-start on login)");
139
+ } catch {
140
+ skip("REX.app already in Login Items");
141
+ }
142
+ }
44
143
  function installStartup() {
45
144
  if (process.platform !== "darwin") {
46
145
  info("Startup auto-launch only supported on macOS");
@@ -102,17 +201,18 @@ function uninstallStartup() {
102
201
  const plistPath = join(homedir(), "Library", "LaunchAgents", `${PLIST_LABEL}.plist`);
103
202
  if (!existsSync(plistPath)) {
104
203
  info("LaunchAgent not installed");
105
- return;
106
- }
107
- try {
108
- execSync(`launchctl unload ${plistPath}`, { stdio: "ignore" });
109
- } catch {
110
- }
111
- try {
112
- unlinkSync(plistPath);
113
- } catch {
204
+ } else {
205
+ try {
206
+ execSync(`launchctl unload ${plistPath}`, { stdio: "ignore" });
207
+ } catch {
208
+ }
209
+ try {
210
+ unlinkSync(plistPath);
211
+ } catch {
212
+ }
213
+ ok("LaunchAgent removed");
114
214
  }
115
- ok("LaunchAgent removed");
215
+ uninstallIngestAgent();
116
216
  }
117
217
  async function init() {
118
218
  const claudeDir = join(homedir(), ".claude");
@@ -280,6 +380,8 @@ fi
280
380
  skip("All REX guards already installed");
281
381
  }
282
382
  installStartup();
383
+ installIngestAgent();
384
+ installApp();
283
385
  let ollamaOk = false;
284
386
  try {
285
387
  const res = await fetch("http://localhost:11434/api/tags");
@@ -321,6 +423,9 @@ ${COLORS.bold} REX initialized!${COLORS.reset}`);
321
423
  }
322
424
  export {
323
425
  init,
426
+ installApp,
427
+ installIngestAgent,
324
428
  installStartup,
429
+ uninstallIngestAgent,
325
430
  uninstallStartup
326
431
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rex-claude",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Claude Code sous steroides — guards, health checks, memory RAG",
5
5
  "type": "module",
6
6
  "bin": {