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 +18 -19
- package/package.json +1 -1
- package/src/index.js +14 -5
- package/src/service.js +47 -0
package/README.md
CHANGED
|
@@ -12,40 +12,39 @@ MCP over HTTP.
|
|
|
12
12
|
|
|
13
13
|
## Setup (5 minutes)
|
|
14
14
|
|
|
15
|
-
### 1.
|
|
15
|
+
### 1. Install and start the daemon
|
|
16
16
|
|
|
17
17
|
Requires Node 18+.
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
npm install -g taskwindow
|
|
21
|
+
taskwindow install
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
|
|
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]
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
npm install -g taskwindow
|
|
36
|
-
taskwindow install
|
|
37
|
-
```
|
|
35
|
+
### 2. Install the Chrome extension
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
You already have the CLI — add the extension:
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
```bash
|
|
40
|
+
taskwindow install --extension
|
|
41
|
+
```
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
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 {
|