clawfix 0.1.0 → 0.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/bin/clawfix.js +71 -9
- package/package.json +1 -1
package/bin/clawfix.js
CHANGED
|
@@ -15,7 +15,14 @@ import { createHash } from 'node:crypto';
|
|
|
15
15
|
|
|
16
16
|
// --- Config ---
|
|
17
17
|
const API_URL = process.env.CLAWFIX_API || 'https://clawfix.dev';
|
|
18
|
-
const VERSION = '0.
|
|
18
|
+
const VERSION = '0.2.0';
|
|
19
|
+
|
|
20
|
+
// --- Flags ---
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const DRY_RUN = args.includes('--dry-run') || args.includes('-n');
|
|
23
|
+
const SHOW_DATA = args.includes('--show-data') || args.includes('-d');
|
|
24
|
+
const AUTO_SEND = process.env.CLAWFIX_AUTO === '1' || args.includes('--yes') || args.includes('-y');
|
|
25
|
+
const SHOW_HELP = args.includes('--help') || args.includes('-h');
|
|
19
26
|
|
|
20
27
|
// --- Colors ---
|
|
21
28
|
const c = {
|
|
@@ -77,8 +84,41 @@ function sanitizeConfig(config) {
|
|
|
77
84
|
|
|
78
85
|
// --- Main ---
|
|
79
86
|
async function main() {
|
|
87
|
+
if (SHOW_HELP) {
|
|
88
|
+
console.log(`
|
|
89
|
+
🦞 ClawFix v${VERSION} — AI-Powered OpenClaw Diagnostic
|
|
90
|
+
|
|
91
|
+
Usage: npx clawfix [options]
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
--dry-run, -n Scan locally only — shows what would be collected, sends nothing
|
|
95
|
+
--show-data, -d Display the full diagnostic payload before asking to send
|
|
96
|
+
--yes, -y Skip confirmation prompt and send automatically
|
|
97
|
+
--help, -h Show this help message
|
|
98
|
+
|
|
99
|
+
Environment:
|
|
100
|
+
CLAWFIX_API Override API URL (default: https://clawfix.dev)
|
|
101
|
+
CLAWFIX_AUTO=1 Same as --yes
|
|
102
|
+
|
|
103
|
+
Security:
|
|
104
|
+
• All API keys, tokens, and passwords are automatically redacted
|
|
105
|
+
• Your hostname is SHA-256 hashed (only first 8 chars sent)
|
|
106
|
+
• No file contents are read (only existence checks)
|
|
107
|
+
• Nothing is sent without your explicit approval (unless --yes)
|
|
108
|
+
• Source code: https://github.com/arcaboteth/clawfix
|
|
109
|
+
|
|
110
|
+
Examples:
|
|
111
|
+
npx clawfix # Interactive scan + optional AI analysis
|
|
112
|
+
npx clawfix --dry-run # See what data would be collected (sends nothing)
|
|
113
|
+
npx clawfix --show-data # Show full payload before asking to send
|
|
114
|
+
npx clawfix --yes # Auto-send for CI/scripting
|
|
115
|
+
`);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
80
119
|
console.log('');
|
|
81
120
|
console.log(c.cyan(`🦞 ClawFix v${VERSION} — AI-Powered OpenClaw Diagnostic`));
|
|
121
|
+
if (DRY_RUN) console.log(c.yellow(' 🔍 DRY RUN MODE — nothing will be sent'));
|
|
82
122
|
console.log(c.cyan('━'.repeat(50)));
|
|
83
123
|
console.log('');
|
|
84
124
|
|
|
@@ -335,10 +375,32 @@ async function main() {
|
|
|
335
375
|
},
|
|
336
376
|
};
|
|
337
377
|
|
|
378
|
+
// --- Show collected data ---
|
|
379
|
+
if (DRY_RUN || SHOW_DATA) {
|
|
380
|
+
console.log('');
|
|
381
|
+
console.log(c.bold('📦 Data that would be sent:'));
|
|
382
|
+
console.log(c.cyan('━'.repeat(50)));
|
|
383
|
+
console.log(JSON.stringify(diagnostic, null, 2));
|
|
384
|
+
console.log(c.cyan('━'.repeat(50)));
|
|
385
|
+
console.log('');
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (DRY_RUN) {
|
|
389
|
+
console.log(c.yellow('🔍 Dry run complete — nothing was sent.'));
|
|
390
|
+
console.log('');
|
|
391
|
+
console.log('To send this data for AI analysis:');
|
|
392
|
+
console.log(c.cyan(' npx clawfix'));
|
|
393
|
+
console.log('');
|
|
394
|
+
console.log(c.cyan('🦞 ClawFix — made by Arca (arcabot.eth)'));
|
|
395
|
+
console.log(c.cyan(' https://clawfix.dev | https://x.com/arcaboteth'));
|
|
396
|
+
console.log('');
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
|
|
338
400
|
// --- Send for AI analysis ---
|
|
339
401
|
if (issues.length === 0) {
|
|
340
402
|
console.log(c.green('Your OpenClaw is looking good! No fixes needed.'));
|
|
341
|
-
console.log(`If you're still having issues,
|
|
403
|
+
console.log(`If you're still having issues, run with --show-data to see what would be collected.`);
|
|
342
404
|
console.log('');
|
|
343
405
|
console.log(c.cyan(`🦞 ClawFix — made by Arca (arcabot.eth)`));
|
|
344
406
|
console.log(c.cyan(` https://clawfix.dev | https://x.com/arcaboteth`));
|
|
@@ -347,13 +409,13 @@ async function main() {
|
|
|
347
409
|
}
|
|
348
410
|
|
|
349
411
|
console.log(c.bold('Want AI-powered fixes? Send this diagnostic for analysis.'));
|
|
350
|
-
console.log('
|
|
412
|
+
console.log('');
|
|
413
|
+
console.log(c.dim('Data sent: OS, versions, OpenClaw config (secrets redacted), error logs'));
|
|
414
|
+
console.log(c.dim('NOT sent: API keys, file contents, chat history, real hostname'));
|
|
415
|
+
console.log(c.dim('Inspect first: npx clawfix --dry-run'));
|
|
351
416
|
console.log('');
|
|
352
417
|
|
|
353
|
-
|
|
354
|
-
const autoSend = process.env.CLAWFIX_AUTO === '1' || process.argv.includes('--yes') || process.argv.includes('-y');
|
|
355
|
-
|
|
356
|
-
let shouldSend = autoSend;
|
|
418
|
+
let shouldSend = AUTO_SEND;
|
|
357
419
|
if (!shouldSend) {
|
|
358
420
|
const readline = await import('node:readline');
|
|
359
421
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -366,8 +428,8 @@ async function main() {
|
|
|
366
428
|
|
|
367
429
|
if (!shouldSend) {
|
|
368
430
|
console.log('');
|
|
369
|
-
console.log('No problem!
|
|
370
|
-
console.log(c.cyan(
|
|
431
|
+
console.log('No problem! Review data first with:');
|
|
432
|
+
console.log(c.cyan(' npx clawfix --dry-run'));
|
|
371
433
|
console.log('');
|
|
372
434
|
return;
|
|
373
435
|
}
|