rex-claude 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +100 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -193,12 +193,111 @@ function main() {
193
193
  warn('Ollama non installé (optionnel pour embeddings)');
194
194
  info(' brew install ollama && ollama pull nomic-embed-text');
195
195
  }
196
+ // 9. Install nightly memory ingest
197
+ installMemoryIngest(os);
196
198
  // Summary
197
199
  console.log(`\n${BOLD}${GREEN} ══════════════════════════════${RESET}`);
198
200
  console.log(`${BOLD}${GREEN} REX installé avec succès !${RESET}`);
199
201
  console.log(`${DIM} ~/.claude/ → rules, skills, docs, commands${RESET}`);
200
202
  console.log(`${DIM} ~/.rex-memory/ → MCP memory server${RESET}`);
201
203
  console.log(`${DIM} ~/.tmux.conf → tmux config${RESET}`);
204
+ console.log(`${DIM} Ingest mémoire → nightly 02:00${RESET}`);
202
205
  console.log(`${BOLD}${GREEN} ══════════════════════════════${RESET}\n`);
203
206
  }
204
- main();
207
+ function installMemoryIngest(os) {
208
+ const ingestScript = join(REX_MEMORY_DIR, 'dist', 'ingest.js');
209
+ if (!existsSync(ingestScript)) {
210
+ warn('ingest.js non trouvé — ingest auto ignoré');
211
+ return;
212
+ }
213
+ mkdirSync(join(REX_MEMORY_DIR, 'logs'), { recursive: true });
214
+ let nodePath = process.execPath;
215
+ try {
216
+ nodePath = execSync('which node', { stdio: 'pipe' }).toString().trim();
217
+ }
218
+ catch { /* keep process.execPath */ }
219
+ if (os === 'darwin') {
220
+ const plistPath = join(HOME, 'Library', 'LaunchAgents', 'com.rex.memory-ingest.plist');
221
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
222
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
223
+ <plist version="1.0">
224
+ <dict>
225
+ <key>Label</key>
226
+ <string>com.rex.memory-ingest</string>
227
+ <key>ProgramArguments</key>
228
+ <array>
229
+ <string>${nodePath}</string>
230
+ <string>${ingestScript}</string>
231
+ </array>
232
+ <key>EnvironmentVariables</key>
233
+ <dict>
234
+ <key>HOME</key>
235
+ <string>${HOME}</string>
236
+ <key>OLLAMA_URL</key>
237
+ <string>http://localhost:11434</string>
238
+ </dict>
239
+ <key>StartCalendarInterval</key>
240
+ <dict>
241
+ <key>Hour</key>
242
+ <integer>2</integer>
243
+ <key>Minute</key>
244
+ <integer>0</integer>
245
+ </dict>
246
+ <key>StandardOutPath</key>
247
+ <string>${join(REX_MEMORY_DIR, 'logs', 'ingest.log')}</string>
248
+ <key>StandardErrorPath</key>
249
+ <string>${join(REX_MEMORY_DIR, 'logs', 'ingest-error.log')}</string>
250
+ <key>RunAtLoad</key>
251
+ <false/>
252
+ </dict>
253
+ </plist>`;
254
+ writeFileSync(plistPath, plist);
255
+ try {
256
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null; launchctl load "${plistPath}"`, { stdio: 'pipe' });
257
+ ok('LaunchAgent ingest mémoire installé (nightly 02:00)');
258
+ }
259
+ catch {
260
+ warn('LaunchAgent créé mais non chargé — relancer manuellement si besoin');
261
+ }
262
+ }
263
+ else {
264
+ // Linux: crontab
265
+ try {
266
+ const existing = execSync('crontab -l 2>/dev/null || true', { stdio: 'pipe' }).toString();
267
+ if (!existing.includes('rex-memory')) {
268
+ const newCron = `${existing.trim()}\n0 2 * * * ${nodePath} ${ingestScript} >> ${join(REX_MEMORY_DIR, 'logs', 'ingest.log')} 2>&1\n`;
269
+ execSync(`echo "${newCron.replace(/"/g, '\\"')}" | crontab -`, { stdio: 'pipe' });
270
+ ok('Cron ingest mémoire installé (nightly 02:00)');
271
+ }
272
+ else {
273
+ ok('Cron ingest mémoire déjà configuré');
274
+ }
275
+ }
276
+ catch {
277
+ warn('Impossible de configurer le cron — ajouter manuellement :');
278
+ info(` 0 2 * * * ${nodePath} ${ingestScript}`);
279
+ }
280
+ }
281
+ }
282
+ function update() {
283
+ console.log(`\n${BOLD}${CYAN} ╔══════════════════════════════╗${RESET}`);
284
+ console.log(`${BOLD}${CYAN} ║ REX — Update ║${RESET}`);
285
+ console.log(`${BOLD}${CYAN} ╚══════════════════════════════╝${RESET}\n`);
286
+ info('Mise à jour de rex-claude depuis npm...');
287
+ try {
288
+ execSync('npm install -g rex-claude@latest', { stdio: 'inherit' });
289
+ ok('rex-claude mis à jour avec succès');
290
+ info('Relance "rex" pour appliquer les changements');
291
+ }
292
+ catch (e) {
293
+ fail(`Échec de la mise à jour: ${e.message?.split('\n')[0]}`);
294
+ process.exit(1);
295
+ }
296
+ }
297
+ const cmd = process.argv[2];
298
+ if (cmd === 'update') {
299
+ update();
300
+ }
301
+ else {
302
+ main();
303
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "rex-claude",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "REX — Config unifiée + MCP memory server + activity logger pour Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
7
- "rex": "./dist/cli.js"
7
+ "rex": "dist/cli.js"
8
8
  },
9
9
  "files": [
10
10
  "dist/",