@askthew/mcp-plugin 0.4.5 → 0.4.6

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
@@ -3,7 +3,7 @@
3
3
  Connect a local coding agent to Ask The W. The fastest path is free and local-first:
4
4
 
5
5
  ```bash
6
- npx -y --prefer-online @askthew/mcp-plugin@latest install --host claude_code --free --email you@founder.com
6
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install --host claude_code --free --email you@founder.com
7
7
  ```
8
8
 
9
9
  This captures decisions and session signals to `~/.askthew/store.sqlite` and lets your agent run `review_decisions`, `review_session`, `recap`, `coach`, and `promote_signal_to_decision` without onboarding into the web app.
@@ -35,7 +35,7 @@ Ask The W performs inference, linking, approval state, dedupe, and outcome updat
35
35
  ## Free Local Install
36
36
 
37
37
  ```bash
38
- npx -y --prefer-online @askthew/mcp-plugin@latest install \
38
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install \
39
39
  --host claude_code \
40
40
  --free \
41
41
  --email you@founder.com
@@ -50,7 +50,7 @@ Telemetry is aggregate-only and opt-out. Ask The W does not receive code, file c
50
50
  Use `refresh` when you want the latest installed MCP config and instruction blocks without touching local identity or local data:
51
51
 
52
52
  ```bash
53
- npx -y --prefer-online @askthew/mcp-plugin@latest refresh --host claude_code
53
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp refresh --host claude_code
54
54
  ```
55
55
 
56
56
  `refresh` preserves `~/.askthew/identity.json` and `~/.askthew/store.sqlite`, reuses any existing email claim silently, rewrites the host MCP config, and rewrites the marked Ask The W blocks in `CLAUDE.md` and `AGENTS.md`. This is the recommended QA update path after a plugin publish.
@@ -72,7 +72,7 @@ Use setup tokens promptly. They expire after 24 hours if the connector never sen
72
72
  Codex:
73
73
 
74
74
  ```bash
75
- npx -y --prefer-online @askthew/mcp-plugin@latest install \
75
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install \
76
76
  --host codex \
77
77
  --token "<ASKTHEW_INSTALL_TOKEN>" \
78
78
  --api-url "https://app.askthew.com/" \
@@ -82,7 +82,7 @@ npx -y --prefer-online @askthew/mcp-plugin@latest install \
82
82
  Claude Code:
83
83
 
84
84
  ```bash
85
- npx -y --prefer-online @askthew/mcp-plugin@latest install \
85
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install \
86
86
  --host claude_code \
87
87
  --token "<ASKTHEW_INSTALL_TOKEN>" \
88
88
  --api-url "https://app.askthew.com/" \
@@ -92,7 +92,7 @@ npx -y --prefer-online @askthew/mcp-plugin@latest install \
92
92
  Cursor:
93
93
 
94
94
  ```bash
95
- npx -y --prefer-online @askthew/mcp-plugin@latest install \
95
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install \
96
96
  --host cursor \
97
97
  --token "<ASKTHEW_INSTALL_TOKEN>" \
98
98
  --api-url "https://app.askthew.com/" \
@@ -130,7 +130,7 @@ Codex example:
130
130
  ```toml
131
131
  [mcp_servers.askthew]
132
132
  command = "npx"
133
- args = ["-y", "--prefer-online", "@askthew/mcp-plugin@latest"]
133
+ args = ["-y", "--prefer-online", "--package", "@askthew/mcp-plugin@latest", "askthew-mcp"]
134
134
  env = { ASKTHEW_INSTALL_TOKEN = "<ASKTHEW_INSTALL_TOKEN>", ASKTHEW_HOST_TYPE = "codex", ASKTHEW_API_URL = "https://app.askthew.com/", ASKTHEW_SERVER_NAME = "askthew" }
135
135
  ```
136
136
 
@@ -194,8 +194,8 @@ The plugin also exposes v1 API tools that map to the app's authenticated routes:
194
194
  Free PLG helpers:
