@analitikisler/ai-tag-debugger 0.8.0 → 0.8.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1 (2026-10-15)
4
+
5
+ - A run with no AI provider key set now stops at once with a message naming the keys to set and the `--scripted --no-ai` option, instead of starting the browser and failing at the first step with the SDK's "Could not resolve authentication method".
6
+ - Over MCP, `run_audit` with `scripted: false` and no key returns an error that tells the chat app what to do next: call it again with `scripted: true`, or browse with `start_audit`. It doesn't mention CLI flags.
7
+ - The README points to `ai-tag-debugger --help` for the full list of commands and options.
8
+ - `npm run demo` replays the demo shop with no AI model (`--no-ai`), so it works without an API key.
9
+
3
10
  ## 0.8.0 (2026-10-14)
4
11
 
5
12
  - The browser installs itself the first time an audit starts, so connecting the MCP server no longer needs a separate `playwright install` step. Progress goes to stderr.
package/README.md CHANGED
@@ -112,6 +112,8 @@ ai-tag-debugger run --site https://staging.yourshop.com --journey add_to_cart --
112
112
 
113
113
  Or run it without installing: `npx -y @analitikisler/ai-tag-debugger run --site … --journey add_to_cart`.
114
114
 
115
+ Run `ai-tag-debugger --help` to see every command and option, such as `--providers`, `--scripted` and `--no-ai`.
116
+
115
117
  ### Try the demo shop (from source)
116
118
 
117
119
  The repository includes a demo shop with three deliberate tracking bugs:
package/README.tr.md CHANGED
@@ -112,6 +112,8 @@ ai-tag-debugger run --site https://staging.yourshop.com --journey add_to_cart --
112
112
 
113
113
  Ya da kurmadan çalıştırın: `npx -y @analitikisler/ai-tag-debugger run --site … --journey add_to_cart`.
114
114
 
115
+ Tüm komutları ve seçenekleri (`--providers`, `--scripted`, `--no-ai` gibi) görmek için `ai-tag-debugger --help` çalıştırın.
116
+
115
117
  ### Demo mağazayı deneyin (kaynak koddan)
116
118
 
117
119
  Depoda, bilerek bırakılmış üç ölçümleme hatası olan bir demo mağaza var:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@analitikisler/ai-tag-debugger",
3
3
  "mcpName": "io.github.analitikisler/ai-tag-debugger",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "description": "Open-source AI agent that QA-tests your website's analytics, ad and consent tracking (GA4, GTM, Google Ads, Meta, TikTok). Bring your own model (Claude, OpenAI, Gemini) or use it from your chat app over MCP.",
6
6
  "type": "module",
7
7
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "test": "node --test test/*.test.js",
18
18
  "demo:serve": "node examples/serve.js",
19
- "demo": "node src/cli.js run --config examples/demo.config.json --scripted --out reports/demo"
19
+ "demo": "node src/cli.js run --config examples/demo.config.json --scripted --no-ai --out reports/demo"
20
20
  },
21
21
  "engines": {
22
22
  "node": ">=20"
package/src/mcp.js CHANGED
@@ -293,7 +293,16 @@ export function buildServer(opts) {
293
293
  async ({ config: configFile, scripted, language, branding, providers }) => {
294
294
  const loaded = await loadConfig(configFile);
295
295
  const replay = scripted !== false;
296
- const result = await runAudit({ ...loaded, scripted: replay, ai: !replay, lang: language, branding, providers, outDir: path.join(opts.reportsDir, new Date().toISOString().replace(/[:.]/g, "-")) });
296
+ let result;
297
+ try {
298
+ result = await runAudit({ ...loaded, scripted: replay, ai: !replay, lang: language, branding, providers, outDir: path.join(opts.reportsDir, new Date().toISOString().replace(/[:.]/g, "-")) });
299
+ } catch (err) {
300
+ // The CLI wording (--scripted --no-ai) means nothing to a chat app, so say it in this tool's terms.
301
+ if (err.code !== "NO_API_KEY") throw err;
302
+ return fail(
303
+ "No AI provider key (ANTHROPIC_API_KEY, OPENAI_API_KEY or GEMINI_API_KEY) is set on the computer running this server, so scripted false can't browse with a model. Call run_audit again with scripted true (or leave it out) to replay the journeys' fixed steps, or browse the site yourself with start_audit, browser_action and finish_audit. Neither needs a key.",
304
+ );
305
+ }
297
306
  const m = messages(result.lang);
298
307
  const grouped = groupFindings(result.findings).filter((f) => f.severity !== "ok");
299
308
  return text(
package/src/providers.js CHANGED
@@ -28,6 +28,12 @@ export function resolveProviderName(name, env = process.env) {
28
28
  return "anthropic";
29
29
  }
30
30
 
31
+ const NO_API_KEY = `No AI provider key found. Set one of ANTHROPIC_API_KEY, OPENAI_API_KEY or GEMINI_API_KEY (or OPENAI_COMPATIBLE_BASE_URL for an OpenAI-compatible API), or pick one with --provider. To run without any AI model, replay the fixed steps with --scripted --no-ai.`;
32
+
33
+ function hasApiKey(env) {
34
+ return Boolean(env.OPENAI_COMPATIBLE_BASE_URL || env.ANTHROPIC_API_KEY || env.ANTHROPIC_AUTH_TOKEN || env.OPENAI_API_KEY || env.GEMINI_API_KEY || env.GOOGLE_API_KEY);
35
+ }
36
+
31
37
  /**
32
38
  * @param {{ name?: string, model?: string, baseUrl?: string, client?: any }} opts
33
39
  * baseUrl: for openai-compatible, e.g. https://api.deepseek.com or http://localhost:11434/v1.
@@ -36,6 +42,10 @@ export function resolveProviderName(name, env = process.env) {
36
42
  export async function createProvider(opts = {}, env = process.env) {
37
43
  // A bare client (tests, embedding) is an Anthropic client unless named otherwise.
38
44
  const name = opts.client && !opts.name ? "anthropic" : opts.baseUrl && !opts.name ? "openai-compatible" : resolveProviderName(opts.name, env);
45
+ // With no provider named and no key set, the SDK would only fail at the first step with an
46
+ // unclear auth error, after the browser has started. A named provider skips this check, since
47
+ // its SDK may find credentials elsewhere (an Anthropic profile, Google Cloud credentials).
48
+ if (!opts.client && !opts.name && !opts.baseUrl && !hasApiKey(env)) throw Object.assign(new Error(NO_API_KEY), { code: "NO_API_KEY" });
39
49
  if (name === "openai-compatible") {
40
50
  const baseURL = opts.baseUrl ?? env.OPENAI_COMPATIBLE_BASE_URL;
41
51
  const model = opts.model ?? env.OPENAI_COMPATIBLE_MODEL;