@koda-sl/baker-cli 0.105.0 → 0.105.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/README.md CHANGED
@@ -236,7 +236,7 @@ The CLI rejects or automatically corrects common GAQL mistakes before hitting th
236
236
  | Pattern | Behavior | Warning/error emitted |
237
237
  |---------|----------|-----------------------|
238
238
  | Missing LIMIT | Adds `LIMIT 200` | `"Added LIMIT 200. Use --limit to override."` |
239
- | `keyword.text` | Rewrites to `ad_group_criterion.keyword.text` | `"keyword.text → ad_group_criterion.keyword.text"` |
239
+ | Bare `keyword.text` / `keyword.match_type` | Rewrites to `ad_group_criterion.*` (resource-scoped forms like `shared_criterion.keyword.text` pass through untouched) | `"keyword.text → ad_group_criterion.keyword.text"` |
240
240
  | `shopping_performance_view.product_*` | Rewrites to `segments.product_*` | Field renamed |
241
241
  | `campaign.status = 'ACTIVE'` | Rewrites to `= 'ENABLED'` | Enum corrected |
242
242
  | `segments.conversion_action_name` with `metrics.cost_micros` | Rejects; split into separate conversion-action and spend queries | `INCOMPATIBLE_FIELDS` with `fix.action: "split_query"` |
package/dist/cli.js CHANGED
@@ -2623,12 +2623,12 @@ function buildCommand(query, ctx) {
2623
2623
  return `baker ads google query "${query}" --customer-id ${ctx.customerId}`;
2624
2624
  }
2625
2625
  var CORRECTION_RULES = [
2626
- // 1. keyword.text → ad_group_criterion.keyword.text
2626
+ // 1. bare keyword.text → ad_group_criterion.keyword.text (leaves <resource>.keyword.text untouched)
2627
2627
  {
2628
- matchQuery: /\bkeyword\.text\b/,
2628
+ matchQuery: /(?<![\w.])keyword\.text\b/,
2629
2629
  matchApiError: /keyword\.text/i,
2630
2630
  fix: (ctx) => {
2631
- const corrected = ctx.originalQuery.replace(/\bkeyword\.text\b/g, "ad_group_criterion.keyword.text");
2631
+ const corrected = ctx.originalQuery.replace(/(?<![\w.])keyword\.text\b/g, "ad_group_criterion.keyword.text");
2632
2632
  return {
2633
2633
  action: "retry_with_modified_query",
2634
2634
  correctedCommand: buildCommand(corrected, ctx),
@@ -2636,12 +2636,15 @@ var CORRECTION_RULES = [
2636
2636
  };
2637
2637
  }
2638
2638
  },
2639
- // 2. keyword.match_type → ad_group_criterion.keyword.match_type
2639
+ // 2. bare keyword.match_type → ad_group_criterion.keyword.match_type (leaves <resource>.keyword.match_type untouched)
2640
2640
  {
2641
- matchQuery: /\bkeyword\.match_type\b/,
2641
+ matchQuery: /(?<![\w.])keyword\.match_type\b/,
2642
2642
  matchApiError: /keyword\.match_type/i,
2643
2643
  fix: (ctx) => {
2644
- const corrected = ctx.originalQuery.replace(/\bkeyword\.match_type\b/g, "ad_group_criterion.keyword.match_type");
2644
+ const corrected = ctx.originalQuery.replace(
2645
+ /(?<![\w.])keyword\.match_type\b/g,
2646
+ "ad_group_criterion.keyword.match_type"
2647
+ );
2645
2648
  return {
2646
2649
  action: "retry_with_modified_query",
2647
2650
  correctedCommand: buildCommand(corrected, ctx),
@@ -3993,12 +3996,12 @@ function buildCommand2(query, customerId) {
3993
3996
  function applyAutoFixes(query, limit) {
3994
3997
  let corrected = query;
3995
3998
  const warnings = [];
3996
- if (/\bkeyword\.text\b/.test(corrected) && !/ad_group_criterion\.keyword\.text/.test(corrected)) {
3997
- corrected = corrected.replace(/\bkeyword\.text\b/g, "ad_group_criterion.keyword.text");
3999
+ if (/(?<![\w.])keyword\.text\b/.test(corrected)) {
4000
+ corrected = corrected.replace(/(?<![\w.])keyword\.text\b/g, "ad_group_criterion.keyword.text");
3998
4001
  warnings.push({ code: "FIELD_RENAMED", message: "keyword.text \u2192 ad_group_criterion.keyword.text" });
3999
4002
  }
4000
- if (/\bkeyword\.match_type\b/.test(corrected) && !/ad_group_criterion\.keyword\.match_type/.test(corrected)) {
4001
- corrected = corrected.replace(/\bkeyword\.match_type\b/g, "ad_group_criterion.keyword.match_type");
4003
+ if (/(?<![\w.])keyword\.match_type\b/.test(corrected)) {
4004
+ corrected = corrected.replace(/(?<![\w.])keyword\.match_type\b/g, "ad_group_criterion.keyword.match_type");
4002
4005
  warnings.push({ code: "FIELD_RENAMED", message: "keyword.match_type \u2192 ad_group_criterion.keyword.match_type" });
4003
4006
  }
4004
4007
  if (/shopping_performance_view\.product_\w+/.test(corrected)) {