amicooked 0.1.4 → 0.1.5

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
@@ -68,6 +68,8 @@ amicooked uninstall disconnect apps (--purge deletes your login and settings)
68
68
 
69
69
  Your settings and login live in `~/.amicooked`; downloaded files go to `~/Downloads/amicooked`.
70
70
 
71
+ The first time setup finishes on a computer, it sends one anonymous count: your school's preset name (or "custom") and your OS. Nothing from Brightspace, no IP or ID is stored. Set `AMICOOKED_NO_TELEMETRY=1` or `DO_NOT_TRACK=1` to turn it off.
72
+
71
73
  ## Development
72
74
 
73
75
  ```sh
@@ -76,6 +78,7 @@ npm test
76
78
  npm run build # TypeScript to dist/
77
79
  npm run build:bin # standalone binaries in build/ (uses Bun)
78
80
  node dist/cli.js setup
81
+ npm run stats # installs, npm downloads, setups, repo traffic
79
82
  ```
80
83
 
81
84
  `skill/SKILL.md` is the single source for the agent skill; `npm run sync:skill` copies it (and `install/`) into `src/skill.ts` and `site/`.
package/dist/cli/setup.js CHANGED
@@ -16,6 +16,7 @@ import { getConfig, writeConfig } from "../config.js";
16
16
  import { listCourses } from "../courseResolver.js";
17
17
  import { detectSchool, findPreset, PRESETS } from "../schools.js";
18
18
  import { amICooked } from "../tools/cooked.js";
19
+ import { reportSetup } from "../telemetry.js";
19
20
  const PUBLIC_IDS = ["desktop", "code", "chatgpt-desktop"];
20
21
  const CLIENT_IDS = [...PUBLIC_IDS, "chatgpt"];
21
22
  const ALIASES = { codex: "chatgpt-desktop", "chatgpt-app": "chatgpt-desktop", "chatgpt-web": "chatgpt" };
@@ -104,7 +105,7 @@ async function missingApp(app, name, url) {
104
105
  if (ok === true)
105
106
  openUrl(url);
106
107
  }
107
- return { app, next: `install ${name} from ${url}, then run \`amicooked setup\` again.`, ready: false };
108
+ return { app, next: `install ${name} from ${url}, then run \`amicooked setup\` again.`, ready: false, connected: false };
108
109
  }
