rex-claude 1.1.5 → 1.1.6

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 +86 -9
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -184,17 +184,12 @@ function main() {
184
184
  }
185
185
  }
186
186
  }
187
- // 8. Check Ollama
188
- try {
189
- execSync('which ollama', { stdio: 'pipe' });
190
- ok('Ollama détecté');
191
- }
192
- catch {
193
- warn('Ollama non installé (optionnel pour embeddings)');
194
- info(' brew install ollama && ollama pull nomic-embed-text');
195
- }
187
+ // 8. Check Ollama + LaunchAgent keepalive
188
+ installOllama(os);
196
189
  // 9. Install nightly memory ingest
197
190
  installMemoryIngest(os);
191
+ // 10. tmux auto-start in shell
192
+ installTmuxHook();
198
193
  // Summary
199
194
  console.log(`\n${BOLD}${GREEN} ══════════════════════════════${RESET}`);
200
195
  console.log(`${BOLD}${GREEN} REX installé avec succès !${RESET}`);
@@ -202,8 +197,90 @@ function main() {
202
197
  console.log(`${DIM} ~/.rex-memory/ → MCP memory server${RESET}`);
203
198
  console.log(`${DIM} ~/.tmux.conf → tmux config${RESET}`);
204
199
  console.log(`${DIM} Ingest mémoire → toutes les 6h (quand allumé)${RESET}`);
200
+ console.log(`${DIM} Ollama → keepalive au login${RESET}`);
201
+ console.log(`${DIM} tmux → auto-attach au démarrage terminal${RESET}`);
205
202
  console.log(`${BOLD}${GREEN} ══════════════════════════════${RESET}\n`);
206
203
  }
204
+ function installOllama(os) {
205
+ try {
206
+ execSync('which ollama', { stdio: 'pipe' });
207
+ ok('Ollama détecté');
208
+ }
209
+ catch {
210
+ warn('Ollama non installé — embeddings désactivés');
211
+ info(' brew install ollama && ollama pull nomic-embed-text');
212
+ return;
213
+ }
214
+ if (os !== 'darwin')
215
+ return;
216
+ const plistPath = join(HOME, 'Library', 'LaunchAgents', 'com.rex.ollama.plist');
217
+ let ollamaPath = '/usr/local/bin/ollama';
218
+ try {
219
+ ollamaPath = execSync('which ollama', { stdio: 'pipe' }).toString().trim();
220
+ }
221
+ catch { }
222
+ const plist = `<?xml version="1.0" encoding="UTF-8"?>
223
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
224
+ <plist version="1.0">
225
+ <dict>
226
+ <key>Label</key>
227
+ <string>com.rex.ollama</string>
228
+ <key>ProgramArguments</key>
229
+ <array>
230
+ <string>${ollamaPath}</string>
231
+ <string>serve</string>
232
+ </array>
233
+ <key>EnvironmentVariables</key>
234
+ <dict>
235
+ <key>HOME</key>
236
+ <string>${HOME}</string>
237
+ <key>OLLAMA_HOST</key>
238
+ <string>127.0.0.1:11434</string>
239
+ </dict>
240
+ <key>RunAtLoad</key>
241
+ <true/>
242
+ <key>KeepAlive</key>
243
+ <true/>
244
+ <key>StandardOutPath</key>
245
+ <string>${join(REX_MEMORY_DIR, 'logs', 'ollama.log')}</string>
246
+ <key>StandardErrorPath</key>
247
+ <string>${join(REX_MEMORY_DIR, 'logs', 'ollama-error.log')}</string>
248
+ <key>ThrottleInterval</key>
249
+ <integer>10</integer>
250
+ </dict>
251
+ </plist>`;
252
+ writeFileSync(plistPath, plist);
253
+ try {
254
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null; launchctl load "${plistPath}"`, { stdio: 'pipe' });
255
+ ok('LaunchAgent Ollama installé (keepalive au login)');
256
+ }
257
+ catch {
258
+ warn('LaunchAgent Ollama créé mais non chargé');
259
+ }
260
+ }
261
+ function installTmuxHook() {
262
+ const shell = process.env.SHELL || '';
263
+ const rcFile = shell.includes('zsh') ? join(HOME, '.zshrc')
264
+ : shell.includes('bash') ? join(HOME, '.bashrc')
265
+ : null;
266
+ if (!rcFile || !existsSync(rcFile)) {
267
+ warn('Shell RC non détecté — tmux auto-start ignoré');
268
+ return;
269
+ }
270
+ const existing = readFileSync(rcFile, 'utf-8');
271
+ if (existing.includes('REX — Auto-start tmux')) {
272
+ ok('tmux auto-start déjà configuré');
273
+ return;
274
+ }
275
+ const hook = `
276
+ # REX — Auto-start tmux
277
+ if command -v tmux &>/dev/null && [ -z "$TMUX" ] && [ "$TERM_PROGRAM" != "vscode" ]; then
278
+ tmux attach -t main 2>/dev/null || tmux new-session -s main
279
+ fi
280
+ `;
281
+ writeFileSync(rcFile, existing + hook);
282
+ ok(`tmux auto-start ajouté dans ${rcFile.replace(HOME, '~')}`);
283
+ }
207
284
  function installMemoryIngest(os) {
208
285
  const ingestScript = join(REX_MEMORY_DIR, 'dist', 'ingest.js');
209
286
  if (!existsSync(ingestScript)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rex-claude",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "REX — Config unifiée + MCP memory server + activity logger pour Claude Code",
5
5
  "type": "module",
6
6
  "bin": {