@koda-sl/baker-cli 0.13.0 → 0.16.0
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 +243 -3
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -1
- package/dist/commands/ads/google/accounts.d.ts.map +1 -1
- package/dist/commands/ads/google/accounts.js +7 -4
- package/dist/commands/ads/google/accounts.js.map +1 -1
- package/dist/commands/ads/output.d.ts +1 -0
- package/dist/commands/ads/output.d.ts.map +1 -1
- package/dist/commands/ads/output.js +18 -15
- package/dist/commands/ads/output.js.map +1 -1
- package/dist/commands/ga4/audit.d.ts +13 -0
- package/dist/commands/ga4/audit.d.ts.map +1 -0
- package/dist/commands/ga4/audit.js +67 -0
- package/dist/commands/ga4/audit.js.map +1 -0
- package/dist/commands/ga4/index.d.ts +2 -0
- package/dist/commands/ga4/index.d.ts.map +1 -0
- package/dist/commands/ga4/index.js +26 -0
- package/dist/commands/ga4/index.js.map +1 -0
- package/dist/commands/ga4/presets.d.ts +8 -0
- package/dist/commands/ga4/presets.d.ts.map +1 -0
- package/dist/commands/ga4/presets.js +33 -0
- package/dist/commands/ga4/presets.js.map +1 -0
- package/dist/commands/ga4/properties.d.ts +14 -0
- package/dist/commands/ga4/properties.d.ts.map +1 -0
- package/dist/commands/ga4/properties.js +61 -0
- package/dist/commands/ga4/properties.js.map +1 -0
- package/dist/commands/ga4/query.d.ts +69 -0
- package/dist/commands/ga4/query.d.ts.map +1 -0
- package/dist/commands/ga4/query.js +184 -0
- package/dist/commands/ga4/query.js.map +1 -0
- package/dist/commands/ga4/resolve.d.ts +2 -0
- package/dist/commands/ga4/resolve.d.ts.map +1 -0
- package/dist/commands/ga4/resolve.js +57 -0
- package/dist/commands/ga4/resolve.js.map +1 -0
- package/dist/commands/gsc/index.d.ts +2 -0
- package/dist/commands/gsc/index.d.ts.map +1 -0
- package/dist/commands/gsc/index.js +26 -0
- package/dist/commands/gsc/index.js.map +1 -0
- package/dist/commands/gsc/presets.d.ts +9 -0
- package/dist/commands/gsc/presets.d.ts.map +1 -0
- package/dist/commands/gsc/presets.js +34 -0
- package/dist/commands/gsc/presets.js.map +1 -0
- package/dist/commands/gsc/query.d.ts +79 -0
- package/dist/commands/gsc/query.d.ts.map +1 -0
- package/dist/commands/gsc/query.js +196 -0
- package/dist/commands/gsc/query.js.map +1 -0
- package/dist/commands/gsc/resolve.d.ts +2 -0
- package/dist/commands/gsc/resolve.d.ts.map +1 -0
- package/dist/commands/gsc/resolve.js +57 -0
- package/dist/commands/gsc/resolve.js.map +1 -0
- package/dist/commands/gsc/sitemaps.d.ts +19 -0
- package/dist/commands/gsc/sitemaps.d.ts.map +1 -0
- package/dist/commands/gsc/sitemaps.js +65 -0
- package/dist/commands/gsc/sitemaps.js.map +1 -0
- package/dist/commands/gsc/sites.d.ts +14 -0
- package/dist/commands/gsc/sites.d.ts.map +1 -0
- package/dist/commands/gsc/sites.js +61 -0
- package/dist/commands/gsc/sites.js.map +1 -0
- package/dist/commands/research/autocomplete.d.ts +34 -0
- package/dist/commands/research/autocomplete.d.ts.map +1 -0
- package/dist/commands/research/autocomplete.js +73 -0
- package/dist/commands/research/autocomplete.js.map +1 -0
- package/dist/commands/research/index.d.ts.map +1 -1
- package/dist/commands/research/index.js +8 -0
- package/dist/commands/research/index.js.map +1 -1
- package/dist/commands/research/relevant-pages.d.ts +34 -0
- package/dist/commands/research/relevant-pages.d.ts.map +1 -0
- package/dist/commands/research/relevant-pages.js +76 -0
- package/dist/commands/research/relevant-pages.js.map +1 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +2 -0
- package/dist/env.js.map +1 -1
- package/dist/error-handler.d.ts +8 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +37 -0
- package/dist/error-handler.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiPost } from "../../client.js";
|
|
3
|
+
import { buildResearchQueryContext, warnDefaults } from "../../geo-context.js";
|
|
4
|
+
import { registerSchema } from "../../schemas.js";
|
|
5
|
+
import { handleResearchError, RESEARCH_DATA_NOTE, writeResearchJson, writeResearchOutput } from "./output.js";
|
|
6
|
+
registerSchema({
|
|
7
|
+
command: "research.autocomplete",
|
|
8
|
+
description: "Get Google Autocomplete suggestions for a seed keyword. Useful for keyword expansion and discovering what people actually search for. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en).",
|
|
9
|
+
args: {
|
|
10
|
+
keyword: { type: "string", description: "Seed keyword (positional)", required: true },
|
|
11
|
+
location: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Country code (us, uk, es, de...) or DataForSEO location code. DEFAULTS TO us (United States) if omitted",
|
|
14
|
+
required: false,
|
|
15
|
+
},
|
|
16
|
+
language: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Language code or name. DEFAULTS TO en (English) if omitted",
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
limit: { type: "string", description: "Max suggestions (default: 10, max: 20)", required: false },
|
|
22
|
+
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false },
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const FIELDS = {
|
|
26
|
+
suggestion: "Autocomplete suggestion from Google",
|
|
27
|
+
};
|
|
28
|
+
export const autocompleteCommand = defineCommand({
|
|
29
|
+
meta: {
|
|
30
|
+
name: "autocomplete",
|
|
31
|
+
description: `Get Google Autocomplete suggestions for keyword expansion.
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
baker research autocomplete "running shoes"
|
|
35
|
+
baker research autocomplete "crm" --location uk --limit 5`,
|
|
36
|
+
},
|
|
37
|
+
args: {
|
|
38
|
+
keyword: { type: "positional", description: "Seed keyword", required: true },
|
|
39
|
+
location: { type: "string", description: "Country code or location code (default: us)", required: false },
|
|
40
|
+
language: { type: "string", description: "Language code or name (default: en)", required: false },
|
|
41
|
+
limit: { type: "string", description: "Max suggestions (default: 10, max: 20)", required: false },
|
|
42
|
+
output: { type: "string", description: "Format: json|csv|md|jsonl", required: false, default: "json" },
|
|
43
|
+
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false },
|
|
44
|
+
},
|
|
45
|
+
run: async ({ args }) => {
|
|
46
|
+
const keyword = args.keyword;
|
|
47
|
+
const location = args.location || undefined;
|
|
48
|
+
const language = args.language || undefined;
|
|
49
|
+
const limit = args.limit ? Number(args.limit) : undefined;
|
|
50
|
+
const skipCache = args["no-cache"] ? true : undefined;
|
|
51
|
+
const queryContext = buildResearchQueryContext(location, language);
|
|
52
|
+
try {
|
|
53
|
+
const data = await apiPost("/api/research/autocomplete", {
|
|
54
|
+
keyword,
|
|
55
|
+
location,
|
|
56
|
+
language,
|
|
57
|
+
limit,
|
|
58
|
+
skipCache,
|
|
59
|
+
});
|
|
60
|
+
warnDefaults(queryContext);
|
|
61
|
+
const format = args.output || "json";
|
|
62
|
+
if (format !== "json") {
|
|
63
|
+
writeResearchOutput(data, format);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
writeResearchJson({ ok: true, data, fields: FIELDS, note: RESEARCH_DATA_NOTE, query_context: queryContext });
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
handleResearchError(err);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=autocomplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../../src/commands/research/autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAA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K,MAAM,EAAE,CAAC;gBACtB,mBAAmB,CAAC,IAAiD,EAAE,MAAM,CAAC,CAAC;gBAC/E,OAAO;YACT,CAAC;YACD,iBAAiB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;QAC/G,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/research/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/research/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,qDAoC1B,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import { advertisersCommand } from "./advertisers.js";
|
|
3
|
+
import { autocompleteCommand } from "./autocomplete.js";
|
|
3
4
|
import { countriesCommand } from "./countries.js";
|
|
4
5
|
import { intentCommand } from "./intent.js";
|
|
5
6
|
import { keywordGapCommand } from "./keyword-gap.js";
|
|
6
7
|
import { keywordsForSiteCommand } from "./keywords-for-site.js";
|
|
7
8
|
import { languagesCommand } from "./languages.js";
|
|
8
9
|
import { lighthouseCommand } from "./lighthouse.js";
|
|
10
|
+
import { relevantPagesCommand } from "./relevant-pages.js";
|
|
9
11
|
export const researchCommand = defineCommand({
|
|
10
12
|
meta: {
|
|
11
13
|
name: "research",
|
|
@@ -13,28 +15,34 @@ export const researchCommand = defineCommand({
|
|
|
13
15
|
|
|
14
16
|
Commands:
|
|
15
17
|
advertisers — Who's bidding on a keyword?
|
|
18
|
+
autocomplete — Google Autocomplete suggestions
|
|
16
19
|
intent — Google Search intent classification
|
|
17
20
|
keywords-for-site — Keywords a domain bids on
|
|
18
21
|
keyword-gap — Keywords they have that we don't
|
|
22
|
+
relevant-pages — Top pages of a competitor domain
|
|
19
23
|
lighthouse — Landing page performance audit
|
|
20
24
|
countries — List supported country codes
|
|
21
25
|
languages — List supported language codes
|
|
22
26
|
|
|
23
27
|
Examples:
|
|
24
28
|
baker research advertisers "running shoes"
|
|
29
|
+
baker research autocomplete "running shoes"
|
|
25
30
|
baker research intent "buy running shoes,best running shoes 2026"
|
|
26
31
|
baker research keywords-for-site "competitor.com"
|
|
27
32
|
baker research keyword-gap "them.com" "us.com"
|
|
33
|
+
baker research relevant-pages "competitor.com"
|
|
28
34
|
baker research lighthouse "https://example.com/landing"`,
|
|
29
35
|
},
|
|
30
36
|
subCommands: {
|
|
31
37
|
advertisers: advertisersCommand,
|
|
38
|
+
autocomplete: autocompleteCommand,
|
|
32
39
|
countries: countriesCommand,
|
|
33
40
|
intent: intentCommand,
|
|
34
41
|
"keywords-for-site": keywordsForSiteCommand,
|
|
35
42
|
"keyword-gap": keywordGapCommand,
|
|
36
43
|
languages: languagesCommand,
|
|
37
44
|
lighthouse: lighthouseCommand,
|
|
45
|
+
"relevant-pages": relevantPagesCommand,
|
|
38
46
|
},
|
|
39
47
|
});
|
|
40
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/research/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/research/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;0DAoByC;KACvD;IACD,WAAW,EAAE;QACX,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,mBAAmB;QACjC,SAAS,EAAE,gBAAgB;QAC3B,MAAM,EAAE,aAAa;QACrB,mBAAmB,EAAE,sBAAsB;QAC3C,aAAa,EAAE,iBAAiB;QAChC,SAAS,EAAE,gBAAgB;QAC3B,UAAU,EAAE,iBAAiB;QAC7B,gBAAgB,EAAE,oBAAoB;KACvC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const relevantPagesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly target: {
|
|
3
|
+
readonly type: "positional";
|
|
4
|
+
readonly description: "Domain to analyze";
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly location: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly description: "Country code or location code (default: us)";
|
|
10
|
+
readonly required: false;
|
|
11
|
+
};
|
|
12
|
+
readonly language: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "Language code or name (default: en)";
|
|
15
|
+
readonly required: false;
|
|
16
|
+
};
|
|
17
|
+
readonly limit: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly description: "Max results (default: 20, max: 1000)";
|
|
20
|
+
readonly required: false;
|
|
21
|
+
};
|
|
22
|
+
readonly output: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Format: json|csv|md|jsonl";
|
|
25
|
+
readonly required: false;
|
|
26
|
+
readonly default: "json";
|
|
27
|
+
};
|
|
28
|
+
readonly "no-cache": {
|
|
29
|
+
readonly type: "boolean";
|
|
30
|
+
readonly description: "Skip server cache, hit API directly";
|
|
31
|
+
readonly required: false;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=relevant-pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relevant-pages.d.ts","sourceRoot":"","sources":["../../../src/commands/research/relevant-pages.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6C/B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiPost } from "../../client.js";
|
|
3
|
+
import { buildResearchQueryContext, warnDefaults } from "../../geo-context.js";
|
|
4
|
+
import { registerSchema } from "../../schemas.js";
|
|
5
|
+
import { handleResearchError, RESEARCH_DATA_NOTE, writeResearchJson, writeResearchOutput } from "./output.js";
|
|
6
|
+
registerSchema({
|
|
7
|
+
command: "research.relevant-pages",
|
|
8
|
+
description: "Get the top pages of a competitor domain with organic traffic and ranking data. Shows which pages drive the most traffic. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en).",
|
|
9
|
+
args: {
|
|
10
|
+
target: { type: "string", description: "Domain to analyze (positional, e.g. competitor.com)", required: true },
|
|
11
|
+
location: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Country code (us, uk, es, de...) or DataForSEO location code. DEFAULTS TO us (United States) if omitted",
|
|
14
|
+
required: false,
|
|
15
|
+
},
|
|
16
|
+
language: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Language code or name. DEFAULTS TO en (English) if omitted",
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
limit: { type: "string", description: "Max results (default: 20, max: 1000)", required: false },
|
|
22
|
+
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false },
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const FIELDS = {
|
|
26
|
+
page: "Page URL",
|
|
27
|
+
etv: "Estimated monthly organic traffic",
|
|
28
|
+
keywords: "Total organic keywords the page ranks for",
|
|
29
|
+
top_10: "Keywords in positions 1-10",
|
|
30
|
+
};
|
|
31
|
+
export const relevantPagesCommand = defineCommand({
|
|
32
|
+
meta: {
|
|
33
|
+
name: "relevant-pages",
|
|
34
|
+
description: `Get the top pages of a competitor domain with traffic data.
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
baker research relevant-pages "competitor.com"
|
|
38
|
+
baker research relevant-pages "competitor.com" --location es --limit 10`,
|
|
39
|
+
},
|
|
40
|
+
args: {
|
|
41
|
+
target: { type: "positional", description: "Domain to analyze", required: true },
|
|
42
|
+
location: { type: "string", description: "Country code or location code (default: us)", required: false },
|
|
43
|
+
language: { type: "string", description: "Language code or name (default: en)", required: false },
|
|
44
|
+
limit: { type: "string", description: "Max results (default: 20, max: 1000)", required: false },
|
|
45
|
+
output: { type: "string", description: "Format: json|csv|md|jsonl", required: false, default: "json" },
|
|
46
|
+
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false },
|
|
47
|
+
},
|
|
48
|
+
run: async ({ args }) => {
|
|
49
|
+
const target = args.target;
|
|
50
|
+
const location = args.location || undefined;
|
|
51
|
+
const language = args.language || undefined;
|
|
52
|
+
const limit = args.limit ? Number(args.limit) : undefined;
|
|
53
|
+
const skipCache = args["no-cache"] ? true : undefined;
|
|
54
|
+
const queryContext = buildResearchQueryContext(location, language);
|
|
55
|
+
try {
|
|
56
|
+
const data = await apiPost("/api/research/relevant-pages", {
|
|
57
|
+
target,
|
|
58
|
+
location,
|
|
59
|
+
language,
|
|
60
|
+
limit,
|
|
61
|
+
skipCache,
|
|
62
|
+
});
|
|
63
|
+
warnDefaults(queryContext);
|
|
64
|
+
const format = args.output || "json";
|
|
65
|
+
if (format !== "json") {
|
|
66
|
+
writeResearchOutput(data, format);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
writeResearchJson({ ok: true, data, fields: FIELDS, note: RESEARCH_DATA_NOTE, query_context: queryContext });
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
handleResearchError(err);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=relevant-pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relevant-pages.js","sourceRoot":"","sources":["../../../src/commands/research/relevant-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE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EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;QAC/G,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
package/dist/env.d.ts
CHANGED
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,KAAK,GAAG,GAAG;IACT,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAGA,KAAK,GAAG,GAAG;IACT,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAIF,wBAAgB,MAAM,IAAI,GAAG,CAiB5B"}
|
package/dist/env.js
CHANGED
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,IAAI,MAAuB,CAAC;AAE5B,MAAM,UAAU,MAAM;IACpB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,SAAS,CAAC;YACjB,MAAM,EAAE;gBACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,+BAA+B,CAAC;gBAC5E,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,mCAAmC,CAAC;gBACzD,4BAA4B,EAAE,CAAC;qBAC5B,MAAM,EAAE;qBACR,KAAK,CAAC,UAAU,CAAC;qBACjB,QAAQ,EAAE;gBACb,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBAC5C,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC1C;YACD,UAAU,EAAE,OAAO,CAAC,GAAG;SACxB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ConnectionPlatform = "google_ads" | "ga4" | "gsc";
|
|
2
|
+
/**
|
|
3
|
+
* Shared error handler for "No Connection" scenarios.
|
|
4
|
+
* Provides a structured error for AI agents with a suggested fix and alternative commands.
|
|
5
|
+
*/
|
|
6
|
+
export declare function handleConnectionError(platform: ConnectionPlatform, originalMessage?: string): never;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../src/error-handler.ts"],"names":[],"mappings":"AAEA,KAAK,kBAAkB,GAAG,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAkCnG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { writeJsonEnvelope } from "./commands/ads/output.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared error handler for "No Connection" scenarios.
|
|
4
|
+
* Provides a structured error for AI agents with a suggested fix and alternative commands.
|
|
5
|
+
*/
|
|
6
|
+
export function handleConnectionError(platform, originalMessage) {
|
|
7
|
+
const platformName = {
|
|
8
|
+
google_ads: "Google Ads",
|
|
9
|
+
ga4: "Google Analytics 4",
|
|
10
|
+
gsc: "Google Search Console",
|
|
11
|
+
}[platform];
|
|
12
|
+
const alternative = {
|
|
13
|
+
google_ads: "keywords-for-site or research advertisers",
|
|
14
|
+
ga4: "lighthouse for page performance",
|
|
15
|
+
gsc: "keywords-for-site or research keyword-gap",
|
|
16
|
+
}[platform];
|
|
17
|
+
const code = {
|
|
18
|
+
google_ads: "NO_GOOGLE_ADS_CONNECTION",
|
|
19
|
+
ga4: "NO_GA4_CONNECTION",
|
|
20
|
+
gsc: "NO_GSC_CONNECTION",
|
|
21
|
+
}[platform];
|
|
22
|
+
const envelope = {
|
|
23
|
+
ok: false,
|
|
24
|
+
error: {
|
|
25
|
+
code,
|
|
26
|
+
message: originalMessage || `No ${platformName} connection found for this company.`,
|
|
27
|
+
fix: {
|
|
28
|
+
action: "authenticate",
|
|
29
|
+
explanation: `AGENT INSTRUCTION: You cannot resolve this error programmatically. The user has not connected their ${platformName} account. Step 1: Inform the user that they must connect ${platformName} in their Baker dashboard settings for direct data queries. Step 2: Do not fail the overall audit or playbook. Document the missing connection, skip this specific check, and proceed with the rest of your tasks. (Optional fallback: use 'baker research ${alternative}' for estimated external insights).`,
|
|
30
|
+
},
|
|
31
|
+
retryable: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
writeJsonEnvelope(envelope);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../src/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAI7D;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA4B,EAAE,eAAwB;IAC1F,MAAM,YAAY,GAAG;QACnB,UAAU,EAAE,YAAY;QACxB,GAAG,EAAE,oBAAoB;QACzB,GAAG,EAAE,uBAAuB;KAC7B,CAAC,QAAQ,CAAC,CAAC;IAEZ,MAAM,WAAW,GAAG;QAClB,UAAU,EAAE,2CAA2C;QACvD,GAAG,EAAE,iCAAiC;QACtC,GAAG,EAAE,2CAA2C;KACjD,CAAC,QAAQ,CAAC,CAAC;IAEZ,MAAM,IAAI,GAAG;QACX,UAAU,EAAE,0BAA0B;QACtC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB,CAAC,QAAQ,CAAC,CAAC;IAEZ,MAAM,QAAQ,GAAG;QACf,EAAE,EAAE,KAAK;QACT,KAAK,EAAE;YACL,IAAI;YACJ,OAAO,EAAE,eAAe,IAAI,MAAM,YAAY,qCAAqC;YACnF,GAAG,EAAE;gBACH,MAAM,EAAE,cAAc;gBACtB,WAAW,EAAE,uGAAuG,YAAY,4DAA4D,YAAY,8PAA8P,WAAW,qCAAqC;aACvf;YACD,SAAS,EAAE,KAAK;SACjB;KACF,CAAC;IAEF,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|