owpenwork 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -10,6 +10,20 @@ One-command install (recommended):
10
10
  curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/owpenbot/install.sh | bash
11
11
  ```
12
12
 
13
+ Or install from npm:
14
+
15
+ ```bash
16
+ npm install -g owpenwork
17
+ ```
18
+
19
+ Quick run without install:
20
+
21
+ ```bash
22
+ npx owpenwork setup
23
+ npx owpenwork whatsapp login
24
+ npx owpenwork start
25
+ ```
26
+
13
27
  Then follow the printed next steps (run `owpenbot setup`, link WhatsApp, start the bridge).
14
28
 
15
29
  1) One-command setup (installs deps, builds, creates `.env` if missing):
@@ -32,27 +46,27 @@ Recommended:
32
46
  3) Run setup (writes `~/.owpenbot/owpenbot.json`):
33
47
 
34
48
  ```bash
35
- owpenbot setup
49
+ owpenwork setup
36
50
  ```
37
51
 
38
52
  4) Link WhatsApp (QR):
39
53
 
40
54
  ```bash
41
- owpenbot whatsapp login
55
+ owpenwork whatsapp login
42
56
  ```
43
57
 
44
58
  5) Start the bridge:
45
59
 
46
60
  ```bash
47
- owpenbot start
61
+ owpenwork start
48
62
  ```
49
63
 
50
64
  Owpenbot keeps the WhatsApp session alive once connected.
51
65
 
52
66
  6) Pair a user with the bot (only if DM policy is pairing):
53
67
 
54
- - Run `owpenbot pairing list` to view pending codes.
55
- - Approve a code: `owpenbot pairing approve <code>`.
68
+ - Run `owpenwork pairing list` to view pending codes.
69
+ - Approve a code: `owpenwork pairing approve <code>`.
56
70
  - The user can then message again to receive OpenCode replies.
57
71
 
58
72
  ## Usage Flows
@@ -61,8 +75,8 @@ Owpenbot keeps the WhatsApp session alive once connected.
61
75
 
62
76
  Use your own WhatsApp account as the bot and test from a second number you control.
63
77
 
64
- 1) Run `owpenbot setup` and choose “personal number.”
65
- 2) Run `owpenbot whatsapp login` to scan the QR.
78
+ 1) Run `owpenwork setup` and choose “personal number.”
79
+ 2) Run `owpenwork whatsapp login` to scan the QR.
66
80
  3) Message yourself or from a second number; your number is already allowlisted.
67
81
 
68
82
  Note: WhatsApp’s “message yourself” thread is not reliable for bot testing.
@@ -72,9 +86,9 @@ Note: WhatsApp’s “message yourself” thread is not reliable for bot testing
72
86
  Use a separate WhatsApp number as the bot account so it stays independent from your personal chat history.
73
87
 
74
88
  1) Create a new WhatsApp account for the dedicated number.
75
- 2) Run `owpenbot setup` and choose “dedicated number.”
76
- 3) Run `owpenbot whatsapp login` to scan the QR.
77
- 4) If DM policy is pairing, approve codes with `owpenbot pairing approve <code>`.
89
+ 2) Run `owpenwork setup` and choose “dedicated number.”
90
+ 3) Run `owpenwork whatsapp login` to scan the QR.
91
+ 4) If DM policy is pairing, approve codes with `owpenwork pairing approve <code>`.
78
92
 
79
93
  ## Telegram (Untested)
80
94
 
@@ -85,12 +99,12 @@ Telegram support is wired but not E2E tested yet. To try it:
85
99
  ## Commands
86
100
 
87
101
  ```bash