109
110
  /**
110
111
  * Connects a desktop app and leaves it open with the new config loaded, or says exactly what's left.
@@ -115,10 +116,10 @@ async function connectDesktopApp(app, label, write, current) {
115
116
  if (current()) {
116
117
  // Already set up. Make sure it's open; no restart needed
117
118
  if (isRunning(app))
118
- return { app: label, next: `already set up. ${ask}`, ready: true };
119
+ return { app: label, next: `already set up. ${ask}`, ready: true, connected: true };
119
120
  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 };
121
+ ? { app: label, next: `already set up, and opening now. ${ask}`, ready: true, connected: true }
122
+ : { app: label, next: `already set up. Open ${app.name} and ask: am I cooked?`, ready: false, connected: true };
122
123
  }
123
124
  let running = isRunning(app);
124
125
  const inside = running && isRunningInside(app);
@@ -134,14 +135,14 @@ async function connectDesktopApp(app, label, write, current) {
134
135
  // Quitting it would save its old config over ours, so a background helper waits for the quit, writes
135
136
  // the config again and reopens the app
136
137
  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 };
138
+ ? { 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, connected: true }
139
+ : { app: label, next: `quit ${app.name} ${quitHow()}, then run \`amicooked setup\` again.`, ready: false, connected: false };
139
140
  }
140
141
  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 { app: label, next: `quit ${app.name} ${quitHow()} and open it again. Then ask it: am I cooked?`, ready: false, connected: true };
142
143
  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 };
144
+ ? { app: label, next: `set up, and opening now. ${ask}`, ready: true, connected: true }
145
+ : { app: label, next: `set up. Open ${app.name} and ask: am I cooked?`, ready: false, connected: true };
145
146
  }
146
147
  async function configureClients(clients) {
147
148
  const outcomes = [];
@@ -149,7 +150,7 @@ async function configureClients(clients) {
149
150
  if (clients.includes("desktop")) {
150
151
  const dir = claudeDesktopDir();
151
152
  if (!desktopAppsSupported()) {
152
- outcomes.push({ app: "Claude Desktop", next: `isn't available on Linux. Use Claude Code instead: ${CLAUDE_CODE_DOWNLOAD}`, ready: false });
153
+ outcomes.push({ app: "Claude Desktop", next: `isn't available on Linux. Use Claude Code instead: ${CLAUDE_CODE_DOWNLOAD}`, ready: false, connected: false });
153
154
  }
154
155
  else if (!dir) {
155
156
  outcomes.push(await missingApp("Claude Desktop", "Claude Desktop", APPS.claude.download));
@@ -162,7 +163,7 @@ async function configureClients(clients) {
162
163
  if (!(error instanceof InvalidConfigError))
163
164
  throw error;
164
165
  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 });
166
+ outcomes.push({ app: "Claude Desktop", next: "add the snippet above to its config, then restart it.", ready: false, connected: false });
166
167
  }
167
168
  }
168
169
  }
@@ -174,12 +175,12 @@ async function configureClients(clients) {
174
175
  installClaudeCode(launch);
175
176
  installSkill();
176
177
  // 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 });
178
+ outcomes.push({ app: "Claude Code", next: "set up. Start a new Claude Code session and ask: am I cooked?", ready: true, connected: true });
178
179
  }
179
180
  }
180
181
  if (clients.includes("chatgpt-desktop")) {
181
182
  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
+ outcomes.push({ app: "ChatGPT app", next: `isn't available on Linux. Use Claude Code instead: ${CLAUDE_CODE_DOWNLOAD}`, ready: false, connected: false });
183
184
  }
184
185
  else if (!hasCodex()) {
185
186
  outcomes.push(await missingApp("ChatGPT app", "the ChatGPT app", APPS.chatgpt.download));
@@ -193,7 +194,7 @@ async function configureClients(clients) {
193
194
  }
194
195
  }
195
196
  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
+ outcomes.push({ app: "ChatGPT on the web", next: "isn't available yet. Use the ChatGPT app instead: `--clients chatgpt-desktop`.", ready: false, connected: false });
197
198
  }
198
199
  else if (clients.includes("chatgpt")) {
199
200
  const spin = p.spinner();
@@ -202,7 +203,7 @@ async function configureClients(clients) {
202
203
  const { url, pairingCode } = await installChatGPT();
203
204
  spin.stop("ChatGPT: running in the background");
204
205
  p.note(chatgptSteps(url, pairingCode), "Connect ChatGPT");
205
- outcomes.push({ app: "ChatGPT on the web", next: "finish connecting with the steps above, then ask: am I cooked?", ready: false });
206
+ outcomes.push({ app: "ChatGPT on the web", next: "finish connecting with the steps above, then ask: am I cooked?", ready: false, connected: true });
206
207
  }
207
208
  catch (error) {
208
209
  spin.stop(`ChatGPT: ${error instanceof Error ? error.message : error}`);
@@ -270,12 +271,15 @@ export async function setup(options) {
270
271
  }
271
272
  const detected = { desktop: Boolean(claudeDesktopDir()), code: hasClaudeCode(), "chatgpt-desktop": hasCodex(), chatgpt: false };
272
273
  const outcomes = await configureClients(await chooseClients(options.clients, detected, Boolean(options.yes)));
274
+ // Count the setup only if an app was connected. Started now so it runs alongside the first report
275
+ const reported = outcomes.some((o) => o.connected) ? reportSetup(school.id) : undefined;
273
276
  if (options.login !== false)
274
277
  await firstRoast();
275
278
  const { steps, outro } = finishMessage(outcomes);
276
279
  if (steps)
277
280
  p.note(steps, "Next");
278
281
  p.outro(outro);
282
+ await reported;
279
283
  return 0;
280
284
  }
281
285
  catch (error) {
@@ -0,0 +1,39 @@
1
+ import * as fs from "fs";
2
+ import * as path from "path";
3
+ import { homeDir } from "./config.js";
4
+ import { findPreset } from "./schools.js";
5
+ /** Counts finished setups; see site/api/e.js. */
6
+ export const REPORT_URL = "https://amicooked-mcp.vercel.app/api/e";
7
+ export function telemetryOff(env = process.env) {
8
+ const on = (v) => Boolean(v) && v !== "0" && v !== "false";
9
+ return on(env.AMICOOKED_NO_TELEMETRY) || on(env.DO_NOT_TRACK);
10
+ }
11
+ /**
12
+ * Sends one anonymous "setup finished" count, the first time setup finishes on this computer. It carries the
13
+ * school preset id (or "custom", never the URL) and the platform. A marker file in ~/.amicooked stops repeat
14
+ * setups being counted again, so nothing identifying is sent. Never throws and gives up after 1.5 s.
15
+ */
16
+ export async function reportSetup(schoolId, options = {}) {
17
+ const { env = process.env, fetchImpl = fetch, platform = `${process.platform}-${process.arch}` } = options;
18
+ if (telemetryOff(env))
19
+ return false;
20
+ const marker = path.join(homeDir(), "setup-reported");
21
+ if (fs.existsSync(marker))
22
+ return false;
23
+ try {
24
+ const res = await fetchImpl(REPORT_URL, {
25
+ method: "POST",
26
+ headers: { "content-type": "application/json" },
27
+ body: JSON.stringify({ e: "setup", school: findPreset(schoolId)?.id ?? "custom", platform }),
28
+ signal: AbortSignal.timeout(1500),
29
+ });
30
+ if (!res.ok)
31
+ return false;
32
+ fs.mkdirSync(path.dirname(marker), { recursive: true });
33
+ fs.writeFileSync(marker, "");
34
+ return true;
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
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.4";
2
+ export const VERSION = "0.1.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amicooked",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
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": {
@@ -21,7 +21,8 @@
21
21
  "prepack": "npm run build",
22
22
  "build:bin": "node scripts/sync-skill.mjs && node scripts/build-binaries.mjs",
23
23
  "preversion": "npm test",
24
- "version": "node scripts/sync-version.mjs && git add src/version.ts"
24
+ "version": "node scripts/sync-version.mjs && git add src/version.ts",
25
+ "stats": "node --env-file-if-exists=.env.local scripts/stats.mjs"
25
26
  },
26
27
  "keywords": [
27
28
  "mcp",