195
195
 
196
196
  ```bash
197
- npx @askthew/mcp-plugin install-hook --pre-commit
198
- npx @askthew/mcp-plugin digest --weekly
197
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install-hook --pre-commit
198
+ npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp digest --weekly
199
199
  ```
200
200
 
201
201
  The hook prompts when staged files recently had implementation signals but no linked decision. The weekly digest writes `~/Documents/askthew-digest-YYYY-WW.md`.
@@ -44,7 +44,7 @@ test("pre-commit hook installer writes the documented inline prompt hook", () =>
44
44
  const hookPath = installPreCommitHook({ cwd: dir });
45
45
  const hook = fs.readFileSync(hookPath, "utf8");
46
46
  assert.match(hook, /Ask The W pre-commit decision prompt/);
47
- assert.match(hook, /@askthew\/mcp-plugin@latest hook-check --pre-commit/);
47
+ assert.match(hook, /--package @askthew\/mcp-plugin@latest askthew-mcp hook-check --pre-commit/);
48
48
  assert.equal((fs.statSync(hookPath).mode & 0o111) > 0, true);
49
49
  fs.rmSync(dir, { recursive: true, force: true });
50
50
  });
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import path from "node:path";
5
5
  import { execFileSync } from "node:child_process";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { createAskTheWMcpServer } from "./index.js";
8
- import { ensureAskTheWDataDir, identityPath } from "./lib/paths.js";
8
+ import { askTheWDataDir, ensureAskTheWDataDir, identityPath } from "./lib/paths.js";
9
9
  import { loadCliCredentials } from "./lib/free-tier-policy.js";
10
10
  import { describeFreeIdentity, tryRegisterFreeInstall } from "./lib/free-install-registration.js";
11
11
  import { ensureLocalIdentity, loadLocalIdentity, publicIdentity } from "./lib/local-identity.js";
