dude-claude-plugin 2026.2.19 → 2026.2.20
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/.claude-plugin/plugin.json +1 -1
- package/bin/dude-claude.js +42 -27
- package/package.json +1 -1
- package/src/db-libsql.js +18 -4
package/bin/dude-claude.js
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
process.on('uncaughtException', (err) => {
|
|
4
|
+
console.error(`[dude] Fatal error: ${err.message}`);
|
|
5
|
+
process.exit(1);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
process.on('unhandledRejection', (err) => {
|
|
9
|
+
console.error(`[dude] Unhandled rejection: ${err?.message || err}`);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
});
|
|
2
12
|
|
|
3
13
|
const command = process.argv[2] || 'mcp';
|
|
4
14
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
try {
|
|
16
|
+
switch (command) {
|
|
17
|
+
case 'mcp': {
|
|
18
|
+
const { startServer } = await import('../src/server.js');
|
|
19
|
+
await startServer();
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'serve': {
|
|
23
|
+
const { startWebServer } = await import('../src/web.js');
|
|
24
|
+
await startWebServer();
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'auto-retrieve': {
|
|
28
|
+
await import('../hooks/auto-retrieve.js');
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case 'auto-persist': {
|
|
32
|
+
await import('../hooks/auto-persist.js');
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case 'auto-persist-plan': {
|
|
36
|
+
await import('../hooks/auto-persist-plan.js');
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
default:
|
|
40
|
+
console.error(`Usage: dude-claude [mcp|serve|auto-retrieve|auto-persist|auto-persist-plan]
|
|
30
41
|
|
|
31
42
|
Commands:
|
|
32
43
|
mcp Start the MCP stdio server (default)
|
|
@@ -34,5 +45,9 @@ Commands:
|
|
|
34
45
|
auto-retrieve Run the auto-retrieve hook (reads prompt from stdin)
|
|
35
46
|
auto-persist Run the auto-persist utility (reads classification JSON from stdin)
|
|
36
47
|
auto-persist-plan Run the auto-persist-plan utility (reads classification JSON from stdin)`);
|
|
37
|
-
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error(`[dude] Startup failed: ${err.message}`);
|
|
52
|
+
process.exit(1);
|
|
38
53
|
}
|
package/package.json
CHANGED
package/src/db-libsql.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createClient } from '@libsql/client';
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { appendFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
4
4
|
import { join, basename } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { DbAdapter } from './db-adapter.js';
|
|
@@ -36,17 +36,23 @@ export class LibsqlAdapter extends DbAdapter {
|
|
|
36
36
|
if (this._hasSyncConfig()) {
|
|
37
37
|
try {
|
|
38
38
|
this.db = this._createClient(); // tries sync-enabled client
|
|
39
|
+
await this._runSchema();
|
|
39
40
|
} catch (err) {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
// Close the bad client if it was created
|
|
42
|
+
if (this.db) try { this.db.close(); } catch {}
|
|
42
43
|
this._syncError = err.message;
|
|
44
|
+
this._logToFile(`Cloud sync failed: ${err.message}\n${err.stack}`);
|
|
45
|
+
console.error(`[dude] Cloud sync failed: ${err.message}`);
|
|
46
|
+
console.error('[dude] Falling back to local-only mode. Details in ~/.dude-claude/dude.log');
|
|
47
|
+
// Recreate with local-only client
|
|
43
48
|
this.db = this._createLocalOnlyClient();
|
|
49
|
+
await this._runSchema();
|
|
44
50
|
}
|
|
45
51
|
} else {
|
|
46
52
|
this.db = this._createLocalOnlyClient();
|
|
53
|
+
await this._runSchema();
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
await this._runSchema();
|
|
50
56
|
const projectName = this._detectProject();
|
|
51
57
|
this.currentProject = await this._upsertProject(projectName);
|
|
52
58
|
await this._migrateProjectNames(projectName);
|
|
@@ -66,6 +72,14 @@ export class LibsqlAdapter extends DbAdapter {
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
|
|
75
|
+
_logToFile(message) {
|
|
76
|
+
try {
|
|
77
|
+
const logPath = join(DATA_DIR, 'dude.log');
|
|
78
|
+
const timestamp = new Date().toISOString();
|
|
79
|
+
appendFileSync(logPath, `[${timestamp}] ${message}\n`);
|
|
80
|
+
} catch { /* never let logging crash the server */ }
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
_hasSyncConfig() {
|
|
70
84
|
return !!(this.config.syncUrl || process.env.DUDE_TURSO_URL);
|
|
71
85
|
}
|