amicooked 0.1.2 → 0.1.4
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 +3 -2
- package/dist/cli/afterQuit.js +55 -0
- package/dist/cli/manage.js +9 -1
- package/dist/cli/setup.js +124 -49
- package/dist/cli.js +5 -3
- package/dist/clients/apps.js +111 -0
- package/dist/clients/claudeDesktop.js +0 -35
- package/dist/clients/codex.js +121 -0
- package/dist/skill.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -3
- package/skill/SKILL.md +10 -2
package/README.md
CHANGED
|
@@ -53,14 +53,15 @@ Presets for McMaster, Waterloo, Western, Queen's, Guelph, Laurier, TMU, uOttawa,
|
|
|
53
53
|
|
|
54
54
|
## ChatGPT
|
|
55
55
|
|
|
56
|
-
`amicooked setup --clients chatgpt`
|
|
56
|
+
`amicooked setup --clients chatgpt-desktop` connects the ChatGPT desktop app the same way as Claude Desktop: the app starts Am I Cooked on your computer, with no tunnel or extra account. Restart the app afterwards. It works with the ChatGPT desktop app that's built on Codex (and the Codex CLI), which reads `~/.codex/config.toml`.
|
|
57
|
+
|
|
58
|
+
ChatGPT on the web and on phones can't start programs on your computer, so they aren't supported yet. Neither is Claude on the web.
|
|
57
59
|
|
|
58
60
|
## Commands
|
|
59
61
|
|
|
60
62
|
```
|
|
61
63
|
amicooked setup pick your school, sign in, connect apps
|
|
62
64
|
amicooked login sign in again
|
|
63
|
-
amicooked pair new ChatGPT pairing code
|
|
64
65
|
amicooked status what's set up
|
|
65
66
|
amicooked uninstall disconnect apps (--purge deletes your login and settings)
|
|
66
67
|
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import { APPS, isRunning, open } from "../clients/apps.js";
|
|
3
|
+
import { claudeDesktopDir, installClaudeDesktop } from "../clients/claudeDesktop.js";
|
|
4
|
+
import { selfCommand } from "../clients/self.js";
|
|
5
|
+
// When setup runs inside Claude Desktop (an agent in it, say), it can't quit the app without ending that
|
|
6
|
+
// session, and Claude Desktop would save over our config when it quits anyway. So setup leaves this
|
|
7
|
+
// running in the background: it waits for the student to quit Claude, writes the config again, and
|
|
8
|
+
// reopens Claude, so one Cmd+Q finishes the job.
|
|
9
|
+
const POLL_MS = 2000;
|
|
10
|
+
const GIVE_UP_MS = 12 * 60 * 60 * 1000;
|
|
11
|
+
/** Starts the background helper, detached so it outlives setup. */
|
|
12
|
+
export function scheduleAfterQuit() {
|
|
13
|
+
try {
|
|
14
|
+
const self = selfCommand(["finish-after-quit"]);
|
|
15
|
+
const child = spawn(self.command, self.args, {
|
|
16
|
+
stdio: "ignore",
|
|
17
|
+
detached: true,
|
|
18
|
+
env: { ...process.env, ...self.env },
|
|
19
|
+
});
|
|
20
|
+
child.on("error", () => { });
|
|
21
|
+
child.unref();
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The hidden `finish-after-quit` command the helper runs. */
|
|
29
|
+
export async function finishAfterQuit(steps = defaultSteps()) {
|
|
30
|
+
if (!steps)
|
|
31
|
+
return 1;
|
|
32
|
+
const end = steps.now() + GIVE_UP_MS;
|
|
33
|
+
while (steps.running()) {
|
|
34
|
+
if (steps.now() > end)
|
|
35
|
+
return 1;
|
|
36
|
+
await steps.wait(POLL_MS);
|
|
37
|
+
}
|
|
38
|
+
// Give the app a moment to finish writing its own copy before ours goes on top
|
|
39
|
+
await steps.wait(1500);
|
|
40
|
+
steps.write();
|
|
41
|
+
steps.reopen();
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
function defaultSteps() {
|
|
45
|
+
const dir = claudeDesktopDir();
|
|
46
|
+
if (!dir)
|
|
47
|
+
return null;
|
|
48
|
+
return {
|
|
49
|
+
running: () => isRunning(APPS.claude),
|
|
50
|
+
write: () => installClaudeDesktop(dir, selfCommand(["mcp"])),
|
|
51
|
+
reopen: () => void open(APPS.claude),
|
|
52
|
+
wait: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
53
|
+
now: () => Date.now(),
|
|
54
|
+
};
|
|
55
|
+
}
|
package/dist/cli/manage.js
CHANGED
|
@@ -3,6 +3,7 @@ import { hasActiveSession, login } from "../auth.js";
|
|
|
3
3
|
import { claudeDesktopDir, SERVER_NAME, uninstallClaudeDesktop } from "../clients/claudeDesktop.js";
|
|
4
4
|
import { hasClaudeCode, skillPath, uninstallClaudeCode, uninstallSkill } from "../clients/claudeCode.js";
|
|
5
5
|
import { chatgptSteps, chatgptUrl, uninstallChatGPT } from "../clients/chatgpt.js";
|
|
6
|
+
import { codexConfigured, hasCodex, uninstallCodex, uninstallCodexSkill } from "../clients/codex.js";
|
|
6
7
|
import { OAuthStore } from "../remote/oauth.js";
|
|
7
8
|
import { client } from "../client.js";
|
|
8
9
|
import { getConfig, paths } from "../config.js";
|
|
@@ -49,6 +50,7 @@ export async function statusCommand(json) {
|
|
|
49
50
|
signedIn: hasActiveSession(),
|
|
50
51
|
claudeDesktop: claudeDesktopDir() ? (desktopConfigured() ? "set up" : "installed, not set up") : "not installed",
|
|
51
52
|
claudeCode: hasClaudeCode() ? (fs.existsSync(skillPath()) ? "set up" : "installed") : "not installed",
|
|
53
|
+
chatgptDesktop: hasCodex() ? (codexConfigured() ? "set up" : "installed, not set up") : "not installed",
|
|
52
54
|
chatgpt: chatgptUrl() ?? "not set up",
|
|
53
55
|
dataFolder: paths().home,
|
|
54
56
|
filesFolder: config.filesDir,
|
|
@@ -63,7 +65,10 @@ export async function statusCommand(json) {
|
|
|
63
65
|
console.log(` Signed in: ${status.signedIn ? "yes" : "no (signs in again when needed, or run `amicooked login`)"}`);
|
|
64
66
|
console.log(` Claude Desktop: ${status.claudeDesktop}`);
|
|
65
67
|
console.log(` Claude Code: ${status.claudeCode}`);
|
|
66
|
-
console.log(` ChatGPT:
|
|
68
|
+
console.log(` ChatGPT app: ${status.chatgptDesktop}`);
|
|
69
|
+
// ChatGPT on the web is hidden until the tunnel service exists; only show it where it's been set up
|
|
70
|
+
if (chatgptUrl())
|
|
71
|
+
console.log(` ChatGPT web: ${status.chatgpt}`);
|
|
67
72
|
console.log(` Data: ${status.dataFolder}`);
|
|
68
73
|
console.log(` Files: ${status.filesFolder}`);
|
|
69
74
|
return 0;
|
|
@@ -76,6 +81,9 @@ export async function uninstallCommand(purge) {
|
|
|
76
81
|
uninstallClaudeCode();
|
|
77
82
|
console.log(`Claude Code: removed (skill ${uninstallSkill()})`);
|
|
78
83
|
}
|
|
84
|
+
const codex = uninstallCodex();
|
|
85
|
+
if (codex !== "absent")
|
|
86
|
+
console.log(`ChatGPT desktop app: ${codex} (skill ${uninstallCodexSkill()})`);
|
|
79
87
|
if (uninstallChatGPT())
|
|
80
88
|
console.log("ChatGPT: background service stopped and disconnected");
|
|
81
89
|
if (purge) {
|
package/dist/cli/setup.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
2
4
|
import { hasActiveSession, login } from "../auth.js";
|
|
3
5
|
import { detectChannel } from "../browser.js";
|
|
4
|
-
import {
|
|
6
|
+
import { APPS, CLAUDE_CODE_DOWNLOAD, desktopAppsSupported, isRunning, isRunningInside, open, openUrl, quit } from "../clients/apps.js";
|
|
7
|
+
import { claudeDesktopDir, installClaudeDesktop, InvalidConfigError, manualSnippet } from "../clients/claudeDesktop.js";
|
|
8
|
+
import { scheduleAfterQuit } from "./afterQuit.js";
|
|
5
9
|
import { hasClaudeCode, installClaudeCode, installSkill } from "../clients/claudeCode.js";
|
|
6
10
|
import { chatgptSteps, installChatGPT } from "../clients/chatgpt.js";
|
|
11
|
+
import { codexEntryIs, codexSkillPath, hasCodex, installCodex, installCodexSkill } from "../clients/codex.js";
|
|
12
|
+
import { SKILL_MD } from "../skill.js";
|
|
7
13
|
import { selfCommand } from "../clients/self.js";
|
|
8
14
|
import { client } from "../client.js";
|
|
9
15
|
import { getConfig, writeConfig } from "../config.js";
|
|
10
16
|
import { listCourses } from "../courseResolver.js";
|
|
11
17
|
import { detectSchool, findPreset, PRESETS } from "../schools.js";
|
|
12
18
|
import { amICooked } from "../tools/cooked.js";
|
|
13
|
-
const
|
|
19
|
+
const PUBLIC_IDS = ["desktop", "code", "chatgpt-desktop"];
|
|
20
|
+
const CLIENT_IDS = [...PUBLIC_IDS, "chatgpt"];
|
|
21
|
+
const ALIASES = { codex: "chatgpt-desktop", "chatgpt-app": "chatgpt-desktop", "chatgpt-web": "chatgpt" };
|
|
14
22
|
/** Exit code for "the agent needs to ask the student something first". */
|
|
15
23
|
export const NEEDS_INPUT = 2;
|
|
16
24
|
class SetupStop extends Error {
|
|
@@ -66,13 +74,13 @@ async function chooseSchool(flag) {
|
|
|
66
74
|
}
|
|
67
75
|
async function chooseClients(flag, detected, yes) {
|
|
68
76
|
if (flag) {
|
|
69
|
-
const ids = flag.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
77
|
+
const ids = flag.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean).map((id) => ALIASES[id] ?? id);
|
|
70
78
|
const unknown = ids.filter((id) => !CLIENT_IDS.includes(id));
|
|
71
79
|
if (unknown.length)
|
|
72
|
-
throw new SetupStop(`Unknown app: ${unknown.join(", ")}. Use
|
|
73
|
-
return ids;
|
|
80
|
+
throw new SetupStop(`Unknown app: ${unknown.join(", ")}. Use ${PUBLIC_IDS.join(", ")}.`);
|
|
81
|
+
return [...new Set(ids)];
|
|
74
82
|
}
|
|
75
|
-
const defaults =
|
|
83
|
+
const defaults = PUBLIC_IDS.filter((id) => detected[id]);
|
|
76
84
|
if (yes || !interactive())
|
|
77
85
|
return defaults;
|
|
78
86
|
const chosen = await p.multiselect({
|
|
@@ -82,78 +90,151 @@ async function chooseClients(flag, detected, yes) {
|
|
|
82
90
|
options: [
|
|
83
91
|
{ value: "desktop", label: "Claude Desktop", hint: detected.desktop ? "found" : "not found" },
|
|
84
92
|
{ value: "code", label: "Claude Code", hint: detected.code ? "found" : "not found" },
|
|
85
|
-
{ value: "chatgpt", label: "ChatGPT", hint: "
|
|
93
|
+
{ value: "chatgpt-desktop", label: "ChatGPT desktop app", hint: detected["chatgpt-desktop"] ? "found" : "not found" },
|
|
86
94
|
],
|
|
87
95
|
});
|
|
88
96
|
if (p.isCancel(chosen))
|
|
89
97
|
throw new SetupStop("Setup cancelled.");
|
|
90
98
|
return chosen;
|
|
91
99
|
}
|
|
92
|
-
|
|
93
|
-
async function
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
const quitHow = () => (process.platform === "darwin" ? "with Cmd+Q" : "fully, from its icon by the clock if it has one");
|
|
101
|
+
async function missingApp(app, name, url) {
|
|
102
|
+
if (interactive()) {
|
|
103
|
+
const ok = await p.confirm({ message: `${name} isn't installed. Open its download page?` });
|
|
104
|
+
if (ok === true)
|
|
105
|
+
openUrl(url);
|
|
106
|
+
}
|
|
107
|
+
return { app, next: `install ${name} from ${url}, then run \`amicooked setup\` again.`, ready: false };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Connects a desktop app and leaves it open with the new config loaded, or says exactly what's left.
|
|
111
|
+
* `write` adds our server to the app's config; `current` says whether it's already there.
|
|
112
|
+
*/
|
|
113
|
+
async function connectDesktopApp(app, label, write, current) {
|
|
114
|
+
const ask = "Ask it: am I cooked?";
|
|
115
|
+
if (current()) {
|
|
116
|
+
// Already set up. Make sure it's open; no restart needed
|
|
117
|
+
if (isRunning(app))
|
|
118
|
+
return { app: label, next: `already set up. ${ask}`, ready: true };
|
|
119
|
+
return open(app)
|
|
120
|
+
? { app: label, next: `already set up, and opening now. ${ask}`, ready: true }
|
|
121
|
+
: { app: label, next: `already set up. Open ${app.name} and ask: am I cooked?`, ready: false };
|
|
122
|
+
}
|
|
123
|
+
let running = isRunning(app);
|
|
124
|
+
const inside = running && isRunningInside(app);
|
|
125
|
+
// An open app only loads the change after a restart. Offer one, unless setup is running inside that app
|
|
126
|
+
// (an agent there) or nobody's at the keyboard to say yes
|
|
127
|
+
if (running && !inside && interactive()) {
|
|
128
|
+
const ok = await p.confirm({ message: `${app.name} is open and needs a restart to pick this up. Restart it now?` });
|
|
129
|
+
if (ok === true)
|
|
130
|
+
running = !(await quit(app));
|
|
131
|
+
}
|
|
132
|
+
write();
|
|
133
|
+
if (running && app.overwritesOnQuit) {
|
|
134
|
+
// Quitting it would save its old config over ours, so a background helper waits for the quit, writes
|
|
135
|
+
// the config again and reopens the app
|
|
136
|
+
return scheduleAfterQuit()
|
|
137
|
+
? { app: label, next: `quit ${app.name} ${quitHow()}. Am I Cooked finishes setting it up and reopens it. Then ask it: am I cooked?`, ready: false }
|
|
138
|
+
: { app: label, next: `quit ${app.name} ${quitHow()}, then run \`amicooked setup\` again.`, ready: false };
|
|
139
|
+
}
|
|
140
|
+
if (running)
|
|
141
|
+
return { app: label, next: `quit ${app.name} ${quitHow()} and open it again. Then ask it: am I cooked?`, ready: false };
|
|
142
|
+
return open(app)
|
|
143
|
+
? { app: label, next: `set up, and opening now. ${ask}`, ready: true }
|
|
144
|
+
: { app: label, next: `set up. Open ${app.name} and ask: am I cooked?`, ready: false };
|
|
103
145
|
}
|
|
104
146
|
async function configureClients(clients) {
|
|
105
|
-
const
|
|
147
|
+
const outcomes = [];
|
|
106
148
|
const launch = selfCommand(["mcp"]);
|
|
107
149
|
if (clients.includes("desktop")) {
|
|
108
150
|
const dir = claudeDesktopDir();
|
|
109
|
-
if (!
|
|
110
|
-
|
|
151
|
+
if (!desktopAppsSupported()) {
|
|
152
|
+
outcomes.push({ app: "Claude Desktop", next: `isn't available on Linux. Use Claude Code instead: ${CLAUDE_CODE_DOWNLOAD}`, ready: false });
|
|
153
|
+
}
|
|
154
|
+
else if (!dir) {
|
|
155
|
+
outcomes.push(await missingApp("Claude Desktop", "Claude Desktop", APPS.claude.download));
|
|
111
156
|
}
|
|
112
157
|
else {
|
|
113
158
|
try {
|
|
114
|
-
|
|
115
|
-
const result = installClaudeDesktop(dir, launch);
|
|
116
|
-
if (state === "left_open" && result !== "unchanged") {
|
|
117
|
-
// Written, but the open app will save its own copy over it when it quits
|
|
118
|
-
p.log.warn("Claude Desktop is open, so it will undo this when it quits. Quit it, then run `amicooked setup --clients desktop`.");
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
p.log.success(`Claude Desktop: ${result === "unchanged" ? "already set up" : "set up"}`);
|
|
122
|
-
done.push(state === "closed" && openClaudeDesktop() ? "desktop-reopened" : "desktop");
|
|
123
|
-
}
|
|
159
|
+
outcomes.push(await connectDesktopApp(APPS.claude, "Claude Desktop", () => installClaudeDesktop(dir, launch), () => desktopHas(dir, launch)));
|
|
124
160
|
}
|
|
125
161
|
catch (error) {
|
|
126
162
|
if (!(error instanceof InvalidConfigError))
|
|
127
163
|
throw error;
|
|
128
164
|
p.log.warn(`${error.message}\nAdd this to it yourself:\n${manualSnippet(launch)}`);
|
|
165
|
+
outcomes.push({ app: "Claude Desktop", next: "add the snippet above to its config, then restart it.", ready: false });
|
|
129
166
|
}
|
|
130
167
|
}
|
|
131
168
|
}
|
|
132
169
|
if (clients.includes("code")) {
|
|
133
170
|
if (!hasClaudeCode()) {
|
|
134
|
-
|
|
171
|
+
outcomes.push(await missingApp("Claude Code", "Claude Code", CLAUDE_CODE_DOWNLOAD));
|
|
135
172
|
}
|
|
136
173
|
else {
|
|
137
174
|
installClaudeCode(launch);
|
|
138
175
|
installSkill();
|
|
139
|
-
|
|
140
|
-
|
|
176
|
+
// Claude Code loads servers when a session starts, so an agent already running needs a new one
|
|
177
|
+
outcomes.push({ app: "Claude Code", next: "set up. Start a new Claude Code session and ask: am I cooked?", ready: true });
|
|
141
178
|
}
|
|
142
179
|
}
|
|
143
|
-
if (clients.includes("chatgpt")) {
|
|
180
|
+
if (clients.includes("chatgpt-desktop")) {
|
|
181
|
+
if (!hasCodex() && !desktopAppsSupported()) {
|
|
182
|
+
outcomes.push({ app: "ChatGPT app", next: `isn't available on Linux. Use Claude Code instead: ${CLAUDE_CODE_DOWNLOAD}`, ready: false });
|
|
183
|
+
}
|
|
184
|
+
else if (!hasCodex()) {
|
|
185
|
+
outcomes.push(await missingApp("ChatGPT app", "the ChatGPT app", APPS.chatgpt.download));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// Runs on this computer like Claude Desktop does; no tunnel or domain involved
|
|
189
|
+
outcomes.push(await connectDesktopApp(APPS.chatgpt, "ChatGPT app", () => {
|
|
190
|
+
installCodex(launch);
|
|
191
|
+
installCodexSkill();
|
|
192
|
+
}, () => codexHas(launch)));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (clients.includes("chatgpt") && !process.env.AMICOOKED_TUNNEL_API) {
|
|
196
|
+
outcomes.push({ app: "ChatGPT on the web", next: "isn't available yet. Use the ChatGPT app instead: `--clients chatgpt-desktop`.", ready: false });
|
|
197
|
+
}
|
|
198
|
+
else if (clients.includes("chatgpt")) {
|
|
144
199
|
const spin = p.spinner();
|
|
145
200
|
spin.start("Setting up your private ChatGPT connection");
|
|
146
201
|
try {
|
|
147
202
|
const { url, pairingCode } = await installChatGPT();
|
|
148
203
|
spin.stop("ChatGPT: running in the background");
|
|
149
204
|
p.note(chatgptSteps(url, pairingCode), "Connect ChatGPT");
|
|
150
|
-
|
|
205
|
+
outcomes.push({ app: "ChatGPT on the web", next: "finish connecting with the steps above, then ask: am I cooked?", ready: false });
|
|
151
206
|
}
|
|
152
207
|
catch (error) {
|
|
153
208
|
spin.stop(`ChatGPT: ${error instanceof Error ? error.message : error}`);
|
|
154
209
|
}
|
|
155
210
|
}
|
|
156
|
-
return
|
|
211
|
+
return outcomes;
|
|
212
|
+
}
|
|
213
|
+
/** True when Claude Desktop's config already starts this exact install. */
|
|
214
|
+
function desktopHas(dir, launch) {
|
|
215
|
+
try {
|
|
216
|
+
const config = JSON.parse(fs.readFileSync(path.join(dir, "claude_desktop_config.json"), "utf8"));
|
|
217
|
+
const entry = { command: launch.command, args: launch.args, ...(launch.env ? { env: launch.env } : {}) };
|
|
218
|
+
return JSON.stringify(config.mcpServers?.amicooked) === JSON.stringify(entry);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/** True when the ChatGPT app's config already starts this exact install, and the skill is in place. */
|
|
225
|
+
function codexHas(launch) {
|
|
226
|
+
return codexEntryIs(launch) && fs.existsSync(codexSkillPath()) && fs.readFileSync(codexSkillPath(), "utf8") === SKILL_MD;
|
|
227
|
+
}
|
|
228
|
+
/** The end of setup: every app's next step, then one line saying whether they're done. */
|
|
229
|
+
export function finishMessage(outcomes) {
|
|
230
|
+
if (!outcomes.length) {
|
|
231
|
+
return {
|
|
232
|
+
steps: null,
|
|
233
|
+
outro: `Nothing was set up. Get Claude Desktop (${APPS.claude.download}) or the ChatGPT app (${APPS.chatgpt.download}), then run \`amicooked setup\` again.`,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const steps = outcomes.map((o) => `${o.app}: ${o.next}`).join("\n");
|
|
237
|
+
return { steps, outro: outcomes.some((o) => o.ready) ? "You're set." : "Almost there. Do the step above." };
|
|
157
238
|
}
|
|
158
239
|
async function firstRoast() {
|
|
159
240
|
const spin = p.spinner();
|
|
@@ -187,20 +268,14 @@ export async function setup(options) {
|
|
|
187
268
|
const courses = await listCourses();
|
|
188
269
|
p.log.success(`Signed in${me.FirstName ? ` as ${me.FirstName}` : ""}. Found ${courses.length} course${courses.length === 1 ? "" : "s"}.`);
|
|
189
270
|
}
|
|
190
|
-
const detected = { desktop: Boolean(claudeDesktopDir()), code: hasClaudeCode(), chatgpt: false };
|
|
191
|
-
const
|
|
271
|
+
const detected = { desktop: Boolean(claudeDesktopDir()), code: hasClaudeCode(), "chatgpt-desktop": hasCodex(), chatgpt: false };
|
|
272
|
+
const outcomes = await configureClients(await chooseClients(options.clients, detected, Boolean(options.yes)));
|
|
192
273
|
if (options.login !== false)
|
|
193
274
|
await firstRoast();
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
: done.includes("code")
|
|
199
|
-
? "Start Claude Code and ask: am I cooked?"
|
|
200
|
-
: done.includes("chatgpt")
|
|
201
|
-
? "Finish connecting in ChatGPT, then ask: am I cooked?"
|
|
202
|
-
: "Run `amicooked setup` again once you've installed Claude Desktop, Claude Code or ChatGPT.";
|
|
203
|
-
p.outro(next);
|
|
275
|
+
const { steps, outro } = finishMessage(outcomes);
|
|
276
|
+
if (steps)
|
|
277
|
+
p.note(steps, "Next");
|
|
278
|
+
p.outro(outro);
|
|
204
279
|
return 0;
|
|
205
280
|
}
|
|
206
281
|
catch (error) {
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { parseArgs } from "util";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { loginCommand, pairCommand, statusCommand, uninstallCommand } from "./cli/manage.js";
|
|
5
|
+
import { finishAfterQuit } from "./cli/afterQuit.js";
|
|
5
6
|
import { serveCommand } from "./cli/serve.js";
|
|
6
7
|
import { setup } from "./cli/setup.js";
|
|
7
8
|
import { serverInstructions } from "./instructions.js";
|
|
@@ -13,14 +14,12 @@ Usage: amicooked <command>
|
|
|
13
14
|
|
|
14
15
|
setup Pick your school, sign in, and connect your AI apps
|
|
15
16
|
--school <id|url> e.g. mcmaster, or the URL you log in through
|
|
16
|
-
--clients <list> desktop,code,chatgpt
|
|
17
|
+
--clients <list> desktop,code,chatgpt-desktop
|
|
17
18
|
--yes accept the detected apps without asking
|
|
18
19
|
login Sign in to your school again
|
|
19
|
-
pair Get a new code for connecting ChatGPT
|
|
20
20
|
status Show what's set up (--json for machines)
|
|
21
21
|
uninstall Disconnect your AI apps (--purge also deletes your login and settings)
|
|
22
22
|
mcp Run the MCP server over stdio (AI apps run this for you)
|
|
23
|
-
serve Run the ChatGPT server (the background service runs this for you)
|
|
24
23
|
`;
|
|
25
24
|
async function runMcp() {
|
|
26
25
|
// stdout carries the protocol; a library logging there would corrupt it
|
|
@@ -67,6 +66,9 @@ async function main(argv) {
|
|
|
67
66
|
return serveCommand({ quick: values.quick, local: values.local, port: values.port ? Number(values.port) : undefined });
|
|
68
67
|
case "status":
|
|
69
68
|
return statusCommand(Boolean(values.json));
|
|
69
|
+
case "finish-after-quit":
|
|
70
|
+
// Hidden: setup starts this in the background when it can't restart Claude Desktop itself
|
|
71
|
+
return finishAfterQuit();
|
|
70
72
|
case "uninstall":
|
|
71
73
|
return uninstallCommand(Boolean(values.purge));
|
|
72
74
|
default:
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "child_process";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
export const APPS = {
|
|
5
|
+
claude: {
|
|
6
|
+
id: "claude",
|
|
7
|
+
name: "Claude Desktop",
|
|
8
|
+
download: "https://claude.ai/download",
|
|
9
|
+
macName: "Claude",
|
|
10
|
+
// Claude Code ships a lowercase claude.app inside Claude's support folder; only the real app counts
|
|
11
|
+
macExe: /\/Claude\.app\/Contents\/MacOS\/Claude$/m,
|
|
12
|
+
winProcess: "Claude.exe",
|
|
13
|
+
winExe: (env) => (env.LOCALAPPDATA ? path.join(env.LOCALAPPDATA, "AnthropicClaude", "claude.exe") : null),
|
|
14
|
+
overwritesOnQuit: true,
|
|
15
|
+
},
|
|
16
|
+
chatgpt: {
|
|
17
|
+
id: "chatgpt",
|
|
18
|
+
name: "the ChatGPT app",
|
|
19
|
+
download: "https://chatgpt.com/download",
|
|
20
|
+
macName: "ChatGPT",
|
|
21
|
+
macExe: /\/ChatGPT\.app\/Contents\/MacOS\/ChatGPT$/m,
|
|
22
|
+
winProcess: "ChatGPT.exe",
|
|
23
|
+
// The Windows app comes from the Microsoft Store, which has no fixed path to launch
|
|
24
|
+
winExe: () => null,
|
|
25
|
+
overwritesOnQuit: false,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const CLAUDE_CODE_DOWNLOAD = "https://code.claude.com/docs/en/overview";
|
|
29
|
+
/** Desktop apps exist for macOS and Windows only. */
|
|
30
|
+
export const desktopAppsSupported = (platform = process.platform) => platform === "darwin" || platform === "win32";
|
|
31
|
+
const run = (command, args) => {
|
|
32
|
+
const r = spawnSync(command, args, { encoding: "utf8", timeout: 10000 });
|
|
33
|
+
return { status: r.error ? null : r.status, stdout: r.stdout ?? "" };
|
|
34
|
+
};
|
|
35
|
+
const host = () => ({ platform: process.platform, run, env: process.env });
|
|
36
|
+
export function isRunning(app, h = host()) {
|
|
37
|
+
// ps, not pgrep: pgrep skips its own ancestors, so it misses the app when setup runs from inside it
|
|
38
|
+
if (h.platform === "darwin")
|
|
39
|
+
return app.macExe.test(h.run("ps", ["-axo", "comm="]).stdout);
|
|
40
|
+
if (h.platform === "win32") {
|
|
41
|
+
return h.run("tasklist", ["/FI", `IMAGENAME eq ${app.winProcess}`, "/NH"]).stdout.toLowerCase().includes(app.winProcess.toLowerCase());
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* True when this process was started by the app, e.g. an agent in Claude Desktop running setup.
|
|
47
|
+
* Quitting that app would end the very session asking for it, so setup must not.
|
|
48
|
+
*/
|
|
49
|
+
export function isRunningInside(app, h = host(), pid = process.pid) {
|
|
50
|
+
if (h.platform !== "darwin")
|
|
51
|
+
return false;
|
|
52
|
+
const table = new Map();
|
|
53
|
+
for (const line of h.run("ps", ["-axo", "pid=,ppid=,comm="]).stdout.split("\n")) {
|
|
54
|
+
const m = line.match(/^\s*(\d+)\s+(\d+)\s+(.*)$/);
|
|
55
|
+
if (m)
|
|
56
|
+
table.set(Number(m[1]), { ppid: Number(m[2]), comm: m[3] });
|
|
57
|
+
}
|
|
58
|
+
for (let p = pid, hops = 0; p > 1 && hops < 64; hops++) {
|
|
59
|
+
const row = table.get(p);
|
|
60
|
+
if (!row)
|
|
61
|
+
return false;
|
|
62
|
+
if (app.macExe.test(row.comm))
|
|
63
|
+
return true;
|
|
64
|
+
p = row.ppid;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
/** Asks the app to quit and waits until it's gone. False if it's still open (unsaved work, a dialog). */
|
|
69
|
+
export async function quit(app, h = host(), waitMs = 15000) {
|
|
70
|
+
if (h.platform === "darwin")
|
|
71
|
+
h.run("osascript", ["-e", `tell application "${app.macName}" to quit`]);
|
|
72
|
+
else if (h.platform === "win32")
|
|
73
|
+
h.run("taskkill", ["/IM", app.winProcess]);
|
|
74
|
+
else
|
|
75
|
+
return false;
|
|
76
|
+
for (const end = Date.now() + waitMs; Date.now() < end;) {
|
|
77
|
+
if (!isRunning(app, h))
|
|
78
|
+
return true;
|
|
79
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
80
|
+
}
|
|
81
|
+
return !isRunning(app, h);
|
|
82
|
+
}
|
|
83
|
+
/** Opens the app. False when there's no reliable way to on this computer; then the student opens it. */
|
|
84
|
+
export function open(app, h = host(), launch = detachedLaunch) {
|
|
85
|
+
if (h.platform === "darwin")
|
|
86
|
+
return launch("open", ["-a", app.macName]);
|
|
87
|
+
if (h.platform === "win32") {
|
|
88
|
+
const exe = app.winExe(h.env);
|
|
89
|
+
return exe !== null && fs.existsSync(exe) && launch(exe, []);
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
/** Opens a web page in the default browser. */
|
|
94
|
+
export function openUrl(url, platform = process.platform, launch = detachedLaunch) {
|
|
95
|
+
if (platform === "darwin")
|
|
96
|
+
return launch("open", [url]);
|
|
97
|
+
if (platform === "win32")
|
|
98
|
+
return launch("cmd", ["/c", "start", "", url]);
|
|
99
|
+
return launch("xdg-open", [url]);
|
|
100
|
+
}
|
|
101
|
+
function detachedLaunch(command, args) {
|
|
102
|
+
try {
|
|
103
|
+
const child = spawn(command, args, { stdio: "ignore", detached: true });
|
|
104
|
+
child.on("error", () => { });
|
|
105
|
+
child.unref();
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn, spawnSync } from "child_process";
|
|
2
1
|
import * as fs from "fs";
|
|
3
2
|
import * as os from "os";
|
|
4
3
|
import * as path from "path";
|
|
@@ -82,37 +81,3 @@ export function manualSnippet(launch) {
|
|
|
82
81
|
const entry = { command: launch.command, args: launch.args, ...(launch.env ? { env: launch.env } : {}) };
|
|
83
82
|
return JSON.stringify({ mcpServers: { [SERVER_NAME]: entry } }, null, 2);
|
|
84
83
|
}
|
|
85
|
-
const probe = (command, args) => {
|
|
86
|
-
const r = spawnSync(command, args, { encoding: "utf8", timeout: 10000 });
|
|
87
|
-
return { status: r.error ? null : r.status, stdout: r.stdout ?? "" };
|
|
88
|
-
};
|
|
89
|
-
export function isClaudeDesktopRunning(platform = process.platform, run = probe) {
|
|
90
|
-
// ps, not pgrep: pgrep skips its own ancestors, so it misses the app when setup runs from inside it
|
|
91
|
-
if (platform === "darwin")
|
|
92
|
-
return /\/Claude\.app\/Contents\/MacOS\/Claude$/m.test(run("ps", ["-axo", "comm="]).stdout);
|
|
93
|
-
if (platform === "win32")
|
|
94
|
-
return /claude\.exe/i.test(run("tasklist", ["/FI", "IMAGENAME eq Claude.exe", "/NH"]).stdout);
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
/** Asks the app to quit (never forces it) and waits until it's gone. False if it's still open. */
|
|
98
|
-
export async function quitClaudeDesktop(platform = process.platform, run = probe, waitMs = 15000) {
|
|
99
|
-
if (platform === "darwin")
|
|
100
|
-
run("osascript", ["-e", 'tell application "Claude" to quit']);
|
|
101
|
-
else if (platform === "win32")
|
|
102
|
-
run("taskkill", ["/IM", "Claude.exe"]);
|
|
103
|
-
else
|
|
104
|
-
return false;
|
|
105
|
-
for (const end = Date.now() + waitMs; Date.now() < end;) {
|
|
106
|
-
if (!isClaudeDesktopRunning(platform, run))
|
|
107
|
-
return true;
|
|
108
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
109
|
-
}
|
|
110
|
-
return !isClaudeDesktopRunning(platform, run);
|
|
111
|
-
}
|
|
112
|
-
/** Opens the app again. Only macOS has a reliable way to find it; elsewhere the student opens it. */
|
|
113
|
-
export function openClaudeDesktop(platform = process.platform) {
|
|
114
|
-
if (platform !== "darwin")
|
|
115
|
-
return false;
|
|
116
|
-
spawn("open", ["-a", "Claude"], { stdio: "ignore", detached: true }).unref();
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { spawnSync } from "child_process";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { SKILL_MD } from "../skill.js";
|
|
6
|
+
import { SERVER_NAME } from "./claudeDesktop.js";
|
|
7
|
+
const currentEnv = () => ({ platform: process.platform, home: os.homedir(), codexHome: process.env.CODEX_HOME });
|
|
8
|
+
export const codexHome = (env = currentEnv()) => env.codexHome || path.join(env.home, ".codex");
|
|
9
|
+
export const codexConfigPath = (env = currentEnv()) => path.join(codexHome(env), "config.toml");
|
|
10
|
+
/** macOS app bundles that are the Codex-based desktop app, under either name. */
|
|
11
|
+
const MAC_APPS = ["/Applications/ChatGPT.app", "/Applications/Codex.app"];
|
|
12
|
+
function isCodexBundle(app) {
|
|
13
|
+
const plist = path.join(app, "Contents", "Info.plist");
|
|
14
|
+
if (!fs.existsSync(plist))
|
|
15
|
+
return false;
|
|
16
|
+
const id = spawnSync("/usr/libexec/PlistBuddy", ["-c", "Print :CFBundleIdentifier", plist], { encoding: "utf8" });
|
|
17
|
+
return id.status === 0 && id.stdout.trim() === "com.openai.codex";
|
|
18
|
+
}
|
|
19
|
+
/** True when the ChatGPT desktop app (or Codex) is on this computer. */
|
|
20
|
+
export function hasCodex(env = currentEnv(), hasMacApp = () => MAC_APPS.some(isCodexBundle)) {
|
|
21
|
+
if (fs.existsSync(codexHome(env)))
|
|
22
|
+
return true;
|
|
23
|
+
return env.platform === "darwin" && hasMacApp();
|
|
24
|
+
}
|
|
25
|
+
// ---- config.toml, edited as text so every other setting stays byte for byte ----
|
|
26
|
+
const TABLE = `mcp_servers.${SERVER_NAME}`;
|
|
27
|
+
const header = (line) => line.match(/^\s*\[\s*([^\]]+?)\s*\]\s*(#.*)?$/)?.[1] ?? null;
|
|
28
|
+
/** Splits the file into our table (and its sub-tables, like `.env`) and everything else. */
|
|
29
|
+
function splitOurTable(text) {
|
|
30
|
+
const kept = [];
|
|
31
|
+
const ours = [];
|
|
32
|
+
// Comments and blank lines after our table usually belong to the table that follows, so they
|
|
33
|
+
// wait here until we know which side they're on
|
|
34
|
+
let pending = [];
|
|
35
|
+
let inOurs = false;
|
|
36
|
+
for (const line of text.split("\n")) {
|
|
37
|
+
const name = header(line);
|
|
38
|
+
if (name !== null) {
|
|
39
|
+
kept.push(...pending);
|
|
40
|
+
pending = [];
|
|
41
|
+
inOurs = name === TABLE || name.startsWith(`${TABLE}.`);
|
|
42
|
+
(inOurs ? ours : kept).push(line);
|
|
43
|
+
}
|
|
44
|
+
else if (inOurs && /^\s*(#.*)?$/.test(line)) {
|
|
45
|
+
pending.push(line);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (inOurs)
|
|
49
|
+
ours.push(...pending);
|
|
50
|
+
else
|
|
51
|
+
kept.push(...pending);
|
|
52
|
+
pending = [];
|
|
53
|
+
(inOurs ? ours : kept).push(line);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
kept.push(...pending);
|
|
57
|
+
return { rest: kept.join("\n"), ours: ours.length ? ours.join("\n").trim() : null };
|
|
58
|
+
}
|
|
59
|
+
/** TOML basic strings use the same escapes as JSON for everything we'd ever write. */
|
|
60
|
+
const str = (s) => JSON.stringify(s);
|
|
61
|
+
export function tomlEntry(launch) {
|
|
62
|
+
const lines = [`[${TABLE}]`, `command = ${str(launch.command)}`, `args = [${launch.args.map(str).join(", ")}]`];
|
|
63
|
+
if (launch.env && Object.keys(launch.env).length) {
|
|
64
|
+
lines.push("", `[${TABLE}.env]`, ...Object.entries(launch.env).map(([k, v]) => `${k} = ${str(v)}`));
|
|
65
|
+
}
|
|
66
|
+
return lines.join("\n");
|
|
67
|
+
}
|
|
68
|
+
function writeAtomic(file, text) {
|
|
69
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
70
|
+
const backup = `${file}.amicooked.bak`;
|
|
71
|
+
if (fs.existsSync(file) && !fs.existsSync(backup))
|
|
72
|
+
fs.copyFileSync(file, backup);
|
|
73
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
74
|
+
fs.writeFileSync(tmp, text);
|
|
75
|
+
fs.renameSync(tmp, file);
|
|
76
|
+
}
|
|
77
|
+
/** Add or update our server in config.toml. Re-running changes nothing; other servers are untouched. */
|
|
78
|
+
export function installCodex(launch, file = codexConfigPath()) {
|
|
79
|
+
const text = fs.existsSync(file) ? fs.readFileSync(file, "utf8") : "";
|
|
80
|
+
const { rest, ours } = splitOurTable(text);
|
|
81
|
+
const entry = tomlEntry(launch);
|
|
82
|
+
if (ours === entry)
|
|
83
|
+
return "unchanged";
|
|
84
|
+
const body = rest.replace(/\s+$/, "");
|
|
85
|
+
writeAtomic(file, `${body ? `${body}\n\n` : ""}${entry}\n`);
|
|
86
|
+
return ours ? "updated" : "added";
|
|
87
|
+
}
|
|
88
|
+
export function uninstallCodex(file = codexConfigPath()) {
|
|
89
|
+
if (!fs.existsSync(file))
|
|
90
|
+
return "absent";
|
|
91
|
+
const { rest, ours } = splitOurTable(fs.readFileSync(file, "utf8"));
|
|
92
|
+
if (!ours)
|
|
93
|
+
return "absent";
|
|
94
|
+
writeAtomic(file, `${rest.replace(/\s+$/, "")}\n`);
|
|
95
|
+
return "removed";
|
|
96
|
+
}
|
|
97
|
+
/** True when config.toml already starts exactly this command. */
|
|
98
|
+
export function codexEntryIs(launch, file = codexConfigPath()) {
|
|
99
|
+
return fs.existsSync(file) && splitOurTable(fs.readFileSync(file, "utf8")).ours === tomlEntry(launch);
|
|
100
|
+
}
|
|
101
|
+
export function codexConfigured(file = codexConfigPath()) {
|
|
102
|
+
return fs.existsSync(file) && splitOurTable(fs.readFileSync(file, "utf8")).ours !== null;
|
|
103
|
+
}
|
|
104
|
+
// ---- the skill: the desktop app reads skills from ~/.agents/skills ----
|
|
105
|
+
export const codexSkillPath = (home = os.homedir()) => path.join(home, ".agents", "skills", SERVER_NAME, "SKILL.md");
|
|
106
|
+
export function installCodexSkill(home = os.homedir()) {
|
|
107
|
+
const file = codexSkillPath(home);
|
|
108
|
+
const existed = fs.existsSync(file);
|
|
109
|
+
if (existed && fs.readFileSync(file, "utf8") === SKILL_MD)
|
|
110
|
+
return "unchanged";
|
|
111
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
112
|
+
fs.writeFileSync(file, SKILL_MD);
|
|
113
|
+
return existed ? "updated" : "added";
|
|
114
|
+
}
|
|
115
|
+
export function uninstallCodexSkill(home = os.homedir()) {
|
|
116
|
+
const dir = path.dirname(codexSkillPath(home));
|
|
117
|
+
if (!fs.existsSync(dir))
|
|
118
|
+
return "absent";
|
|
119
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
120
|
+
return "removed";
|
|
121
|
+
}
|
package/dist/skill.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated from skill/SKILL.md by scripts/sync-skill.mjs. Don't edit by hand.
|
|
2
|
-
export const SKILL_MD = "---\nname: amicooked\ndescription: Use when a student asks about their D2L Brightspace courses, grades, deadlines, assignments, announcements or course files, asks \"am I cooked?\", or wants to set up Am I Cooked.\n---\n\n# Am I Cooked\n\nAm I Cooked connects an AI assistant to a student's D2L Brightspace account (Avenue to Learn, LEARN, onQ, OWL Brightspace, CourseLink, MyLearningSpace and others). It runs on the student's own computer and is read-only.\n\n## Setting it up (for agents)\n\n1. Ask the student which school they go to. Presets: mcmaster, waterloo, western, queens, guelph, laurier, tmu, uottawa, carleton, brock, windsor, laurentian, lakehead. Any other Brightspace school works with the URL they log in through.\n2. Install it:\n - macOS / Linux: `curl -fsSL https://amicooked-mcp.vercel.app/install.sh | sh -s -- --no-setup`\n - Windows (PowerShell): `$env:AMICOOKED_NO_SETUP=1; irm https://amicooked-mcp.vercel.app/install.ps1 | iex`\n - With Node.js installed, `npx -y amicooked@0` works in place of `amicooked` below.\n3. Run setup with flags, and a long command timeout (at least 5 minutes), because the student signs in through a browser window that opens:\n `amicooked setup --school mcmaster --clients desktop,code`\n Use `--school https://...` for schools without a preset. Add `chatgpt` to `--clients` if they use ChatGPT.\n4. Tell the student to sign in to their school in the browser window. Never ask for their password; you never need it.\n5. If something fails, run `amicooked status` and read what it says.\n\n<!-- server-instructions -->\n## Answering questions\n\n- Start broad questions (\"am I cooked?\", \"what should I work on?\", \"how am I doing?\", \"what's due?\") with `am_i_cooked`. It covers every current course in one call.\n- Other tools take a course code directly, like `course: \"3BB4\"`. Only call `get_my_courses` when a code is ambiguous or the student asks what they're enrolled in.\n- Check `get_announcements` for a course before a final verdict on it; deadlines and exam details often change there.\n- To read slides, handouts or assignment PDFs: `get_course_content` to find the file, then `download_file`. Use `read_file` for files already downloaded.\n- If a tool says a login window opened, tell the student to sign in there and ask again.\n\n## The verdict\n\nUse `summary.heatLabel` from `am_i_cooked` to set the tone. Be playful, never mean, and always useful.\n\n| heatLabel | Tone |\n|---|---|\n| raw | Relaxed. Nothing urgent; maybe get ahead on something. |\n| warming up | Light nudge. One or two things to handle soon. |\n| toasty | Focused. A real plan for the next few days. |\n| cooked | Direct and supportive. Triage what matters most. |\n| well done | Calm and practical. Damage control, and who to talk to. |\n\n1. Lead with a one-line verdict, e.g. \"Toasty, not cooked.\"\n2. Then the top 3 actions, each with course, item and due time in the student's local time (D2L times are UTC).\n3. Say whether a grade is `final_calculated` or `estimated_from_items`; estimates ignore dropped and bonus items.\n - For an estimate, say how much is left, like \"67.6% so far. 60% of your grade is still to come.\" Use `weightRemaining` for that number.\n - Name the `keyItems` when a grade needs explaining, with their weight: \"the midterm (59.5%, worth 25%) is pulling it down.\"\n - Never work weights out backwards from a result. Use the `weight` values the tools return.\n - `basis: \"points\"` means the gradebook has no weights. Say the estimate is by points and the real weighting may differ. If the student asks how the grade is calculated, find the course outline with `get_course_content` and read the weights from it.\n4. `late_window_open` means a missed assignment can still be submitted: say so first, it's the easiest win.\n5. If `partial_data` appears, mention that some of a course couldn't be loaded.\n6. For grades under 60%, suggest office hours, the TA, or an academic advisor.\n\n## Integrity\n\nAm I Cooked only reads. Help the student understand material and plan their time, but don't write graded work for them to submit.\n<!-- /server-instructions -->\n";
|
|
2
|
+
export const SKILL_MD = "---\nname: amicooked\ndescription: Use when a student asks about their D2L Brightspace courses, grades, deadlines, assignments, announcements or course files, asks \"am I cooked?\", or wants to set up Am I Cooked.\n---\n\n# Am I Cooked\n\nAm I Cooked connects an AI assistant to a student's D2L Brightspace account (Avenue to Learn, LEARN, onQ, OWL Brightspace, CourseLink, MyLearningSpace and others). It runs on the student's own computer and is read-only.\n\n## Setting it up (for agents)\n\n**First, check that you can run commands on the student's computer.** Setup installs a program there, so it only works from an agent with a terminal, like Claude Code, Codex or the ChatGPT desktop app. If you're on a website (chatgpt.com, claude.ai, gemini.google.com), in a phone app, or in a chat with no command tool, don't try. Tell the student instead:\n\n- Get an app that can do it: Claude Desktop (https://claude.ai/download) or the ChatGPT app (https://chatgpt.com/download), then paste the same request there. Or install it themselves by pasting this into Terminal (Mac): `curl -fsSL https://amicooked-mcp.vercel.app/install.sh | sh`, or this into PowerShell (Windows): `irm https://amicooked-mcp.vercel.app/install.ps1 | iex`.\n- Either way, it ends by opening their AI app, ready to ask \"am I cooked?\".\n\nIf you can run commands:\n\n1. Ask the student which school they go to. Presets: mcmaster, waterloo, western, queens, guelph, laurier, tmu, uottawa, carleton, brock, windsor, laurentian, lakehead. Any other Brightspace school works with the URL they log in through.\n2. Install it:\n - macOS / Linux: `curl -fsSL https://amicooked-mcp.vercel.app/install.sh | sh -s -- --no-setup`\n - Windows (PowerShell): `$env:AMICOOKED_NO_SETUP=1; irm https://amicooked-mcp.vercel.app/install.ps1 | iex`\n - With Node.js installed, `npx -y amicooked@0` works in place of `amicooked` below.\n3. Run setup with flags, and a long command timeout (at least 5 minutes), because the student signs in through a browser window that opens:\n `amicooked setup --school mcmaster --clients desktop,code`\n Use `--school https://...` for schools without a preset. Add `chatgpt-desktop` to `--clients` if they use the ChatGPT desktop app, then tell them to restart it. ChatGPT and Claude on the web or on phones aren't supported.\n4. Tell the student to sign in to their school in the browser window. Never ask for their password; you never need it.\n5. Setup ends with a \"Next\" list: one line per app saying it's open and ready, needs a restart, needs opening, or needs installing (with a link). Tell the student each line as written. If you're running inside Claude Desktop, they need to quit it; Am I Cooked then reopens it with everything set up.\n6. If something fails, run `amicooked status` and read what it says.\n\n<!-- server-instructions -->\n## Answering questions\n\n- Start broad questions (\"am I cooked?\", \"what should I work on?\", \"how am I doing?\", \"what's due?\") with `am_i_cooked`. It covers every current course in one call.\n- Other tools take a course code directly, like `course: \"3BB4\"`. Only call `get_my_courses` when a code is ambiguous or the student asks what they're enrolled in.\n- Check `get_announcements` for a course before a final verdict on it; deadlines and exam details often change there.\n- To read slides, handouts or assignment PDFs: `get_course_content` to find the file, then `download_file`. Use `read_file` for files already downloaded.\n- If a tool says a login window opened, tell the student to sign in there and ask again.\n\n## The verdict\n\nUse `summary.heatLabel` from `am_i_cooked` to set the tone. Be playful, never mean, and always useful.\n\n| heatLabel | Tone |\n|---|---|\n| raw | Relaxed. Nothing urgent; maybe get ahead on something. |\n| warming up | Light nudge. One or two things to handle soon. |\n| toasty | Focused. A real plan for the next few days. |\n| cooked | Direct and supportive. Triage what matters most. |\n| well done | Calm and practical. Damage control, and who to talk to. |\n\n1. Lead with a one-line verdict, e.g. \"Toasty, not cooked.\"\n2. Then the top 3 actions, each with course, item and due time in the student's local time (D2L times are UTC).\n3. Say whether a grade is `final_calculated` or `estimated_from_items`; estimates ignore dropped and bonus items.\n - For an estimate, say how much is left, like \"67.6% so far. 60% of your grade is still to come.\" Use `weightRemaining` for that number.\n - Name the `keyItems` when a grade needs explaining, with their weight: \"the midterm (59.5%, worth 25%) is pulling it down.\"\n - Never work weights out backwards from a result. Use the `weight` values the tools return.\n - `basis: \"points\"` means the gradebook has no weights. Say the estimate is by points and the real weighting may differ. If the student asks how the grade is calculated, find the course outline with `get_course_content` and read the weights from it.\n4. `late_window_open` means a missed assignment can still be submitted: say so first, it's the easiest win.\n5. If `partial_data` appears, mention that some of a course couldn't be loaded.\n6. For grades under 60%, suggest office hours, the TA, or an academic advisor.\n\n## Integrity\n\nAm I Cooked only reads. Help the student understand material and plan their time, but don't write graded work for them to submit.\n<!-- /server-instructions -->\n";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Must match package.json; a unit test checks this
|
|
2
|
-
export const VERSION = "0.1.
|
|
2
|
+
export const VERSION = "0.1.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amicooked",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Ask your AI if you're cooked. A local MCP server for D2L Brightspace: grades, deadlines and announcements in Claude and ChatGPT.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"test": "vitest run",
|
|
20
20
|
"test:watch": "vitest",
|
|
21
21
|
"prepack": "npm run build",
|
|
22
|
-
"build:bin": "node scripts/sync-skill.mjs && node scripts/build-binaries.mjs"
|
|
22
|
+
"build:bin": "node scripts/sync-skill.mjs && node scripts/build-binaries.mjs",
|
|
23
|
+
"preversion": "npm test",
|
|
24
|
+
"version": "node scripts/sync-version.mjs && git add src/version.ts"
|
|
23
25
|
},
|
|
24
26
|
"keywords": [
|
|
25
27
|
"mcp",
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
"license": "MIT",
|
|
39
41
|
"repository": {
|
|
40
42
|
"type": "git",
|
|
41
|
-
"url": "https://github.com/udaysinghkanwar/amicooked"
|
|
43
|
+
"url": "git+https://github.com/udaysinghkanwar/amicooked.git"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@clack/prompts": "^1.8.1",
|
package/skill/SKILL.md
CHANGED
|
@@ -9,6 +9,13 @@ Am I Cooked connects an AI assistant to a student's D2L Brightspace account (Ave
|
|
|
9
9
|
|
|
10
10
|
## Setting it up (for agents)
|
|
11
11
|
|
|
12
|
+
**First, check that you can run commands on the student's computer.** Setup installs a program there, so it only works from an agent with a terminal, like Claude Code, Codex or the ChatGPT desktop app. If you're on a website (chatgpt.com, claude.ai, gemini.google.com), in a phone app, or in a chat with no command tool, don't try. Tell the student instead:
|
|
13
|
+
|
|
14
|
+
- Get an app that can do it: Claude Desktop (https://claude.ai/download) or the ChatGPT app (https://chatgpt.com/download), then paste the same request there. Or install it themselves by pasting this into Terminal (Mac): `curl -fsSL https://amicooked-mcp.vercel.app/install.sh | sh`, or this into PowerShell (Windows): `irm https://amicooked-mcp.vercel.app/install.ps1 | iex`.
|
|
15
|
+
- Either way, it ends by opening their AI app, ready to ask "am I cooked?".
|
|
16
|
+
|
|
17
|
+
If you can run commands:
|
|
18
|
+
|
|
12
19
|
1. Ask the student which school they go to. Presets: mcmaster, waterloo, western, queens, guelph, laurier, tmu, uottawa, carleton, brock, windsor, laurentian, lakehead. Any other Brightspace school works with the URL they log in through.
|
|
13
20
|
2. Install it:
|
|
14
21
|
- macOS / Linux: `curl -fsSL https://amicooked-mcp.vercel.app/install.sh | sh -s -- --no-setup`
|
|
@@ -16,9 +23,10 @@ Am I Cooked connects an AI assistant to a student's D2L Brightspace account (Ave
|
|
|
16
23
|
- With Node.js installed, `npx -y amicooked@0` works in place of `amicooked` below.
|
|
17
24
|
3. Run setup with flags, and a long command timeout (at least 5 minutes), because the student signs in through a browser window that opens:
|
|
18
25
|
`amicooked setup --school mcmaster --clients desktop,code`
|
|
19
|
-
Use `--school https://...` for schools without a preset. Add `chatgpt` to `--clients` if they use ChatGPT.
|
|
26
|
+
Use `--school https://...` for schools without a preset. Add `chatgpt-desktop` to `--clients` if they use the ChatGPT desktop app, then tell them to restart it. ChatGPT and Claude on the web or on phones aren't supported.
|
|
20
27
|
4. Tell the student to sign in to their school in the browser window. Never ask for their password; you never need it.
|
|
21
|
-
5. If
|
|
28
|
+
5. Setup ends with a "Next" list: one line per app saying it's open and ready, needs a restart, needs opening, or needs installing (with a link). Tell the student each line as written. If you're running inside Claude Desktop, they need to quit it; Am I Cooked then reopens it with everything set up.
|
|
29
|
+
6. If something fails, run `amicooked status` and read what it says.
|
|
22
30
|
|
|
23
31
|
<!-- server-instructions -->
|
|
24
32
|
## Answering questions
|