auxilo-mcp 0.8.1 → 0.9.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/bin/auxilo-cli.js CHANGED
@@ -26,13 +26,25 @@ const HOME = os.homedir();
26
26
 
27
27
  // ─── Prompt helpers ─────────────────────────────────────────────────────────
28
28
 
29
+ // LW-17: ONE shared readline interface for the whole run. Creating a fresh
30
+ // interface per question loses any input readline already buffered when the
31
+ // previous interface closed — with piped/scripted stdin the answer to
32
+ // question N+1 arrives with question N's buffer and the next prompt hangs
33
+ // on EOF (the 0.8.1 consent step silently never completed).
34
+ let sharedRl = null;
35
+ function getRl() {
36
+ if (!sharedRl) {
37
+ sharedRl = readline.createInterface({ input: process.stdin, output: process.stdout });
38
+ }
39
+ return sharedRl;
40
+ }
41
+ function closeRl() {
42
+ if (sharedRl) { sharedRl.close(); sharedRl = null; }
43
+ }
44
+
29
45
  function ask(question) {
30
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
31
46
  return new Promise((resolve) => {
32
- rl.question(question, (answer) => {
33
- rl.close();
34
- resolve(answer.trim());
35
- });
47
+ getRl().question(question, (answer) => resolve(answer.trim()));
36
48
  });
37
49
  }
38
50
 
@@ -76,8 +88,8 @@ function parseFlags(argv) {
76
88
  const CONSENT_TEXT = `
77
89
  Background extraction (optional)
78
90
  --------------------------------
79
- If you opt in, a SessionEnd hook runs after each Claude Code session and a
80
- local runner:
91
+ If you opt in, a session-end hook runs after each session in your wired
92
+ clients (Claude Code, Cursor, Gemini CLI, …) and a local runner:
81
93
  • READS the session transcript from your machine,
82
94
  • SCRUBS it locally (sensitivity filter: API keys, tokens, emails, PII —
83
95
  redacted BEFORE anything leaves your machine),
@@ -97,7 +109,9 @@ async function cmdSetup(flags) {
97
109
  // 1. Client detection ------------------------------------------------------
98
110
  const detected = installer.detectClients(HOME);
99
111
  if (detected.length === 0) {
100
- console.log('No supported clients detected (Claude Code, Claude Desktop, Cursor, OpenClaw).');
112
+ console.log('No supported clients detected (Claude Code, Claude Desktop, Cursor, Windsurf,');
113
+ console.log('Codex CLI, Gemini CLI, Antigravity, Factory droid, Copilot CLI, Continue.dev,');
114
+ console.log('opencode, Kiro, Junie, Amp, OpenHands, OpenClaw).');
101
115
  console.log('Install one, then re-run `npx auxilo setup`.');
102
116
  process.exit(1);
103
117
  }
@@ -198,6 +212,23 @@ async function cmdSetup(flags) {
198
212
  }
199
213
  }
200
214
 
215
+ // UC-1: capture hooks for every other chosen client that supports one.
216
+ try {
217
+ for (const r of installer.installCaptureHooks(HOME, chosen)) {
218
+ if (r.error) {
219
+ console.error(` ✗ ${r.name}: SKIPPED — ${r.error}`);
220
+ } else if (r.changed) {
221
+ console.log(` ✓ ${r.name}: capture hook registered (${r.event})`);
222
+ if (r.notes) console.log(` ${r.notes}`);
223
+ } else {
224
+ console.log(` ✓ ${r.name}: capture hook already registered`);
225
+ if (r.notes) console.log(` ${r.notes}`);
226
+ }
227
+ }
228
+ } catch (err) {
229
+ console.error(` ✗ Capture hooks SKIPPED — ${err.message}`);
230
+ }
231
+
201
232
  // 5. Explicit consent (default No) ------------------------------------------
202
233
  console.log(CONSENT_TEXT);
203
234
  const consented = await askYesNo(' Enable background extraction?', false);
@@ -214,6 +245,33 @@ async function cmdSetup(flags) {
214
245
  console.log(' ✓ Background extraction left OFF (MCP-only install). Enable later by re-running `auxilo setup`.');
215
246
  }
216
247
 
248
+ // 6. Rules-file snippet (UC-0 agent-prompted contribution; opt-in, default No)
249
+ const rulesClients = chosen.filter((c) => c.rulesPath);
250
+ if (rulesClients.length > 0) {
251
+ console.log('');
252
+ const addRules = await askYesNo(
253
+ " Add a one-paragraph note to your agents' global rules files suggesting they contribute learnings?",
254
+ false
255
+ );
256
+ if (addRules) {
257
+ try {
258
+ const results = installer.installRulesSnippet(HOME, {
259
+ targets: rulesClients.map((c) => c.rulesPath),
260
+ });
261
+ for (let i = 0; i < results.length; i++) {
262
+ const r = results[i];
263
+ console.log(r.changed
264
+ ? ` ✓ ${rulesClients[i].name}: contribution note written to ${r.path}`
265
+ : ` ✓ ${rulesClients[i].name}: contribution note already present in ${r.path} (no changes)`);
266
+ }
267
+ } catch (err) {
268
+ console.error(` ✗ Rules snippet SKIPPED — ${err.message}`);
269
+ }
270
+ } else {
271
+ console.log(' ✓ Rules files left untouched.');
272
+ }
273
+ }
274
+
217
275
  console.log('\nDone. Check `npx auxilo status` any time. Restart your client(s) to pick up the MCP server.\n');
218
276
  }
219
277
 
@@ -241,6 +299,9 @@ async function cmdStatus() {
241
299
  console.log(`Kill-switch sentinel: ${s.sentinel ? 'present (extraction enabled)' : 'absent (extraction disabled)'}`);
242
300
  console.log(`Runner installed: ${s.runnerInstalled ? 'yes (~/.auxilo/bin)' : 'no'}`);
243
301
  console.log(`SessionEnd hook: ${s.hookInstalled ? 'installed' : 'not installed'}${s.hookRegistered ? ', registered in Claude Code settings' : ''}`);
302
+ for (const c of s.clients.filter((c) => c.captureHook)) {
303
+ console.log(`Capture hooks: ${c.name} (${c.captureEvent}, ${c.captureRegistered ? 'registered' : 'not registered'})`);
304
+ }
244
305
  console.log(`Last extraction sweep: ${s.lastSweep || 'never'}`);
245
306
  console.log(`Pending upload queue: ${s.pendingCount} file(s)\n`);
246
307
  }
@@ -415,11 +476,21 @@ async function main() {
415
476
  }
416
477
  }
417
478
 
418
- if (require.main === module) {
419
- main().catch((err) => {
479
+ /** Run the CLI: used by require.main below AND by mcp-server.js delegation
480
+ * (LW-17: `npx auxilo-mcp setup` — the `auxilo` bin alias is unreachable via
481
+ * npx until the `auxilo` npm package name is claimed). */
482
+ function run() {
483
+ main().then(() => {
484
+ closeRl(); // an open readline interface keeps the process alive
485
+ }).catch((err) => {
486
+ closeRl();
420
487
  console.error(`auxilo: ${err.message}`);
421
488
  process.exit(1);
422
489
  });
423
490
  }
424
491
 
425
- module.exports = { parseFlags, resolveBaseUrl };
492
+ if (require.main === module) {
493
+ run();
494
+ }
495
+
496
+ module.exports = { parseFlags, resolveBaseUrl, run };