88
- owpenbot setup
89
- owpenbot whatsapp login
90
- owpenbot start
91
- owpenbot pairing list
92
- owpenbot pairing approve <code>
93
- owpenbot status
102
+ owpenwork setup
103
+ owpenwork whatsapp login
104
+ owpenwork start
105
+ owpenwork pairing list
106
+ owpenwork pairing approve <code>
107
+ owpenwork status
94
108
  ```
95
109
 
96
110
  ## Defaults
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import fs from "node:fs";
2
3
  import { createInterface } from "node:readline/promises";
3
4
  import { Command } from "commander";
package/install.sh CHANGED
@@ -5,6 +5,7 @@ OWPENBOT_REF="${OWPENBOT_REF:-dev}"
5
5
  OWPENBOT_REPO="${OWPENBOT_REPO:-https://github.com/different-ai/openwork.git}"
6
6
  OWPENBOT_INSTALL_DIR="${OWPENBOT_INSTALL_DIR:-$HOME/.owpenbot/openwork}"
7
7
  OWPENBOT_BIN_DIR="${OWPENBOT_BIN_DIR:-$HOME/.local/bin}"
8
+ OWPENBOT_INSTALL_METHOD="${OWPENBOT_INSTALL_METHOD:-npm}"
8
9
 
9
10
  usage() {
10
11
  cat <<'EOF'
@@ -15,6 +16,7 @@ Environment variables:
15
16
  OWPENBOT_REPO Git repo (default: https://github.com/different-ai/openwork.git)
16
17
  OWPENBOT_REF Git ref/branch (default: dev)
17
18
  OWPENBOT_BIN_DIR Bin directory for owpenbot shim (default: ~/.local/bin)
19
+ OWPENBOT_INSTALL_METHOD Install method: npm|git (default: npm)
18
20
 
19
21
  Example:
20
22
  OWPENBOT_INSTALL_DIR=~/owpenbot curl -fsSL https://raw.githubusercontent.com/different-ai/openwork/dev/packages/owpenbot/install.sh | bash
@@ -33,82 +35,87 @@ require_bin() {
33
35
  fi
34
36
  }
35
37
 
36
- require_bin git
37
38
  require_bin node
38
39
 
39
- if ! command -v pnpm >/dev/null 2>&1; then
40
- if command -v corepack >/dev/null 2>&1; then
41
- corepack enable >/dev/null 2>&1 || true
42
- corepack prepare pnpm@10.27.0 --activate
43
- else
44
- echo "pnpm is required. Install pnpm or enable corepack, then retry." >&2
45
- exit 1
40
+ if [[ "$OWPENBOT_INSTALL_METHOD" == "npm" ]]; then
41
+ echo "Installing owpenwork via npm..."
42
+ npm install -g owpenwork
43
+ else
44
+ require_bin git
45
+ if ! command -v pnpm >/dev/null 2>&1; then
46
+ if command -v corepack >/dev/null 2>&1; then
47
+ corepack enable >/dev/null 2>&1 || true
48
+ corepack prepare pnpm@10.27.0 --activate
49
+ else
50
+ echo "pnpm is required. Install pnpm or enable corepack, then retry." >&2
51
+ exit 1
52
+ fi
46
53
  fi
47
- fi
48
54
 
49
- if [[ -d "$OWPENBOT_INSTALL_DIR/.git" ]]; then
50
- echo "Updating owpenbot source in $OWPENBOT_INSTALL_DIR"
51
- git -C "$OWPENBOT_INSTALL_DIR" fetch origin --prune
52
- if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet "refs/remotes/origin/$OWPENBOT_REF"; then
53
- git -C "$OWPENBOT_INSTALL_DIR" checkout -B "$OWPENBOT_REF" "origin/$OWPENBOT_REF"
54
- git -C "$OWPENBOT_INSTALL_DIR" pull --ff-only origin "$OWPENBOT_REF"
55
+ if [[ -d "$OWPENBOT_INSTALL_DIR/.git" ]]; then
56
+ echo "Updating owpenbot source in $OWPENBOT_INSTALL_DIR"
57
+ git -C "$OWPENBOT_INSTALL_DIR" fetch origin --prune
58
+ if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet "refs/remotes/origin/$OWPENBOT_REF"; then
59
+ git -C "$OWPENBOT_INSTALL_DIR" checkout -B "$OWPENBOT_REF" "origin/$OWPENBOT_REF"
60
+ git -C "$OWPENBOT_INSTALL_DIR" pull --ff-only origin "$OWPENBOT_REF"
61
+ else
62
+ git -C "$OWPENBOT_INSTALL_DIR" checkout -f
63
+ git -C "$OWPENBOT_INSTALL_DIR" pull --ff-only
64
+ fi
55
65
  else
56
- git -C "$OWPENBOT_INSTALL_DIR" checkout -f
57
- git -C "$OWPENBOT_INSTALL_DIR" pull --ff-only
66
+ echo "Cloning owpenbot source to $OWPENBOT_INSTALL_DIR"
67
+ mkdir -p "$OWPENBOT_INSTALL_DIR"
68
+ git clone --depth 1 "$OWPENBOT_REPO" "$OWPENBOT_INSTALL_DIR"
69
+ if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet "refs/remotes/origin/$OWPENBOT_REF"; then
70
+ git -C "$OWPENBOT_INSTALL_DIR" checkout -B "$OWPENBOT_REF" "origin/$OWPENBOT_REF"
71
+ fi
58
72
  fi
59
- else
60
- echo "Cloning owpenbot source to $OWPENBOT_INSTALL_DIR"
61
- mkdir -p "$OWPENBOT_INSTALL_DIR"
62
- git clone --depth 1 "$OWPENBOT_REPO" "$OWPENBOT_INSTALL_DIR"
63
- if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet "refs/remotes/origin/$OWPENBOT_REF"; then
64
- git -C "$OWPENBOT_INSTALL_DIR" checkout -B "$OWPENBOT_REF" "origin/$OWPENBOT_REF"
65
- fi
66
- fi
67
73
 
68
- if [[ ! -d "$OWPENBOT_INSTALL_DIR/packages/owpenbot" ]]; then
69
- echo "owpenbot package not found on ref '$OWPENBOT_REF'. Trying dev/main..." >&2
70
- git -C "$OWPENBOT_INSTALL_DIR" fetch origin --prune
71
- if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet refs/remotes/origin/dev; then
72
- git -C "$OWPENBOT_INSTALL_DIR" checkout -B dev origin/dev
73
- elif git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet refs/remotes/origin/main; then
74
- git -C "$OWPENBOT_INSTALL_DIR" checkout -B main origin/main
74
+ if [[ ! -d "$OWPENBOT_INSTALL_DIR/packages/owpenbot" ]]; then
75
+ echo "owpenbot package not found on ref '$OWPENBOT_REF'. Trying dev/main..." >&2
76
+ git -C "$OWPENBOT_INSTALL_DIR" fetch origin --prune
77
+ if git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet refs/remotes/origin/dev; then
78
+ git -C "$OWPENBOT_INSTALL_DIR" checkout -B dev origin/dev
79
+ elif git -C "$OWPENBOT_INSTALL_DIR" show-ref --verify --quiet refs/remotes/origin/main; then
80
+ git -C "$OWPENBOT_INSTALL_DIR" checkout -B main origin/main
81
+ fi
75
82
  fi
76
- fi
77
83
 
78
- if [[ ! -d "$OWPENBOT_INSTALL_DIR/packages/owpenbot" ]]; then
79
- echo "owpenbot package not found after checkout. Aborting." >&2
80
- exit 1
81
- fi
84
+ if [[ ! -d "$OWPENBOT_INSTALL_DIR/packages/owpenbot" ]]; then
85
+ echo "owpenbot package not found after checkout. Aborting." >&2
86
+ exit 1
87
+ fi
82
88
 
83
- echo "Installing dependencies..."
84
- pnpm -C "$OWPENBOT_INSTALL_DIR" install
89
+ echo "Installing dependencies..."
90
+ pnpm -C "$OWPENBOT_INSTALL_DIR" install
85
91
 
86
- echo "Building owpenbot..."
87
- pnpm -C "$OWPENBOT_INSTALL_DIR/packages/owpenbot" build
92
+ echo "Building owpenbot..."
93
+ pnpm -C "$OWPENBOT_INSTALL_DIR/packages/owpenbot" build
88
94
 
89
- ENV_PATH="$OWPENBOT_INSTALL_DIR/packages/owpenbot/.env"
90
- ENV_EXAMPLE="$OWPENBOT_INSTALL_DIR/packages/owpenbot/.env.example"
91
- if [[ ! -f "$ENV_PATH" ]]; then
92
- if [[ -f "$ENV_EXAMPLE" ]]; then
93
- cp "$ENV_EXAMPLE" "$ENV_PATH"
94
- echo "Created $ENV_PATH"
95
- else
96
- cat <<EOF > "$ENV_PATH"
95
+ ENV_PATH="$OWPENBOT_INSTALL_DIR/packages/owpenbot/.env"
96
+ ENV_EXAMPLE="$OWPENBOT_INSTALL_DIR/packages/owpenbot/.env.example"
97
+ if [[ ! -f "$ENV_PATH" ]]; then
98
+ if [[ -f "$ENV_EXAMPLE" ]]; then
99
+ cp "$ENV_EXAMPLE" "$ENV_PATH"
100
+ echo "Created $ENV_PATH"
101
+ else
102
+ cat <<EOF > "$ENV_PATH"
97
103
  OPENCODE_URL=http://127.0.0.1:4096
98
104
  OPENCODE_DIRECTORY=
99
105
  WHATSAPP_AUTH_DIR=~/.owpenbot/whatsapp
100
106
  EOF
101
- echo "Created $ENV_PATH (minimal)"
107
+ echo "Created $ENV_PATH (minimal)"
108
+ fi
102
109
  fi
103
- fi
104
110
 
105
- mkdir -p "$OWPENBOT_BIN_DIR"
106
- cat <<EOF > "$OWPENBOT_BIN_DIR/owpenbot"
111
+ mkdir -p "$OWPENBOT_BIN_DIR"
112
+ cat <<EOF > "$OWPENBOT_BIN_DIR/owpenbot"
107
113
  #!/usr/bin/env bash
108
114
  set -euo pipefail
109
115
  node "$OWPENBOT_INSTALL_DIR/packages/owpenbot/dist/cli.js" "$@"
110
116
  EOF
111
- chmod 755 "$OWPENBOT_BIN_DIR/owpenbot"
117
+ chmod 755 "$OWPENBOT_BIN_DIR/owpenbot"
118
+ fi
112
119
 
113
120
  if ! echo ":$PATH:" | grep -q ":$OWPENBOT_BIN_DIR:"; then
114
121
  shell_name="$(basename "${SHELL:-}" 2>/dev/null || true)"
@@ -133,10 +140,9 @@ cat <<EOF
133
140
  Owpenbot installed.
134
141
 
135
142
  Next steps:
136
- 1) Edit $ENV_PATH (optional)
137
- 2) Run setup: owpenbot setup
138
- 3) Link WhatsApp: owpenbot whatsapp login
139
- 4) Start bridge: owpenbot start
143
+ 1) Run setup: owpenwork setup
144
+ 2) Link WhatsApp: owpenwork whatsapp login
145
+ 3) Start bridge: owpenwork start
140
146
 
141
147
  Owpenbot will print a QR code during login and keep the session alive.
142
148
  EOF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owpenwork",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "WhatsApp bridge for a running OpenCode server",
5
5
  "private": false,
6
6
  "type": "module",
@@ -11,7 +11,7 @@
11
11
  "license": "MIT",
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://github.com/different-ai/openwork.git",
14
+ "url": "git+https://github.com/different-ai/openwork.git",
15
15
  "directory": "packages/owpenbot"
16
16
  },
17
17
  "keywords": [