copyhub-cli 1.0.0 → 1.0.1

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/.env.example CHANGED
@@ -1,24 +1,24 @@
1
- # Copy to .env and fill in values. CopyHub reads .env when you run the CLI from the current directory.
2
- #
3
- # Google Cloud Console → APIs: enable "Google Sheets API" on the SAME project as your OAuth client ID
4
- # (if sync fails with project=..., open the Enable link in the log or Library → Google Sheets API → Enable).
5
- #
6
- # Spreadsheet ID + platform + overlay shortcut: set after copyhub login (web setup page),
7
- # or copyhub config ... --sheet-id <ID> and edit overlayPlatform / overlayAccelerator in ~/.copyhub/config.json
8
- # One tab per local calendar day: COPYHUB-YYYY-MM-DD (machine timezone).
9
- #
10
- # copyhub start opens the Electron overlay by default; set to 1 for clipboard + Sheet only:
11
- # COPYHUB_START_NO_OVERLAY=1
12
-
13
- COPYHUB_GOOGLE_CLIENT_ID=
14
- COPYHUB_GOOGLE_CLIENT_SECRET=
15
- COPYHUB_OAUTH_REDIRECT_PORT=19999
16
-
17
- # Overlay accelerator (optional): if set here it OVERRIDES the value saved after copyhub login (config overlayAccelerator).
18
- COPYHUB_OVERLAY_ACCELERATOR=
19
-
20
- # Set to 1 to NOT show the window when overlay starts (open via shortcut / tray only).
21
- # COPYHUB_OVERLAY_HIDE_ON_START=1
22
- # Set to 1 so the overlay does not close when clicking outside (default: click outside closes).
23
- # COPYHUB_OVERLAY_STICKY=1
24
- # Hide overlay icon from the taskbar: COPYHUB_OVERLAY_SKIP_TASKBAR=1
1
+ # Copy to .env and fill in values. CopyHub reads .env when you run the CLI from the current directory.
2
+ #
3
+ # Google Cloud Console → APIs: enable "Google Sheets API" on the SAME project as your OAuth client ID
4
+ # (if sync fails with project=..., open the Enable link in the log or Library → Google Sheets API → Enable).
5
+ #
6
+ # Spreadsheet ID + platform + overlay shortcut: set after copyhub login (web setup page),
7
+ # or copyhub config ... --sheet-id <ID> and edit overlayPlatform / overlayAccelerator in ~/.copyhub/config.json
8
+ # One tab per local calendar day: COPYHUB-YYYY-MM-DD (machine timezone).
9
+ #
10
+ # copyhub start opens the Electron overlay by default; set to 1 for clipboard + Sheet only:
11
+ # COPYHUB_START_NO_OVERLAY=1
12
+
13
+ COPYHUB_GOOGLE_CLIENT_ID=
14
+ COPYHUB_GOOGLE_CLIENT_SECRET=
15
+ COPYHUB_OAUTH_REDIRECT_PORT=19999
16
+
17
+ # Overlay accelerator (optional): if set here it OVERRIDES the value saved after copyhub login (config overlayAccelerator).
18
+ COPYHUB_OVERLAY_ACCELERATOR=
19
+
20
+ # Set to 1 to NOT show the window when overlay starts (open via shortcut / tray only).
21
+ # COPYHUB_OVERLAY_HIDE_ON_START=1
22
+ # Set to 1 so the overlay does not close when clicking outside (default: click outside closes).
23
+ # COPYHUB_OVERLAY_STICKY=1
24
+ # Hide overlay icon from the taskbar: COPYHUB_OVERLAY_SKIP_TASKBAR=1
package/README.md CHANGED
@@ -1,122 +1,154 @@
1
- # CopyHub
2
-
3
- CopyHub watches your **clipboard**, keeps a **local history** under `~/.copyhub/history.jsonl`, optionally syncs copies to **Google Sheets** (one tab per day), and shows an **Electron overlay** so you can browse recent clips quickly.
4
-
5
- Runs on **Windows**, **macOS**, and **Linux**.
6
-
7
- ## Requirements
8
-
9
- - **Node.js** ≥ 18
10
- - A **Google Cloud** project with:
11
- - **Google Sheets API** enabled for the *same* project as your OAuth client
12
- - **OAuth 2.0 Client** (Desktop app type works well for localhost redirect)
13
-
14
- ## Installation
15
-
16
- From this repository:
17
-
18
- ```bash
19
- npm install
20
- ```
21
-
22
- Link the CLI globally (optional):
23
-
24
- ```bash
25
- npm link
26
- ```
27
-
28
- Or run commands with:
29
-
30
- ```bash
31
- node src/cli.js <command>
32
- ```
33
-
34
- ## Google Cloud setup
35
-
36
- 1. Enable **[Google Sheets API](https://console.cloud.google.com/apis/library/sheets.googleapis.com)** on your OAuth project.
37
- 2. Create **OAuth 2.0 credentials** and add this **Authorized redirect URI** (adjust the port if you change it):
38
-
39
- ```text
40
- http://127.0.0.1:19999/oauth2callback
41
- ```
42
-
43
- 3. Copy `.env.example` to `.env` and set:
44
-
45
- - `COPYHUB_GOOGLE_CLIENT_ID`
46
- - `COPYHUB_GOOGLE_CLIENT_SECRET`
47
- - Optionally `COPYHUB_OAUTH_REDIRECT_PORT` (default **19999**)
48
-
49
- Alternatively, store credentials in `~/.copyhub/config.json` via:
50
-
51
- ```bash
52
- copyhub config --client-id "<ID>" --client-secret "<SECRET>" [--sheet-id "<SPREADSHEET_ID>"] [--redirect-port 19999]
53
- ```
54
-
55
- ## First run
56
-
57
- 1. **Login** (opens the browser for OAuth, then a setup page):
58
-
59
- ```bash
60
- copyhub login
61
- ```
62
-
63
- 2. On the setup page, enter your **Spreadsheet ID** (from the URL `…/d/<SPREADSHEET_ID>/edit`), choose **platform** (Windows / macOS / Linux) for shortcut hints, set the **overlay accelerator** if you want, and save.
64
-
65
- 3. **Start** the background watcher (clipboard + Sheets + overlay by default):
66
-
67
- ```bash
68
- copyhub start
69
- ```
70
-
71
- You can close the terminal; the process keeps running. Check with `copyhub list` and stop with `copyhub stop`.
72
-
73
- ### Useful flags and environment variables
74
-
75
- | Action | How |
76
- |--------|-----|
77
- | Run in terminal (Ctrl+C stops everything) | `copyhub start --foreground` |
78
- | No Google Sheets | `copyhub start --no-sheet` |
79
- | No Electron overlay | `copyhub start --no-overlay` or `COPYHUB_START_NO_OVERLAY=1` |
80
- | Override shortcut | `COPYHUB_OVERLAY_ACCELERATOR` in `.env` (overrides saved config) |
81
- | Overlay stays open when clicking outside | `COPYHUB_OVERLAY_STICKY=1` |
82
-
83
- Run `copyhub --help` or `copyhub commands` for the full command list.
84
-
85
- ## CLI overview
86
-
87
- | Command | Purpose |
88
- |---------|---------|
89
- | `copyhub config` | Save OAuth client ID/secret (and optional Sheet ID) to `~/.copyhub/config.json` |
90
- | `copyhub login` | OAuth flow + setup page (Sheet ID, platform, overlay shortcut) |
91
- | `copyhub logout` | Remove saved tokens |
92
- | `copyhub status` | OAuth, Sheet, tokens, overlay platform/shortcut, daemon state |
93
- | `copyhub start` | Background daemon: clipboard watcher + optional Sheets + overlay |
94
- | `copyhub list` / `copyhub ls` | Show whether the daemon PID is running |
95
- | `copyhub stop` | Stop daemon and overlay child |
96
- | `copyhub overlay` | Launch only the Electron overlay (no clipboard daemon) |
97
-
98
- ## Data locations
99
-
100
- Everything lives under **`~/.copyhub/`** (or `%USERPROFILE%\.copyhub` on Windows):
101
-
102
- | File | Contents |
103
- |------|----------|
104
- | `config.json` | OAuth credentials (if not only in `.env`), `googleSheetId`, `overlayAccelerator`, `overlayPlatform` |
105
- | `tokens.json` | OAuth refresh/access tokens |
106
- | `history.jsonl` | Local clipboard history (JSON Lines) |
107
- | `run.json` | Daemon PID and metadata (when using `copyhub start` without `--foreground`) |
108
-
109
- ## Google Sheets layout
110
-
111
- - Rows are appended when Sheet sync is enabled and you are logged in.
112
- - New tabs are created per **local calendar day**, named: **`COPYHUB-YYYY-MM-DD`**.
113
-
114
- ## Overlay (Electron)
115
-
116
- - Global shortcut defaults to **`CommandOrControl+Shift+H`** if nothing else is set (`Ctrl+Shift+H` on Windows/Linux, `⌘⇧H` on macOS-style wording in Electron).
117
- - **macOS**: you may need to grant **Accessibility** permissions for global shortcuts.
118
- - Some **`Control+Alt+…`** combinations do not register reliably on Windows; prefer alternatives suggested on the setup page.
119
-
120
- ## License
121
-
122
- MIT see `package.json`.
1
+ # CopyHub
2
+
3
+ CopyHub watches your **clipboard**, keeps a **local history** under `~/.copyhub/history.jsonl`, optionally syncs copies to **Google Sheets** (one tab per day), and shows an **Electron overlay** so you can browse recent clips quickly.
4
+
5
+ Runs on **Windows**, **macOS**, and **Linux**.
6
+
7
+ ## Requirements
8
+
9
+ - **Node.js** ≥ 18
10
+ - A **Google Cloud** project with:
11
+ - **Google Sheets API** enabled for the *same* project as your OAuth client
12
+ - **OAuth 2.0 Client** (Desktop app type works well for localhost redirect)
13
+
14
+ ## Installation
15
+
16
+ ### Install globally (npm)
17
+
18
+ After the package is published to npm:
19
+
20
+ ```bash
21
+ npm install -g copyhub-cli
22
+ ```
23
+
24
+ Then run `copyhub` from any directory (ensure Node.js ≥ 18 is on your `PATH`).
25
+
26
+ On Linux/macOS you may need elevated permissions or an npm prefix configured for your user; see [npm docs on global installs](https://docs.npmjs.com/cli/v10/commands/npm-install#global-installation).
27
+
28
+ ### From source (this repository)
29
+
30
+ From the repository root:
31
+
32
+ ```bash
33
+ npm install
34
+ ```
35
+
36
+ Register the CLI on your machine:
37
+
38
+ ```bash
39
+ npm link
40
+ ```
41
+
42
+ Or run without linking:
43
+
44
+ ```bash
45
+ node src/cli.js <command>
46
+ ```
47
+
48
+ ## Google Cloud setup
49
+
50
+ 1. Enable **[Google Sheets API](https://console.cloud.google.com/apis/library/sheets.googleapis.com)** on your OAuth project.
51
+ 2. Create **OAuth 2.0 credentials** and add this **Authorized redirect URI** (adjust the port if you change it):
52
+
53
+ ```text
54
+ http://127.0.0.1:19999/oauth2callback
55
+ ```
56
+
57
+ 3. Copy `.env.example` to `.env` and set:
58
+
59
+ - `COPYHUB_GOOGLE_CLIENT_ID`
60
+ - `COPYHUB_GOOGLE_CLIENT_SECRET`
61
+ - Optionally `COPYHUB_OAUTH_REDIRECT_PORT` (default **19999**)
62
+
63
+ Alternatively, store credentials in `~/.copyhub/config.json` via:
64
+
65
+ ```bash
66
+ copyhub config --client-id "<ID>" --client-secret "<SECRET>" [--sheet-id "<SPREADSHEET_ID>"] [--redirect-port 19999]
67
+ ```
68
+
69
+ ## First run
70
+
71
+ 1. **Login** (opens the browser for OAuth, then a setup page):
72
+
73
+ ```bash
74
+ copyhub login
75
+ ```
76
+
77
+ 2. On the setup page, enter your **Spreadsheet ID** (from the URL `…/d/<SPREADSHEET_ID>/edit`), choose **platform** (Windows / macOS / Linux) for shortcut hints, set the **overlay accelerator** if you want, and save.
78
+
79
+ 3. **Start** the background watcher (clipboard + Sheets + overlay by default):
80
+
81
+ ```bash
82
+ copyhub start
83
+ ```
84
+
85
+ You can close the terminal; the process keeps running. Check with `copyhub list` and stop with `copyhub stop`.
86
+
87
+ ### Useful flags and environment variables
88
+
89
+ | Action | How |
90
+ |--------|-----|
91
+ | Run in terminal (Ctrl+C stops everything) | `copyhub start --foreground` |
92
+ | No Google Sheets | `copyhub start --no-sheet` |
93
+ | No Electron overlay | `copyhub start --no-overlay` or `COPYHUB_START_NO_OVERLAY=1` |
94
+ | Override shortcut | `COPYHUB_OVERLAY_ACCELERATOR` in `.env` (overrides saved config) |
95
+ | Overlay stays open when clicking outside | `COPYHUB_OVERLAY_STICKY=1` |
96
+
97
+ Run `copyhub --help` or `copyhub commands` for built-in help.
98
+
99
+ ## CLI commands
100
+
101
+ Quick reference (same as `copyhub commands`):
102
+
103
+ ```bash
104
+ copyhub config --client-id "<ID>" --client-secret "<SECRET>" [--redirect-port 19999] [--sheet-id "<SPREADSHEET_ID>"]
105
+ copyhub login
106
+ copyhub logout
107
+ copyhub status
108
+ copyhub start [--no-sheet] [--no-overlay] [--foreground]
109
+ copyhub list # alias: copyhub ls
110
+ copyhub stop
111
+ copyhub overlay
112
+ copyhub commands # alias: copyhub cmds
113
+ copyhub --help
114
+ ```
115
+
116
+ | Command | What it does |
117
+ |---------|----------------|
118
+ | `copyhub config` | Writes OAuth client ID/secret (and optional Sheet ID, redirect port) to `~/.copyhub/config.json`. `--client-id` and `--client-secret` are required. |
119
+ | `copyhub login` | Opens browser for Google OAuth, then the setup page (spreadsheet ID, platform, overlay shortcut). |
120
+ | `copyhub logout` | Deletes saved OAuth tokens (`~/.copyhub/tokens.json`). |
121
+ | `copyhub status` | Prints OAuth config source, sheet target, tokens, overlay settings, and whether the background daemon is running. |
122
+ | `copyhub start` | Starts clipboard watcher + optional Sheets sync + Electron overlay in the **background** (closing the terminal does not stop it). Only one instance at a time. |
123
+ | `copyhub start --foreground` | Same as above but attached to the terminal; **Ctrl+C** stops everything. |
124
+ | `copyhub start --no-sheet` | Local history only; no Google Sheets writes. |
125
+ | `copyhub start --no-overlay` | No Electron window; use env `COPYHUB_START_NO_OVERLAY=1` for the same effect. |
126
+ | `copyhub list` / `copyhub ls` | Shows PID and start time if the daemon from `copyhub start` is running. |
127
+ | `copyhub stop` | Stops the background daemon and its overlay child process. |
128
+ | `copyhub overlay` | Runs **only** the Electron overlay (no clipboard daemon). Useful if you run the daemon separately or for debugging. |
129
+
130
+ ## Data locations
131
+
132
+ Everything lives under **`~/.copyhub/`** (or `%USERPROFILE%\.copyhub` on Windows):
133
+
134
+ | File | Contents |
135
+ |------|----------|
136
+ | `config.json` | OAuth credentials (if not only in `.env`), `googleSheetId`, `overlayAccelerator`, `overlayPlatform` |
137
+ | `tokens.json` | OAuth refresh/access tokens |
138
+ | `history.jsonl` | Local clipboard history (JSON Lines) |
139
+ | `run.json` | Daemon PID and metadata (when using `copyhub start` without `--foreground`) |
140
+
141
+ ## Google Sheets layout
142
+
143
+ - Rows are appended when Sheet sync is enabled and you are logged in.
144
+ - New tabs are created per **local calendar day**, named: **`COPYHUB-YYYY-MM-DD`**.
145
+
146
+ ## Overlay (Electron)
147
+
148
+ - Global shortcut defaults to **`CommandOrControl+Shift+H`** if nothing else is set (`Ctrl+Shift+H` on Windows/Linux, `⌘⇧H` on macOS-style wording in Electron).
149
+ - **macOS**: you may need to grant **Accessibility** permissions for global shortcuts.
150
+ - Some **`Control+Alt+…`** combinations do not register reliably on Windows; prefer alternatives suggested on the setup page.
151
+
152
+ ## License
153
+
154
+ MIT — see `package.json`.
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "copyhub-cli",
3
- "version": "1.0.0",
4
- "description": "CopyHub — clipboard, local history, Google Sheets sync (OAuth). Windows, macOS, Linux.",
5
- "type": "module",
6
- "bin": {
7
- "copyhub": "./src/cli.js"
8
- },
9
- "scripts": {
10
- "start": "node src/cli.js start",
11
- "login": "node src/cli.js login",
12
- "overlay": "node src/cli.js overlay"
13
- },
14
- "engines": {
15
- "node": ">=18"
16
- },
17
- "keywords": [
18
- "clipboard",
19
- "google-sheets",
20
- "oauth",
21
- "sync",
22
- "cli",
23
- "cross-platform",
24
- "windows",
25
- "linux",
26
- "macos"
27
- ],
28
- "files": ["src", "ui", ".env.example"],
29
- "license": "MIT",
30
- "dependencies": {
31
- "clipboardy": "^4.0.0",
32
- "dotenv": "^16.4.5",
33
- "electron": "^33.2.0",
34
- "commander": "^12.1.0",
35
- "google-auth-library": "^9.15.0",
36
- "googleapis": "^144.0.0",
37
- "open": "^10.1.0"
38
- }
39
- }
1
+ {
2
+ "name": "copyhub-cli",
3
+ "version": "1.0.1",
4
+ "description": "CopyHub — clipboard, local history, Google Sheets sync (OAuth). Windows, macOS, Linux.",
5
+ "type": "module",
6
+ "bin": {
7
+ "copyhub": "./src/cli.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node src/cli.js start",
11
+ "login": "node src/cli.js login",
12
+ "overlay": "node src/cli.js overlay"
13
+ },
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "keywords": [
18
+ "clipboard",
19
+ "google-sheets",
20
+ "oauth",
21
+ "sync",
22
+ "cli",
23
+ "cross-platform",
24
+ "windows",
25
+ "linux",
26
+ "macos"
27
+ ],
28
+ "files": ["src", "ui", ".env.example"],
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "clipboardy": "^4.0.0",
32
+ "dotenv": "^16.4.5",
33
+ "electron": "^33.2.0",
34
+ "commander": "^12.1.0",
35
+ "google-auth-library": "^9.15.0",
36
+ "googleapis": "^144.0.0",
37
+ "open": "^10.1.0"
38
+ }
39
+ }