@askthew/mcp-plugin 0.4.6 → 0.4.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 +2 -0
- package/dist/cli.js +51 -10
- package/dist/index.d.ts +4 -0
- package/dist/index.js +106 -1
- package/dist/install.d.ts +26 -0
- package/dist/install.js +88 -12
- package/dist/lib/paths.d.ts +2 -0
- package/dist/lib/paths.js +14 -0
- package/dist/lib/telemetry.js +1 -1
- package/package.json +4 -2
- package/dist/cli-actions.test.d.ts +0 -1
- package/dist/cli-actions.test.js +0 -71
- package/dist/cli.test.d.ts +0 -1
- package/dist/cli.test.js +0 -323
- package/dist/free-tier-policy.test.d.ts +0 -1
- package/dist/free-tier-policy.test.js +0 -58
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -950
- package/dist/install.test.d.ts +0 -1
- package/dist/install.test.js +0 -314
- package/dist/local-identity.test.d.ts +0 -1
- package/dist/local-identity.test.js +0 -29
- package/dist/local-store.test.d.ts +0 -1
- package/dist/local-store.test.js +0 -71
- package/dist/scope.test.d.ts +0 -1
- package/dist/scope.test.js +0 -49
- package/dist/timeline-insights.test.d.ts +0 -1
- package/dist/timeline-insights.test.js +0 -85
- package/dist/tip-engine.test.d.ts +0 -1
- package/dist/tip-engine.test.js +0 -51
package/dist/cli.test.js
DELETED
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import test from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import os from "node:os";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { runAuthCommand } from "./cli.js";
|
|
9
|
-
import { identityPath } from "./lib/paths.js";
|
|
10
|
-
const cliPath = fileURLToPath(new URL("./cli.js", import.meta.url));
|
|
11
|
-
function makeFixture() {
|
|
12
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), "askthew-cli-install-"));
|
|
13
|
-
const home = path.join(root, "home");
|
|
14
|
-
const dataDir = path.join(root, "data");
|
|
15
|
-
const project = path.join(root, "project");
|
|
16
|
-
fs.mkdirSync(home, { recursive: true });
|
|
17
|
-
fs.mkdirSync(dataDir, { recursive: true });
|
|
18
|
-
fs.mkdirSync(project, { recursive: true });
|
|
19
|
-
fs.writeFileSync(path.join(project, "package.json"), "{}", "utf8");
|
|
20
|
-
return { root, home, dataDir, project };
|
|
21
|
-
}
|
|
22
|
-
function runCli(input) {
|
|
23
|
-
return spawnSync(process.execPath, [cliPath, ...input.args], {
|
|
24
|
-
cwd: input.cwd,
|
|
25
|
-
encoding: "utf8",
|
|
26
|
-
env: {
|
|
27
|
-
...process.env,
|
|
28
|
-
HOME: input.home,
|
|
29
|
-
USERPROFILE: input.home,
|
|
30
|
-
ASKTHEW_DATA_DIR: input.dataDir,
|
|
31
|
-
ASKTHEW_EMAIL: "founder@example.com",
|
|
32
|
-
ASKTHEW_CLI_TOKEN: "",
|
|
33
|
-
ASKTHEW_CLI_TOKEN_ID: "",
|
|
34
|
-
ASKTHEW_USER_ID: "",
|
|
35
|
-
ASKTHEW_INSTALL_TOKEN: "",
|
|
36
|
-
ASKTHEW_FREE_MODE: "",
|
|
37
|
-
...(input.extraEnv ?? {}),
|
|
38
|
-
},
|
|
39
|
-
});
|
|
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
|
-
}
|
|
69
|
-
async function withCliEnv(dataDir, fn) {
|
|
70
|
-
const previous = {
|
|
71
|
-
ASKTHEW_DATA_DIR: process.env.ASKTHEW_DATA_DIR,
|
|
72
|
-
ASKTHEW_EMAIL: process.env.ASKTHEW_EMAIL,
|
|
73
|
-
ASKTHEW_CLI_TOKEN: process.env.ASKTHEW_CLI_TOKEN,
|
|
74
|
-
ASKTHEW_CLI_TOKEN_ID: process.env.ASKTHEW_CLI_TOKEN_ID,
|
|
75
|
-
ASKTHEW_USER_ID: process.env.ASKTHEW_USER_ID,
|
|
76
|
-
ASKTHEW_INSTALL_TOKEN: process.env.ASKTHEW_INSTALL_TOKEN,
|
|
77
|
-
ASKTHEW_FREE_MODE: process.env.ASKTHEW_FREE_MODE,
|
|
78
|
-
};
|
|
79
|
-
process.env.ASKTHEW_DATA_DIR = dataDir;
|
|
80
|
-
process.env.ASKTHEW_EMAIL = "founder@example.com";
|
|
81
|
-
delete process.env.ASKTHEW_CLI_TOKEN;
|
|
82
|
-
delete process.env.ASKTHEW_CLI_TOKEN_ID;
|
|
83
|
-
delete process.env.ASKTHEW_USER_ID;
|
|
84
|
-
delete process.env.ASKTHEW_INSTALL_TOKEN;
|
|
85
|
-
delete process.env.ASKTHEW_FREE_MODE;
|
|
86
|
-
try {
|
|
87
|
-
return await fn();
|
|
88
|
-
}
|
|
89
|
-
finally {
|
|
90
|
-
for (const [key, value] of Object.entries(previous)) {
|
|
91
|
-
if (value === undefined) {
|
|
92
|
-
delete process.env[key];
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
process.env[key] = value;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
test("free install without prior auth writes config, instructions, and local identity", () => {
|
|
101
|
-
const fixture = makeFixture();
|
|
102
|
-
try {
|
|
103
|
-
const result = runCli({
|
|
104
|
-
args: ["install", "--host", "claude_code", "--free", "--email", "founder@example.com", "--api-url", "http://127.0.0.1:9"],
|
|
105
|
-
cwd: fixture.project,
|
|
106
|
-
home: fixture.home,
|
|
107
|
-
dataDir: fixture.dataDir,
|
|
108
|
-
});
|
|
109
|
-
assert.equal(result.status, 0, result.stderr);
|
|
110
|
-
assert.match(result.stdout, /Free local mode installed/);
|
|
111
|
-
assert.match(result.stdout, /Free install identity saved locally|Free install identity registered/);
|
|
112
|
-
assert.equal(fs.existsSync(path.join(fixture.home, ".claude.json")), true);
|
|
113
|
-
assert.match(fs.readFileSync(path.join(fixture.project, "CLAUDE.md"), "utf8"), /capture_session_signal/);
|
|
114
|
-
const identity = JSON.parse(fs.readFileSync(path.join(fixture.dataDir, "identity.json"), "utf8"));
|
|
115
|
-
assert.match(identity.installId, /^[0-9a-f-]{36}$/);
|
|
116
|
-
assert.equal(identity.emailClaim, "founder@example.com");
|
|
117
|
-
assert.equal(typeof identity.privateKey, "string");
|
|
118
|
-
assert.equal(typeof identity.publicKey, "string");
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
122
|
-
}
|
|
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
|
-
});
|
|
159
|
-
test("free install dry-run stays non-mutating and does not create identity", () => {
|
|
160
|
-
const fixture = makeFixture();
|
|
161
|
-
try {
|
|
162
|
-
const result = runCli({
|
|
163
|
-
args: ["install", "--host", "codex", "--free", "--email", "founder@example.com", "--dry-run"],
|
|
164
|
-
cwd: fixture.project,
|
|
165
|
-
home: fixture.home,
|
|
166
|
-
dataDir: fixture.dataDir,
|
|
167
|
-
});
|
|
168
|
-
assert.equal(result.status, 0, result.stderr);
|
|
169
|
-
assert.equal(fs.existsSync(path.join(fixture.home, ".codex", "config.toml")), false);
|
|
170
|
-
assert.equal(fs.existsSync(path.join(fixture.project, "CLAUDE.md")), false);
|
|
171
|
-
assert.equal(fs.existsSync(path.join(fixture.project, "AGENTS.md")), false);
|
|
172
|
-
assert.equal(fs.existsSync(path.join(fixture.dataDir, "identity.json")), false);
|
|
173
|
-
}
|
|
174
|
-
finally {
|
|
175
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
test("free install ignores stale legacy credentials and writes local identity", () => {
|
|
179
|
-
const fixture = makeFixture();
|
|
180
|
-
try {
|
|
181
|
-
fs.writeFileSync(path.join(fixture.dataDir, "credentials.json"), "{\"legacy\":true}\n", "utf8");
|
|
182
|
-
const result = runCli({
|
|
183
|
-
args: ["install", "--host", "claude_code", "--free", "--api-url", "http://127.0.0.1:9"],
|
|
184
|
-
cwd: fixture.project,
|
|
185
|
-
home: fixture.home,
|
|
186
|
-
dataDir: fixture.dataDir,
|
|
187
|
-
});
|
|
188
|
-
assert.equal(result.status, 0, result.stderr);
|
|
189
|
-
assert.match(result.stdout, /Free local mode installed/);
|
|
190
|
-
const settings = JSON.parse(fs.readFileSync(path.join(fixture.home, ".claude.json"), "utf8"));
|
|
191
|
-
const projectEntries = Object.values(settings.projects);
|
|
192
|
-
assert.equal(projectEntries.length, 1);
|
|
193
|
-
const server = projectEntries[0].mcpServers.askthew;
|
|
194
|
-
assert.equal(server.env.ASKTHEW_FREE_MODE, "1");
|
|
195
|
-
assert.equal("ASKTHEW_CLI_TOKEN" in server.env, false);
|
|
196
|
-
assert.equal("ASKTHEW_INSTALL_TOKEN" in server.env, false);
|
|
197
|
-
assert.match(fs.readFileSync(path.join(fixture.project, "CLAUDE.md"), "utf8"), /capture_session_signal/);
|
|
198
|
-
assert.equal(fs.existsSync(path.join(fixture.dataDir, "identity.json")), true);
|
|
199
|
-
}
|
|
200
|
-
finally {
|
|
201
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
test("refresh rewrites host config and instructions while preserving local identity and data", () => {
|
|
205
|
-
const fixture = makeFixture();
|
|
206
|
-
try {
|
|
207
|
-
const install = runCli({
|
|
208
|
-
args: ["install", "--host", "claude_code", "--free", "--email", "founder@example.com", "--api-url", "http://127.0.0.1:9"],
|
|
209
|
-
cwd: fixture.project,
|
|
210
|
-
home: fixture.home,
|
|
211
|
-
dataDir: fixture.dataDir,
|
|
212
|
-
});
|
|
213
|
-
assert.equal(install.status, 0, install.stderr);
|
|
214
|
-
const beforeIdentity = JSON.parse(fs.readFileSync(path.join(fixture.dataDir, "identity.json"), "utf8"));
|
|
215
|
-
fs.writeFileSync(path.join(fixture.dataDir, "store.sqlite"), "keep me", "utf8");
|
|
216
|
-
const refresh = runCli({
|
|
217
|
-
args: ["refresh", "--host", "claude_code", "--api-url", "http://127.0.0.1:9"],
|
|
218
|
-
cwd: fixture.project,
|
|
219
|
-
home: fixture.home,
|
|
220
|
-
dataDir: fixture.dataDir,
|
|
221
|
-
});
|
|
222
|
-
assert.equal(refresh.status, 0, refresh.stderr);
|
|
223
|
-
assert.match(refresh.stdout, /plugin refresh complete/);
|
|
224
|
-
assert.match(refresh.stdout, /Local identity preserved/);
|
|
225
|
-
assert.match(refresh.stdout, /Plugin package version:/);
|
|
226
|
-
const afterIdentity = JSON.parse(fs.readFileSync(path.join(fixture.dataDir, "identity.json"), "utf8"));
|
|
227
|
-
assert.equal(afterIdentity.installId, beforeIdentity.installId);
|
|
228
|
-
assert.equal(afterIdentity.emailClaim, "founder@example.com");
|
|
229
|
-
assert.equal(fs.readFileSync(path.join(fixture.dataDir, "store.sqlite"), "utf8"), "keep me");
|
|
230
|
-
assert.match(fs.readFileSync(path.join(fixture.project, "CLAUDE.md"), "utf8"), /ASKTHEW_PLUGIN_INSTRUCTIONS_START/);
|
|
231
|
-
assert.match(fs.readFileSync(path.join(fixture.project, "AGENTS.md"), "utf8"), /ASKTHEW_PLUGIN_INSTRUCTIONS_START/);
|
|
232
|
-
}
|
|
233
|
-
finally {
|
|
234
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
test("refresh dry-run does not create a local identity", () => {
|
|
238
|
-
const fixture = makeFixture();
|
|
239
|
-
try {
|
|
240
|
-
const refresh = runCli({
|
|
241
|
-
args: ["refresh", "--host", "codex", "--dry-run"],
|
|
242
|
-
cwd: fixture.project,
|
|
243
|
-
home: fixture.home,
|
|
244
|
-
dataDir: fixture.dataDir,
|
|
245
|
-
});
|
|
246
|
-
assert.equal(refresh.status, 0, refresh.stderr);
|
|
247
|
-
assert.match(refresh.stdout, /refresh dry run complete/);
|
|
248
|
-
assert.equal(fs.existsSync(path.join(fixture.dataDir, "identity.json")), false);
|
|
249
|
-
assert.equal(fs.existsSync(path.join(fixture.home, ".codex", "config.toml")), false);
|
|
250
|
-
}
|
|
251
|
-
finally {
|
|
252
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
test("auth status reports missing local identity without pending-code guidance", () => {
|
|
256
|
-
const fixture = makeFixture();
|
|
257
|
-
try {
|
|
258
|
-
const result = runCli({
|
|
259
|
-
args: ["auth", "status"],
|
|
260
|
-
cwd: fixture.project,
|
|
261
|
-
home: fixture.home,
|
|
262
|
-
dataDir: fixture.dataDir,
|
|
263
|
-
});
|
|
264
|
-
assert.equal(result.status, 0, result.stderr);
|
|
265
|
-
assert.match(result.stdout, /No local identity yet/);
|
|
266
|
-
assert.doesNotMatch(result.stdout, /verify --code|Pending code/);
|
|
267
|
-
}
|
|
268
|
-
finally {
|
|
269
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
test("removed auth code commands do not issue or verify email codes", () => {
|
|
273
|
-
const fixture = makeFixture();
|
|
274
|
-
try {
|
|
275
|
-
const verify = runCli({
|
|
276
|
-
args: ["auth", "verify", "--code", "123456"],
|
|
277
|
-
cwd: fixture.project,
|
|
278
|
-
home: fixture.home,
|
|
279
|
-
dataDir: fixture.dataDir,
|
|
280
|
-
extraEnv: { ASKTHEW_API_URL: "http://127.0.0.1:9" },
|
|
281
|
-
});
|
|
282
|
-
assert.equal(verify.status, 1);
|
|
283
|
-
assert.match(verify.stderr, /Usage: askthew-mcp auth login/);
|
|
284
|
-
const loginWithCode = runCli({
|
|
285
|
-
args: ["auth", "login", "--email", "founder@example.com", "--code", "123456"],
|
|
286
|
-
cwd: fixture.project,
|
|
287
|
-
home: fixture.home,
|
|
288
|
-
dataDir: fixture.dataDir,
|
|
289
|
-
extraEnv: { ASKTHEW_API_URL: "http://127.0.0.1:9" },
|
|
290
|
-
});
|
|
291
|
-
assert.equal(loginWithCode.status, 0, loginWithCode.stderr);
|
|
292
|
-
assert.match(loginWithCode.stdout, /No email code is required/);
|
|
293
|
-
assert.doesNotMatch(loginWithCode.stdout, /Code sent|Logged in/);
|
|
294
|
-
}
|
|
295
|
-
finally {
|
|
296
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
test("auth login now identifies the local free install without requesting an email code", async () => {
|
|
300
|
-
const fixture = makeFixture();
|
|
301
|
-
const calls = [];
|
|
302
|
-
const logs = [];
|
|
303
|
-
try {
|
|
304
|
-
await withCliEnv(fixture.dataDir, async () => {
|
|
305
|
-
await runAuthCommand(["login", "--email", "ymtest89+test5@gmail.com"], {
|
|
306
|
-
log: (message) => logs.push(message),
|
|
307
|
-
registerFreeInstall: async ({ identity }) => {
|
|
308
|
-
calls.push({ type: "register", installId: identity.installId, emailClaim: identity.emailClaim });
|
|
309
|
-
return { ok: true, registeredAt: new Date().toISOString() };
|
|
310
|
-
},
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
assert.equal(calls.length, 1);
|
|
314
|
-
assert.equal(calls[0].type, "register");
|
|
315
|
-
assert.equal(calls[0].emailClaim, "ymtest89+test5@gmail.com");
|
|
316
|
-
assert.equal(fs.existsSync(identityPath({ ASKTHEW_DATA_DIR: fixture.dataDir })), true);
|
|
317
|
-
assert.equal(fs.existsSync(path.join(fixture.dataDir, "credentials.json")), false);
|
|
318
|
-
assert.match(logs.join("\n"), /No email code is required/);
|
|
319
|
-
}
|
|
320
|
-
finally {
|
|
321
|
-
fs.rmSync(fixture.root, { recursive: true, force: true });
|
|
322
|
-
}
|
|
323
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import test from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { resolveMcpMode } from "./lib/free-tier-policy.js";
|
|
7
|
-
import { ensureLocalIdentity } from "./lib/local-identity.js";
|
|
8
|
-
function withTempDataDir(fn) {
|
|
9
|
-
const dataDir = fs.mkdtempSync(path.join(os.tmpdir(), "askthew-mode-"));
|
|
10
|
-
try {
|
|
11
|
-
return fn({ ASKTHEW_DATA_DIR: dataDir }, dataDir);
|
|
12
|
-
}
|
|
13
|
-
finally {
|
|
14
|
-
fs.rmSync(dataDir, { recursive: true, force: true });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
test("mode resolution prefers paid install tokens", () => {
|
|
18
|
-
const mode = resolveMcpMode({
|
|
19
|
-
ASKTHEW_INSTALL_TOKEN: "atw_token",
|
|
20
|
-
ASKTHEW_FREE_MODE: "1",
|
|
21
|
-
});
|
|
22
|
-
assert.equal(mode.mode, "paid");
|
|
23
|
-
assert.equal(mode.reason, "workspace_install_token");
|
|
24
|
-
});
|
|
25
|
-
test("mode resolution detects local free install identity", () => {
|
|
26
|
-
withTempDataDir((env) => {
|
|
27
|
-
ensureLocalIdentity({ emailClaim: "founder@example.com", env });
|
|
28
|
-
const mode = resolveMcpMode(env);
|
|
29
|
-
assert.equal(mode.mode, "free");
|
|
30
|
-
assert.equal(mode.reason, "local_install_identity");
|
|
31
|
-
assert.equal(mode.cliCredentials?.userId, mode.cliCredentials?.installId);
|
|
32
|
-
assert.equal(mode.cliCredentials?.email, "founder@example.com");
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
test("mode resolution distinguishes pending free auth from no identity", () => {
|
|
36
|
-
withTempDataDir((env) => {
|
|
37
|
-
const pending = resolveMcpMode({
|
|
38
|
-
...env,
|
|
39
|
-
ASKTHEW_FREE_MODE: "1",
|
|
40
|
-
});
|
|
41
|
-
const none = resolveMcpMode(env);
|
|
42
|
-
assert.equal(pending.mode, "free_pending_auth");
|
|
43
|
-
assert.equal(pending.reason, "free_mode_no_identity");
|
|
44
|
-
assert.equal(none.mode, "unauthenticated");
|
|
45
|
-
assert.equal(none.reason, "no_identity");
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
test("mode resolution ignores legacy credentials files", () => {
|
|
49
|
-
withTempDataDir((env, dataDir) => {
|
|
50
|
-
fs.writeFileSync(path.join(dataDir, "credentials.json"), "{\"not\":\"credentials\"}\n", "utf8");
|
|
51
|
-
const mode = resolveMcpMode({
|
|
52
|
-
...env,
|
|
53
|
-
ASKTHEW_FREE_MODE: "1",
|
|
54
|
-
});
|
|
55
|
-
assert.equal(mode.mode, "free_pending_auth");
|
|
56
|
-
assert.equal(mode.reason, "free_mode_no_identity");
|
|
57
|
-
});
|
|
58
|
-
});
|
package/dist/index.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|