owpenwork 0.1.5 → 0.1.7
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/dist/cli.js +25 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { loginWhatsApp, unpairWhatsApp } from "./whatsapp.js";
|
|
|
11
11
|
const program = new Command();
|
|
12
12
|
program
|
|
13
13
|
.name("owpenbot")
|
|
14
|
-
.version("0.1.
|
|
14
|
+
.version("0.1.7")
|
|
15
15
|
.description("OpenCode WhatsApp + Telegram bridge")
|
|
16
16
|
.argument("[path]")
|
|
17
17
|
.option("--non-interactive", "Run setup defaults and exit", false)
|
|
@@ -279,16 +279,37 @@ program
|
|
|
279
279
|
program
|
|
280
280
|
.command("doctor")
|
|
281
281
|
.description("Diagnose common issues")
|
|
282
|
-
.
|
|
282
|
+
.option("--reset", "Reset owpenbot state", false)
|
|
283
|
+
.action(async (opts) => {
|
|
283
284
|
const config = loadConfig(process.env, { requireOpencode: false });
|
|
284
285
|
const authPath = `${config.whatsappAuthDir}/creds.json`;
|
|
285
286
|
if (!fs.existsSync(authPath)) {
|
|
286
|
-
console.log("WhatsApp not linked. Run:
|
|
287
|
+
console.log("WhatsApp not linked. Run: owpenwork whatsapp login");
|
|
287
288
|
}
|
|
288
289
|
else {
|
|
289
290
|
console.log("WhatsApp linked.");
|
|
290
291
|
}
|
|
291
|
-
console.log(
|
|
292
|
+
console.log(`OpenCode URL: ${config.opencodeUrl}`);
|
|
293
|
+
console.log("If replies fail, ensure the server is running.");
|
|
294
|
+
const resetRequested = Boolean(opts.reset);
|
|
295
|
+
if (!resetRequested && !process.stdin.isTTY)
|
|
296
|
+
return;
|
|
297
|
+
let confirmed = resetRequested;
|
|
298
|
+
if (!resetRequested) {
|
|
299
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
300
|
+
const answer = await rl.question("Reset owpenbot state (y/N)? ");
|
|
301
|
+
rl.close();
|
|
302
|
+
confirmed = answer.trim().toLowerCase() === "y";
|
|
303
|
+
}
|
|
304
|
+
if (!confirmed)
|
|
305
|
+
return;
|
|
306
|
+
const targets = [config.configPath, config.dbPath, config.whatsappAuthDir];
|
|
307
|
+
for (const target of targets) {
|
|
308
|
+
if (fs.existsSync(target)) {
|
|
309
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
console.log("Reset complete. Run: owpenwork setup");
|
|
292
313
|
});
|
|
293
314
|
program.parseAsync(process.argv).catch((error) => {
|
|
294
315
|
console.error(error);
|