taskwindow 0.1.10 → 0.1.11
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 +6 -3
- package/package.json +1 -1
- package/src/index.js +84 -17
- package/src/service.js +4 -1
package/README.md
CHANGED
|
@@ -32,6 +32,9 @@ restart — no terminal needed) and prints:
|
|
|
32
32
|
Keep the pairing code for step 3. (Prefer running it by hand? `npx taskwindow`
|
|
33
33
|
in a terminal works too — it just won't survive a restart.)
|
|
34
34
|
|
|
35
|
+
The installer also asks which coding agents should use TaskWindow. Choose one
|
|
36
|
+
or more, or choose **None** to set them up later in step 4.
|
|
37
|
+
|
|
35
38
|
### 2. Install the Chrome extension
|
|
36
39
|
|
|
37
40
|
You already have the CLI — add the extension:
|
|
@@ -42,9 +45,9 @@ taskwindow install --extension
|
|
|
42
45
|
|
|
43
46
|
That downloads the latest release, unpacks it, opens Chrome at
|
|
44
47
|
`chrome://extensions`, and prints the last 3 clicks (Developer mode →
|
|
45
|
-
Load unpacked → select the
|
|
46
|
-
those clicks — no tool can do them
|
|
47
|
-
install + auto-updates) is planned.
|
|
48
|
+
Load unpacked → select the visible `TaskWindow Extension` folder in your home
|
|
49
|
+
directory). Chrome's own policy requires those clicks — no tool can do them
|
|
50
|
+
for you. A Web Store listing (one-click install + auto-updates) is planned.
|
|
48
51
|
|
|
49
52
|
### 3. Pair the extension with the daemon
|
|
50
53
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,7 +10,7 @@ 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
|
-
import {
|
|
13
|
+
import { clearLine, cursorTo, emitKeypressEvents, moveCursor } from "node:readline";
|
|
14
14
|
|
|
15
15
|
// One-time pairing: the daemon prints a short code at startup; the extension
|
|
16
16
|
// exchanges it for the real token via POST /pair (loopback-only). This defends
|
|
@@ -21,37 +21,104 @@ const pairCode = Array.from(randomBytes(6))
|
|
|
21
21
|
.map((b) => PAIR_ALPHABET[b % PAIR_ALPHABET.length])
|
|
22
22
|
.join("");
|
|
23
23
|
|
|
24
|
-
// `taskwindow install` manages the login service and
|
|
25
|
-
//
|
|
24
|
+
// `taskwindow install` manages the login service and offers to register the
|
|
25
|
+
// MCP server with one or more coding agents. Component-only installs do not
|
|
26
|
+
// reopen the interactive picker.
|
|
26
27
|
const args = process.argv.slice(2);
|
|
27
28
|
const verb = args[0];
|
|
28
29
|
const flags = args.slice(1);
|
|
29
30
|
|
|
30
31
|
const AGENT_CHOICES = [
|
|
31
|
-
["
|
|
32
|
-
["
|
|
33
|
-
["
|
|
32
|
+
["Claude Code", registerClaude],
|
|
33
|
+
["Cursor", registerCursor],
|
|
34
|
+
["OpenCode", registerOpenCode],
|
|
34
35
|
];
|
|
35
36
|
|
|
37
|
+
function selectCodingAgents() {
|
|
38
|
+
const choices = [...AGENT_CHOICES.map(([label]) => label), "None (set up later)"];
|
|
39
|
+
const noneIndex = choices.length - 1;
|
|
40
|
+
const selected = new Set([noneIndex]);
|
|
41
|
+
let focused = 0;
|
|
42
|
+
let rendered = false;
|
|
43
|
+
|
|
44
|
+
emitKeypressEvents(process.stdin);
|
|
45
|
+
const wasRaw = process.stdin.isRaw;
|
|
46
|
+
const wasPaused = process.stdin.isPaused();
|
|
47
|
+
process.stdin.setRawMode(true);
|
|
48
|
+
process.stdin.resume();
|
|
49
|
+
|
|
50
|
+
const render = () => {
|
|
51
|
+
if (rendered) moveCursor(process.stdout, 0, -choices.length);
|
|
52
|
+
for (const [index, label] of choices.entries()) {
|
|
53
|
+
cursorTo(process.stdout, 0);
|
|
54
|
+
clearLine(process.stdout, 0);
|
|
55
|
+
const pointer = index === focused ? ">" : " ";
|
|
56
|
+
const checkbox = selected.has(index) ? "[x]" : "[ ]";
|
|
57
|
+
process.stdout.write(`${pointer} ${checkbox} ${label}\n`);
|
|
58
|
+
}
|
|
59
|
+
rendered = true;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const finish = () => {
|
|
64
|
+
process.stdin.off("keypress", onKeypress);
|
|
65
|
+
process.stdin.setRawMode(wasRaw);
|
|
66
|
+
if (wasPaused) process.stdin.pause();
|
|
67
|
+
resolve([...selected].filter((index) => index !== noneIndex));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onKeypress = (_character, key) => {
|
|
71
|
+
if (key?.ctrl && key.name === "c") {
|
|
72
|
+
process.stdin.setRawMode(wasRaw);
|
|
73
|
+
process.stdout.write("\n");
|
|
74
|
+
process.exit(130);
|
|
75
|
+
}
|
|
76
|
+
if (key?.name === "up") focused = (focused - 1 + choices.length) % choices.length;
|
|
77
|
+
else if (key?.name === "down") focused = (focused + 1) % choices.length;
|
|
78
|
+
else if (key?.name === "space") {
|
|
79
|
+
if (focused === noneIndex) {
|
|
80
|
+
selected.clear();
|
|
81
|
+
selected.add(noneIndex);
|
|
82
|
+
} else {
|
|
83
|
+
selected.delete(noneIndex);
|
|
84
|
+
if (selected.has(focused)) selected.delete(focused);
|
|
85
|
+
else selected.add(focused);
|
|
86
|
+
if (selected.size === 0) selected.add(noneIndex);
|
|
87
|
+
}
|
|
88
|
+
} else if (key?.name === "return" || key?.name === "enter") {
|
|
89
|
+
finish();
|
|
90
|
+
return;
|
|
91
|
+
} else {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
render();
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
process.stdin.on("keypress", onKeypress);
|
|
98
|
+
render();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
36
102
|
async function pickAndRegisterAgents(config) {
|
|
37
103
|
if (!process.stdin.isTTY) {
|
|
38
104
|
console.log("[taskwindow] non-interactive session — register agents with: taskwindow install --claude|--cursor|--opencode");
|
|
39
105
|
return;
|
|
40
106
|
}
|
|
41
107
|
console.log("Which coding agents should use TaskWindow?");
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
108
|
+
console.log("Use ↑/↓ to move, space to select, and enter to confirm.");
|
|
109
|
+
const picks = await selectCodingAgents();
|
|
110
|
+
if (picks.length === 0) {
|
|
111
|
+
console.log("[taskwindow] skipped coding-agent setup — add one later with taskwindow install --claude|--cursor|--opencode");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
46
114
|
const registered = [];
|
|
47
|
-
for (const
|
|
48
|
-
const
|
|
49
|
-
if (!choice) continue;
|
|
115
|
+
for (const index of picks) {
|
|
116
|
+
const [label, register] = AGENT_CHOICES[index];
|
|
50
117
|
try {
|
|
51
|
-
await
|
|
52
|
-
registered.push(
|
|
118
|
+
await register(config);
|
|
119
|
+
registered.push(label);
|
|
53
120
|
} catch (err) {
|
|
54
|
-
console.error(`[taskwindow] ${
|
|
121
|
+
console.error(`[taskwindow] ${label} registration failed:`, err.message);
|
|
55
122
|
}
|
|
56
123
|
}
|
|
57
124
|
console.log(
|
|
@@ -75,7 +142,7 @@ try {
|
|
|
75
142
|
if (flags.includes("--claude")) registerClaude(config);
|
|
76
143
|
if (flags.includes("--cursor")) registerCursor(config);
|
|
77
144
|
if (flags.includes("--opencode")) registerOpenCode(config);
|
|
78
|
-
} else {
|
|
145
|
+
} else if (extFlag === -1) {
|
|
79
146
|
await pickAndRegisterAgents(config);
|
|
80
147
|
}
|
|
81
148
|
process.exit(0);
|
package/src/service.js
CHANGED
|
@@ -106,7 +106,10 @@ WantedBy=default.target
|
|
|
106
106
|
* command does everything else.
|
|
107
107
|
*/
|
|
108
108
|
export function installExtension(zipPath) {
|
|
109
|
-
|
|
109
|
+
// This folder must remain visible in macOS's file picker: Chrome asks the
|
|
110
|
+
// user to select it after clicking "Load unpacked", and Finder hides paths
|
|
111
|
+
// whose names begin with a period by default.
|
|
112
|
+
const extDir = join(homedir(), "TaskWindow Extension");
|
|
110
113
|
const open = (u) => {
|
|
111
114
|
try {
|
|
112
115
|
execSync(`open -a "Google Chrome" "${u}"`);
|