@@ -348,21 +348,39 @@ async function runUninstallCommand(argv) {
348
348
  const instructions = keepAgentInstructions
349
349
  ? null
350
350
  : uninstallBehaviorInstructions({ hostType, dryRun });
351
+ const dataDir = askTheWDataDir();
352
+ const hadLocalData = fs.existsSync(dataDir);
353
+ const authFile = identityPath();
354
+ const hadAuth = fs.existsSync(authFile);
351
355
  if (!keepLocalData && !dryRun) {
352
- fs.rmSync(ensureAskTheWDataDir(), { recursive: true, force: true });
356
+ fs.rmSync(dataDir, { recursive: true, force: true });
353
357
  }
354
358
  if (!keepAuth && !dryRun) {
355
- const file = identityPath();
356
- if (fs.existsSync(file))
357
- fs.rmSync(file, { force: true });
359
+ if (fs.existsSync(authFile))
360
+ fs.rmSync(authFile, { force: true });
358
361
  }
359
362
  console.log(dryRun ? "Ask The W plugin uninstall dry run complete." : "Ask The W plugin uninstall complete.");
360
363
  console.log(`Settings path: ${config.settingsPath}`);
364
+ console.log(config.removedServer
365
+ ? `${dryRun ? "Would remove" : "Removed"} MCP server "${config.removedServerName}".`
366
+ : config.foundConfigFile
367
+ ? `No MCP server "${config.removedServerName}" found in host config.`
368
+ : "No host config file found.");
361
369
  if (instructions) {
362
- console.log(`Agent instructions removed: ${instructions.paths.join(", ") || "none"}`);
363
- }
364
- console.log(keepLocalData ? "Local data kept." : "Local data removed.");
365
- console.log(keepAuth ? "Auth tokens kept." : "Auth tokens removed.");
370
+ console.log(instructions.paths.length > 0
371
+ ? `Agent instructions ${dryRun ? "would be removed from" : "removed from"}: ${instructions.paths.join(", ")}`
372
+ : "No Ask The W agent instruction blocks found.");
373
+ }
374
+ console.log(keepLocalData
375
+ ? "Local data kept."
376
+ : hadLocalData
377
+ ? `${dryRun ? "Local data would be removed" : "Local data removed"}.`
378
+ : "No local data directory found.");
379
+ console.log(keepAuth
380
+ ? "Auth tokens kept."
381
+ : hadAuth
382
+ ? `${dryRun ? "Local identity would be removed" : "Local identity removed"}.`
383
+ : "No local identity found.");
366
384
  if (dryRun) {
367
385
  console.log("");
368
386
  console.log(config.json);
@@ -559,7 +577,7 @@ async function runHookCheckCommand(argv) {
559
577
  const gap = preCommitDecisionGap({ store, stagedFiles: stagedFiles(), scopeKey: localScopeKey() });
560
578
  if (gap.missing) {
561
579
  console.log('Ask The W: this change has no decision attached, draft one?');
562
- console.log("Run: npx @askthew/mcp-plugin digest --weekly or ask your agent to call promote_signal_to_decision.");
580
+ console.log("Run: npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp digest --weekly or ask your agent to call promote_signal_to_decision.");
563
581
  }
564
582
  }
565
583
  async function runDigestCommand(argv) {
@@ -587,7 +605,17 @@ async function runSyncCommand(argv) {
587
605
  }
588
606
  console.log(JSON.stringify(await uploadLocalStore({ store, credentials, syncToken }), null, 2));
589
607
  }
590
- const isDirectCliExecution = Boolean(process.argv[1]) && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
608
+ const isDirectCliExecution = Boolean(process.argv[1]) &&
609
+ (() => {
610
+ const cliPath = fileURLToPath(import.meta.url);
611
+ const invokedPath = path.resolve(process.argv[1]);
612
+ try {
613
+ return fs.realpathSync(invokedPath) === fs.realpathSync(cliPath);
614
+ }
615
+ catch {
616
+ return invokedPath === cliPath;
617
+ }
618
+ })();
591
619
  if (isDirectCliExecution) {
592
620
  main().catch((error) => {
593
621
  if (error instanceof Error) {
package/dist/cli.test.js CHANGED
@@ -38,6 +38,34 @@ function runCli(input) {
38
38
  },
39
39
  });
40
40
  }
41
+ function runCliViaBinSymlink(input) {
42
+ const binDir = fs.mkdtempSync(path.join(os.tmpdir(), "askthew-cli-bin-"));
43
+ const binPath = path.join(binDir, "askthew-mcp");
44
+ fs.symlinkSync(cliPath, binPath);
45
+ try {
46
+ return spawnSync(binPath, input.args, {
47
+ cwd: input.cwd,
48
+ encoding: "utf8",
49
+ env: {
50
+ ...process.env,
51
+ PATH: `${binDir}${path.delimiter}${process.env.PATH ?? ""}`,
52
+ HOME: input.home,
53
+ USERPROFILE: input.home,
54
+ ASKTHEW_DATA_DIR: input.dataDir,
55
+ ASKTHEW_EMAIL: "founder@example.com",
56
+ ASKTHEW_CLI_TOKEN: "",
57
+ ASKTHEW_CLI_TOKEN_ID: "",
58
+ ASKTHEW_USER_ID: "",
59
+ ASKTHEW_INSTALL_TOKEN: "",
60
+ ASKTHEW_FREE_MODE: "",
61
+ ...(input.extraEnv ?? {}),
62
+ },
63
+ });
64
+ }
65
+ finally {
66
+ fs.rmSync(binDir, { recursive: true, force: true });
67
+ }
68
+ }
41
69
  async function withCliEnv(dataDir, fn) {
42
70
  const previous = {
43
71
  ASKTHEW_DATA_DIR: process.env.ASKTHEW_DATA_DIR,
@@ -93,6 +121,41 @@ test("free install without prior auth writes config, instructions, and local ide
93
121
  fs.rmSync(fixture.root, { recursive: true, force: true });
94
122
  }
95
123
  });
124
+ test("published-style bin symlink runs free install instead of silently exiting", () => {
125
+ const fixture = makeFixture();
126
+ try {
127
+ const help = runCliViaBinSymlink({
128
+ args: ["--help"],
129
+ cwd: fixture.project,
130
+ home: fixture.home,
131
+ dataDir: fixture.dataDir,
132
+ });
133
+ assert.equal(help.status, 0, help.stderr);
134
+ assert.match(help.stdout, /Ask The W Coding Agent Connector/);
135
+ const result = runCliViaBinSymlink({
136
+ args: [
137
+ "install",
138
+ "--host",
139
+ "codex",
140
+ "--free",
141
+ "--email",
142
+ "founder@example.com",
143
+ "--api-url",
144
+ "http://127.0.0.1:9",
145
+ "--dry-run",
146
+ ],
147
+ cwd: fixture.project,
148
+ home: fixture.home,
149
+ dataDir: fixture.dataDir,
150
+ });
151
+ assert.equal(result.status, 0, result.stderr);
152
+ assert.match(result.stdout, /Ask The W plugin dry run complete/);
153
+ assert.match(result.stdout, /--package @askthew\/mcp-plugin@latest askthew-mcp install/);
154
+ }
155
+ finally {
156
+ fs.rmSync(fixture.root, { recursive: true, force: true });
157
+ }
158
+ });
96
159
  test("free install dry-run stays non-mutating and does not create identity", () => {
97
160
  const fixture = makeFixture();
98
161
  try {
package/dist/index.js CHANGED
@@ -482,10 +482,10 @@ function loginCommandHint() {
482
482
  ]) {
483
483
  const email = String(value ?? "").trim();
484
484
  if (/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) {
485
- return `npx @askthew/mcp-plugin identify --email ${email}`;
485
+ return `npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp identify --email ${email}`;
486
486
  }
487
487
  }
488
- return "npx @askthew/mcp-plugin identify --email <your-email>";
488
+ return "npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp identify --email <your-email>";
489
489
  }
490
490
  async function sendStartupHeartbeat(options) {
491
491
  if (!hasServerIdentity(options?.credentials)) {
package/dist/install.d.ts CHANGED
@@ -111,6 +111,8 @@ export declare function uninstallHostConfig(input: UninstallHostConfigInput): {
111
111
  settingsPath: string;
112
112
  json: string;
113
113
  removedServerName: string;
114
+ foundConfigFile: boolean;
115
+ removedServer: boolean;
114
116
  wroteFile: boolean;
115
117
  };
116
118
  export declare function sendInstallHeartbeat(input: HostConfigInput & {
package/dist/install.js CHANGED
@@ -21,7 +21,7 @@ export function createServerEntry(input) {
21
21
  const scope = resolvePluginScope(input.cwd ?? process.cwd());
22
22
  return {
23
23
  command: "npx",
24
- args: ["-y", "--prefer-online", "@askthew/mcp-plugin@latest"],
24
+ args: ["-y", "--prefer-online", "--package", "@askthew/mcp-plugin@latest", "askthew-mcp"],
25
25
  env: {
26
26
  ASKTHEW_API_URL: input.apiUrl,
27
27
  ...(input.free ? { ASKTHEW_FREE_MODE: "1" } : { ASKTHEW_INSTALL_TOKEN: input.token ?? "" }),
@@ -133,24 +133,23 @@ export function formatInstallCommand(input) {
133
133
  "npx",
134
134
  "-y",
135
135
  "--prefer-online",
136
+ "--package",
136
137
  "@askthew/mcp-plugin@latest",
138
+ "askthew-mcp",
137
139
  "install",
138
140
  "--host",
139
141
  input.hostType,
142
+ ...(input.free ? ["--free"] : ["--token", JSON.stringify(input.token ?? "")]),
140
143
  "--api-url",
141
144
  JSON.stringify(input.apiUrl),
142
145
  "--server-name",
143
146
  JSON.stringify(input.serverName),
144
147
  ];
145
148
  if (input.free) {
146
- parts.push("--free");
147
149
  if (input.email) {
148
150
  parts.push("--email", JSON.stringify(input.email));
149
151
  }
150
152
  }
151
- else {
152
- parts.splice(7, 0, "--token", JSON.stringify(input.token ?? ""));
153
- }
154
153
  return parts.join(" ");
155
154
  }
156
155
  export function verificationNextStep(hostType) {
@@ -219,9 +218,13 @@ export function uninstallHostConfig(input) {
219
218
  });
220
219
  const serverName = input.serverName?.trim() || "askthew";
221
220
  let json = "";
221
+ let foundConfigFile = false;
222
+ let removedServer = false;
222
223
  if (fs.existsSync(settingsPath)) {
224
+ foundConfigFile = true;
223
225
  const raw = fs.readFileSync(settingsPath, "utf8");
224
226
  if (input.hostType === "codex") {
227
+ removedServer = raw !== removeCodexTomlServer(raw, serverName) || (serverName !== "askthew" && raw !== removeCodexTomlServer(raw, "askthew"));
225
228
  json = removeCodexTomlServer(raw, serverName);
226
229
  if (serverName !== "askthew") {
227
230
  json = removeCodexTomlServer(json, "askthew");
@@ -236,6 +239,7 @@ export function uninstallHostConfig(input) {
236
239
  const existingProject = isRecord(existingProjects[cwd]) ? existingProjects[cwd] : {};
237
240
  const existingMcpServers = isRecord(existingProject.mcpServers) ? existingProject.mcpServers : {};
238
241
  const nextServers = { ...existingMcpServers };
242
+ removedServer = serverName in nextServers || (serverName !== "askthew" && "askthew" in nextServers);
239
243
  delete nextServers[serverName];
240
244
  if (serverName !== "askthew")
241
245
  delete nextServers.askthew;
@@ -253,6 +257,7 @@ export function uninstallHostConfig(input) {
253
257
  else {
254
258
  const existingMcpServers = isRecord(parsed.mcpServers) ? parsed.mcpServers : {};
255
259
  const nextServers = { ...existingMcpServers };
260
+ removedServer = serverName in nextServers || (serverName !== "askthew" && "askthew" in nextServers);
256
261
  delete nextServers[serverName];
257
262
  if (serverName !== "askthew")
258
263
  delete nextServers.askthew;
@@ -268,7 +273,9 @@ export function uninstallHostConfig(input) {
268
273
  settingsPath,
269
274
  json,
270
275
  removedServerName: serverName,
271
- wroteFile: !input.dryRun,
276
+ foundConfigFile,
277
+ removedServer,
278
+ wroteFile: !input.dryRun && foundConfigFile,
272
279
  };
273
280
  }
274
281
  export async function sendInstallHeartbeat(input) {
@@ -29,7 +29,7 @@ test("mergeHostSettings preserves unrelated MCP servers and replaces askthew", (
29
29
  assert.deepEqual(Object.keys(merged.mcpServers ?? {}).sort(), ["askthew_workspace_a", "github"]);
30
30
  assert.deepEqual(merged.mcpServers.askthew_workspace_a, {
31
31
  command: "npx",
32
- args: ["-y", "--prefer-online", "@askthew/mcp-plugin@latest"],
32
+ args: ["-y", "--prefer-online", "--package", "@askthew/mcp-plugin@latest", "askthew-mcp"],
33
33
  env: {
34
34
  ASKTHEW_INSTALL_TOKEN: "token-123",
35
35
  ASKTHEW_API_URL: "https://askthew.example.com",
@@ -176,7 +176,7 @@ test("formatInstallCommand emits the one-command guided install form", () => {
176
176
  apiUrl: "https://askthew.example.com",
177
177
  serverName: "askthew_workspace_a",
178
178
  });
179
- assert.equal(command, 'npx -y --prefer-online @askthew/mcp-plugin@latest install --host codex --token "token-abc" --api-url "https://askthew.example.com" --server-name "askthew_workspace_a"');
179
+ assert.equal(command, 'npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp install --host codex --token "token-abc" --api-url "https://askthew.example.com" --server-name "askthew_workspace_a"');
180
180
  });
181
181
  test("verificationNextStep points users to every-session startup capture", () => {
182
182
  const nextStep = verificationNextStep("codex");
@@ -289,9 +289,26 @@ test("uninstall removes host config and Ask The W agent instruction blocks", ()
289
289
  cwd: tempRoot,
290
290
  });
291
291
  assert.doesNotMatch(fs.readFileSync(removed.settingsPath, "utf8"), /askthew/);
292
+ assert.equal(removed.foundConfigFile, true);
293
+ assert.equal(removed.removedServer, true);
294
+ assert.equal(removed.wroteFile, true);
292
295
  assert.equal(instructions.paths.length, 2);
293
296
  assert.doesNotMatch(fs.readFileSync(path.join(tempRoot, "AGENTS.md"), "utf8"), /ASKTHEW_PLUGIN_INSTRUCTIONS_START/);
294
297
  assert.doesNotMatch(fs.readFileSync(path.join(tempRoot, "CLAUDE.md"), "utf8"), /ASKTHEW_PLUGIN_INSTRUCTIONS_START/);
295
298
  fs.rmSync(tempHome, { recursive: true, force: true });
296
299
  fs.rmSync(tempRoot, { recursive: true, force: true });
297
300
  });
301
+ test("uninstall reports when no broken-npx install artifacts exist", () => {
302
+ const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), "askthew-uninstall-empty-home-"));
303
+ const removed = uninstallHostConfig({
304
+ hostType: "codex",
305
+ serverName: "askthew",
306
+ homeDirectory: tempHome,
307
+ dryRun: true,
308
+ });
309
+ assert.equal(removed.foundConfigFile, false);
310
+ assert.equal(removed.removedServer, false);
311
+ assert.equal(removed.wroteFile, false);
312
+ assert.equal(removed.json, "");
313
+ fs.rmSync(tempHome, { recursive: true, force: true });
314
+ });
@@ -22,7 +22,7 @@ export function installPreCommitHook(input = {}) {
22
22
  const hook = [
23
23
  "#!/bin/sh",
24
24
  "# Ask The W pre-commit decision prompt",
25
- "npx -y --prefer-online @askthew/mcp-plugin@latest hook-check --pre-commit",
25
+ "npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp hook-check --pre-commit",
26
26
  "",
27
27
  ].join("\n");
28
28
  fs.mkdirSync(path.dirname(hookPath), { recursive: true });
@@ -22,7 +22,7 @@ export function paidFeatureNudge(tool) {
22
22
  pricingUrl: PRICING_URL,
23
23
  upgradeUrl: `https://askthew.com/plugin?utm_source=mcp-plugin&utm_medium=tool-nudge&utm_campaign=mcp-free&tool=${encodeURIComponent(tool)}`,
24
24
  supportEmail: SUPPORT_EMAIL,
25
- cta: "Run: npx @askthew/mcp-plugin upgrade",
25
+ cta: "Run: npx -y --prefer-online --package @askthew/mcp-plugin@latest askthew-mcp upgrade",
26
26
  };
27
27
  }
28
28
  export function toolJson(value) {
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@askthew/mcp-plugin",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "private": false,
5
5
  "description": "Ask The W plugin connector for local-first coding-agent decisions, signals, and review.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "bin": {
10
- "askthew-mcp": "dist/cli.js"
10
+ "askthew-mcp": "dist/cli.js",
11
+ "mcp-plugin": "dist/cli.js"
11
12
  },
12
13
  "files": [
13
14
  "README.md",