taskwindow 0.1.7 → 0.1.9

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
@@ -12,40 +12,39 @@ MCP over HTTP.
12
12
 
13
13
  ## Setup (5 minutes)
14
14
 
15
- ### 1. Start the daemon
15
+ ### 1. Install and start the daemon
16
16
 
17
17
  Requires Node 18+.
18
18
 
19
19
  ```bash
20
- npx taskwindow
20
+ npm install -g taskwindow
21
+ taskwindow install
21
22
  ```
22
23
 
23
- You'll see:
24
+ That installs a login service (the daemon starts now and after every laptop
25
+ restart — no terminal needed) and prints:
24
26
 
25
27
  ```
26
- [taskwindow] daemon listening on http://127.0.0.1:9377
28
+ [taskwindow] login service installed (~/Library/LaunchAgents/com.clawnify.taskwindow.plist)
27
29
  [taskwindow] pairing code: A6LU5X — enter it in the TaskWindow extension options
28
- [taskwindow] claude code: claude mcp add taskwindow --transport http http://127.0.0.1:9377/mcp --header "Authorization: Bearer …"
29
30
  ```
30
31
 
31
- The daemon is what your agent talks to, so it needs to stay running.
32
- To make it survive laptop restarts (installs a login service):
32
+ Keep the pairing code for step 3. (Prefer running it by hand? `npx taskwindow`
33
+ in a terminal works too — it just won't survive a restart.)
33
34
 
34
- ```bash
35
- npm install -g taskwindow
36
- taskwindow install
37
- ```
35
+ ### 2. Install the Chrome extension
38
36
 
39
- Or just keep `npx taskwindow` running in a terminal — both work.
37
+ You already have the CLI — add the extension:
40
38
 
41
- ### 2. Install the Chrome extension
39
+ ```bash
40
+ taskwindow install --extension
41
+ ```
42
42
 
43
- 1. Download `TaskWindow-extension-*.zip` from the
44
- [latest release](https://github.com/clawnify/taskwindow/releases) and unzip it
45
- 2. Open `chrome://extensions`
46
- 3. Enable **Developer mode** (top right)
47
- 4. Click **Load unpacked** and select the unzipped folder
48
- 5. Click the TaskWindow icon in the toolbar
43
+ That downloads the latest release, unpacks it, opens Chrome at
44
+ `chrome://extensions`, and prints the last 3 clicks (Developer mode →
45
+ Load unpacked → select the printed folder). Chrome's own policy requires
46
+ those clicks — no tool can do them for you. A Web Store listing (one-click
47
+ install + auto-updates) is planned.
49
48
 
50
49
  ### 3. Pair the extension with the daemon
51
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskwindow",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "TaskWindow local daemon: bridges the TaskWindow Chrome extension to any MCP client over Streamable HTTP",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -5,13 +5,22 @@ import { fileURLToPath } from "node:url";
5
5
  import { loadConfig } from "./config.js";
6
6
  import { Bridge } from "./bridge.js";
7
7
  import { createMcpRequestHandler } from "./mcp-http.js";
8
- import { installService, uninstallService } from "./service.js";
8
+ import { installService, uninstallService, installExtension } from "./service.js";
9
9
  import { createRequire } from "node:module";
10
10
 
11
11
  const { version: VERSION } = createRequire(import.meta.url)("../package.json");
12
12
  import { registerClaude, registerCursor, registerOpenCode, unregisterAgents } from "./agents.js";
13
13
  import { createInterface } from "node:readline";
14
14
 
15
+ // One-time pairing: the daemon prints a short code at startup; the extension
16
+ // exchanges it for the real token via POST /pair (loopback-only). This defends
17
+ // the pairing endpoint against other local user accounts; a same-user process
18
+ // could read the token file directly, so the code adds no obstacle there.
19
+ const PAIR_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; // no 0/O/1/I
20
+ const pairCode = Array.from(randomBytes(6))
21
+ .map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
22
+ .join("");
23
+
15
24
  // `taskwindow install` manages the login service and — only with an explicit
16
25
  // per-agent flag — registers the MCP server in that agent.
17
26
  const args = process.argv.slice(2);
@@ -57,6 +66,10 @@ if (verb === "install") {
57
66
  if (!flags.includes("--no-service")) {
58
67
  installService(fileURLToPath(new URL("./index.js", import.meta.url)));
59
68
  }
69
+ const extFlag = flags.indexOf("--extension");
70
+ if (extFlag !== -1) {
71
+ installExtension(flags[extFlag + 1] && !flags[extFlag + 1].startsWith("--") ? flags[extFlag + 1] : null);
72
+ }
60
73
  if (flags.includes("--claude") || flags.includes("--cursor") || flags.includes("--opencode")) {
61
74
  if (flags.includes("--claude")) registerClaude(config);
62
75
  if (flags.includes("--cursor")) registerCursor(config);
@@ -75,10 +88,6 @@ if (verb === "uninstall") {
75
88
  const config = loadConfig();
76
89
  const bridge = new Bridge({ token: config.token });
77
90
 
78
- const PAIR_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; // no 0/O/1/I
79
- const pairCode = Array.from(randomBytes(6))
80
- .map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
81
- .join("");
82
91
  const handleMcp = createMcpRequestHandler({ bridge, version: VERSION });
83
92
 
84
93
  // One-time pairing: the daemon prints a short code at startup; the extension
package/src/service.js CHANGED
@@ -75,6 +75,53 @@ WantedBy=default.target
75
75
  console.log(`[taskwindow] run the daemon with: node ${daemonEntryPath}`);
76
76
  }
77
77
 
78
+ /**
79
+ * Extension onboarding: fetch (or unzip a given) release zip, open Chrome at
80
+ * chrome://extensions, and print the exact remaining clicks. Chrome blocks
81
+ * programmatic unpacked installs, so a human does the final 3 clicks — the
82
+ * command does everything else.
83
+ */
84
+ export function installExtension(zipPath) {
85
+ const extDir = join(homedir(), ".taskwindow", "extension");
86
+ const open = (u) => {
87
+ try {
88
+ execSync(`open -a "Google Chrome" "${u}"`);
89
+ return true;
90
+ } catch {
91
+ return false;
92
+ }
93
+ };
94
+
95
+ if (!zipPath) {
96
+ // No zip given: fetch the latest release asset from GitHub.
97
+ try {
98
+ const api = "https://api.github.com/repos/clawnify/taskwindow/releases/latest";
99
+ const release = JSON.parse(execSync(`curl -sL "${api}"`, { maxBuffer: 20e6 }).toString());
100
+ const asset = (release.assets || []).find((a) => a.name.startsWith("TaskWindow-extension-"));
101
+ if (!asset) throw new Error("no extension asset in the latest release");
102
+ zipPath = join(homedir(), ".taskwindow", asset.name);
103
+ execSync(`curl -sL -o "${zipPath}" "${asset.browser_download_url}"`);
104
+ console.log(`[taskwindow] downloaded ${asset.name}`);
105
+ } catch (err) {
106
+ console.error(`[taskwindow] couldn't download the extension zip (${err.message}).`);
107
+ console.error(`[taskwindow] download it from https://github.com/clawnify/taskwindow/releases and re-run with --extension <zip>`);
108
+ return;
109
+ }
110
+ }
111
+
112
+ mkdirSync(extDir, { recursive: true });
113
+ execSync(`unzip -oq "${zipPath}" -d "${extDir}"`);
114
+ console.log(`[taskwindow] extension unpacked to ${extDir}`);
115
+ if (open("chrome://extensions")) {
116
+ console.log("[taskwindow] opened chrome://extensions in Chrome — finish in 3 clicks:");
117
+ } else {
118
+ console.log("[taskwindow] open chrome://extensions in Chrome — finish in 3 clicks:");
119
+ }
120
+ console.log(" 1. turn on Developer mode (top right)");
121
+ console.log(` 2. click "Load unpacked" and select: ${extDir}`);
122
+ console.log(" 3. done — the extension pairs itself from here (options page if it asks)");
123
+ }
124
+
78
125
  export function uninstallService() {
79
126
  const system = platform();
80
127
  try {