owpenwork 0.1.14 → 0.1.15

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 CHANGED
@@ -10,7 +10,7 @@ import { createLogger } from "./logger.js";
10
10
  import { createClient } from "./opencode.js";
11
11
  import { truncateText } from "./text.js";
12
12
  import { loginWhatsApp, unpairWhatsApp } from "./whatsapp.js";
13
- const VERSION = "0.1.14";
13
+ const VERSION = "0.1.15";
14
14
  const STEP_OPTIONS = [
15
15
  {
16
16
  value: "config",
@@ -182,6 +182,19 @@ async function runSetupWizard(config, options) {
182
182
  allowFrom = allowFrom.length ? allowFrom : ["*"];
183
183
  }
184
184
  }
185
+ const currentWorkspace = config.configFile.opencodeDirectory ?? config.opencodeDirectory;
186
+ const keepDefault = unwrap(await confirm({
187
+ message: `Use this OpenCode workspace? (${currentWorkspace})`,
188
+ initialValue: true,
189
+ }));
190
+ if (!keepDefault) {
191
+ const workspace = unwrap(await text({
192
+ message: "OpenCode workspace path",
193
+ placeholder: "/path/to/workspace",
194
+ validate: (value) => (String(value ?? "").trim() ? undefined : "Path required"),
195
+ }));
196
+ next.opencodeDirectory = workspace.trim();
197
+ }
185
198
  next.channels = next.channels ?? {};
186
199
  next.channels.whatsapp = {
187
200
  dmPolicy,
package/dist/config.js CHANGED
@@ -118,16 +118,16 @@ function parseAllowlist(env) {
118
118
  }
119
119
  export function loadConfig(env = process.env, options = {}) {
120
120
  const requireOpencode = options.requireOpencode ?? false;
121
- const opencodeDirectory = env.OPENCODE_DIRECTORY?.trim() ?? "";
122
- if (!opencodeDirectory && requireOpencode) {
123
- throw new Error("OPENCODE_DIRECTORY is required");
124
- }
125
- const resolvedDirectory = opencodeDirectory || process.cwd();
126
121
  const dataDir = expandHome(env.OWPENBOT_DATA_DIR ?? "~/.owpenbot");
127
122
  const dbPath = expandHome(env.OWPENBOT_DB_PATH ?? path.join(dataDir, "owpenbot.db"));
128
123
  const logFile = expandHome(env.OWPENBOT_LOG_FILE ?? path.join(dataDir, "logs", "owpenbot.log"));
129
124
  const configPath = resolveConfigPath(dataDir, env);
130
125
  const { config: configFile } = readConfigFile(configPath);
126
+ const opencodeDirectory = env.OPENCODE_DIRECTORY?.trim() || configFile.opencodeDirectory || "";
127
+ if (!opencodeDirectory && requireOpencode) {
128
+ throw new Error("OPENCODE_DIRECTORY is required");
129
+ }
130
+ const resolvedDirectory = opencodeDirectory || process.cwd();
131
131
  const whatsappFile = configFile.channels?.whatsapp ?? {};
132
132
  const whatsappAccountId = env.WHATSAPP_ACCOUNT_ID?.trim() || "default";
133
133
  const accountAuthDir = whatsappFile.accounts?.[whatsappAccountId]?.authDir;
@@ -146,7 +146,7 @@ export function loadConfig(env = process.env, options = {}) {
146
146
  return {
147
147
  configPath,
148
148
  configFile,
149
- opencodeUrl: env.OPENCODE_URL?.trim() ?? "http://127.0.0.1:4096",
149
+ opencodeUrl: env.OPENCODE_URL?.trim() || configFile.opencodeUrl || "http://127.0.0.1:4096",
150
150
  opencodeDirectory: resolvedDirectory,
151
151
  opencodeUsername: env.OPENCODE_SERVER_USERNAME?.trim() || undefined,
152
152
  opencodePassword: env.OPENCODE_SERVER_PASSWORD?.trim() || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owpenwork",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "WhatsApp bridge for a running OpenCode server",
5
5
  "private": false,
6
6
  "type": "module",