taskwindow 0.1.6 → 0.1.8

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
@@ -40,12 +40,15 @@ Or just keep `npx taskwindow` running in a terminal — both work.
40
40
 
41
41
  ### 2. Install the Chrome extension
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
+ ```bash
44
+ taskwindow install --extension
45
+ ```
46
+
47
+ That downloads the latest release, unpacks it, opens Chrome at
48
+ `chrome://extensions`, and prints the last 3 clicks (Developer mode →
49
+ Load unpacked → select the printed folder). Chrome's own policy requires
50
+ those clicks — no tool can do them for you. A Web Store listing (one-click
51
+ install + auto-updates) is planned.
49
52
 
50
53
  ### 3. Pair the extension with the daemon
51
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskwindow",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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,7 +5,10 @@ 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
+ import { createRequire } from "node:module";
10
+
11
+ const { version: VERSION } = createRequire(import.meta.url)("../package.json");
9
12
  import { registerClaude, registerCursor, registerOpenCode, unregisterAgents } from "./agents.js";
10
13
  import { createInterface } from "node:readline";
11
14
 
@@ -54,6 +57,10 @@ if (verb === "install") {
54
57
  if (!flags.includes("--no-service")) {
55
58
  installService(fileURLToPath(new URL("./index.js", import.meta.url)));
56
59
  }
60
+ const extFlag = flags.indexOf("--extension");
61
+ if (extFlag !== -1) {
62
+ installExtension(flags[extFlag + 1] && !flags[extFlag + 1].startsWith("--") ? flags[extFlag + 1] : null);
63
+ }
57
64
  if (flags.includes("--claude") || flags.includes("--cursor") || flags.includes("--opencode")) {
58
65
  if (flags.includes("--claude")) registerClaude(config);
59
66
  if (flags.includes("--cursor")) registerCursor(config);
@@ -76,7 +83,7 @@ const PAIR_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; // no 0/O/1/I
76
83
  const pairCode = Array.from(randomBytes(6))
77
84
  .map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
78
85
  .join("");
79
- const handleMcp = createMcpRequestHandler({ bridge });
86
+ const handleMcp = createMcpRequestHandler({ bridge, version: VERSION });
80
87
 
81
88
  // One-time pairing: the daemon prints a short code at startup; the extension
82
89
  // exchanges it for the real token via POST /pair (loopback-only). This defends
@@ -127,7 +134,7 @@ const server = http.createServer(async (req, res) => {
127
134
  if (url.pathname === "/health") {
128
135
  sendJson(res, 200, {
129
136
  ok: true,
130
- version: "0.1.0",
137
+ version: VERSION,
131
138
  extensionConnected: bridge.connected,
132
139
  port: config.port,
133
140
  });
package/src/mcp-http.js CHANGED
@@ -2,16 +2,14 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
3
3
  import { registerTools } from "./tools.js";
4
4
 
5
- const SERVER_INFO = { name: "taskwindow", version: "0.1.0" };
6
-
7
5
  /**
8
6
  * Stateless Streamable-HTTP MCP endpoint: every POST /mcp request gets a fresh
9
7
  * server+transport pair. No session state — any MCP client that speaks
10
8
  * Streamable HTTP can hit it.
11
9
  */
12
- export function createMcpRequestHandler({ bridge, logger = console }) {
10
+ export function createMcpRequestHandler({ bridge, version, logger = console }) {
13
11
  return async function handleMcpRequest(req, res, parsedBody) {
14
- const server = new McpServer(SERVER_INFO);
12
+ const server = new McpServer({ name: "taskwindow", version });
15
13
  registerTools(server, { bridge, logger });
16
14
  const transport = new StreamableHTTPServerTransport({
17
15
  sessionIdGenerator: undefined,
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 {