@synchronized-studio/cmsassets-agent 0.5.1 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,10 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Fixed
6
+
7
+ - **Scanner — false positive CMS detection from comments**: `hasCmsFetchSignal()` was matching CMS keywords found in `//` and `/* */` comments (e.g. `// Prismic link objects:`). Now strips all comments before pattern matching, preventing utility composables like `useFilterField` from being incorrectly flagged as CMS data files.
8
+ - **Scanner — overly broad `CMS_FETCH_PATTERNS`**: Patterns were matching bare words like `prismic` in variable names or JSX component names (`PrismicLink`). Patterns are now scoped to package imports (`from '@prismicio/'`), SDK instance calls (`$prismic.`, `usePrismic()`, `createClient()`), and CMS CDN URL patterns — not arbitrary word matches.
9
+ - **Scanner — router/URL object returns incorrectly flagged**: `return { query: ... }`, `return { path: '...' }`, `return { redirect: ... }`, `return { statusCode: }`, `return { headers: }`, `return { ...route.query }` are now excluded from `NON_DATA_RETURN_PATTERNS` and will never be treated as CMS data injection points.
10
+ - **Scanner — new callback property exclusions**: `filter:`, `sort:`, `where:`, `orderBy:`, `select:` added to `CALLBACK_PROPERTY_PATTERNS` so query-builder callbacks are not mistaken for data returns.
11
+ - **Patcher/Planner — `__runtimeConfig` undefined variable**: `resolveRuntimeConfigRef` could leave `__runtimeConfig` in the output without injecting the declaration. The structural validator now detects this via `detectUnresolvedPlaceholders()` and blocks the patch.
12
+ - **Patcher — new `checkNonCmsReturnWrapping` guard**: Added to both AST/hybrid and AI patch modes in `patcher/index.ts`. Prevents wrapping of router/navigation/HTTP return objects even if the scanner missed them (defense-in-depth).
13
+ - **Planner — belt-and-suspenders guard**: `createPlan()` now calls `checkNonCmsReturnWrapping()` before emitting a patch, so router returns are filtered at plan creation time as well.
14
+ - **Rescan — comment false positives**: `findUnwrappedCmsCalls()` in `rescan.ts` now strips `//` and `/* */` comments before checking for unwrapped CMS calls, preventing false positives in the AI verify phase.
15
+ - **AI prompts updated**: `aiFilePatch.ts` and `aiReview.ts` prompts now explicitly forbid wrapping of navigation/routing objects and flag undefined `__runtimeConfig` references.
16
+
17
+ ### Tests
18
+
19
+ - Added `tests/fixtures/nuxt-prismic/composables/useFilterField.js` — realistic utility composable with Prismic mentions only in comments.
20
+ - Scanner tests: verifies `useFilterField` produces zero injection points; verifies `{ query: }` and `{ path: }` returns are excluded.
21
+ - Structural validator tests: `detectUnresolvedPlaceholders` rejects `__runtimeConfig` without declaration; `checkNonCmsReturnWrapping` correctly classifies router vs. CMS returns.
22
+
3
23
  ## 0.5.1
4
24
 
5
25
  ### Fixed
6
26
  - **Vue/Nuxt**: When injecting `const __runtimeConfig = useRuntimeConfig()` in `.vue` files, the declaration is now placed before the full destructuring block instead of inside it. Previously, multiline destructuring like `const { data, error } = await useAsyncData(...)` could be corrupted (declaration inserted between `}` and `= await useAsyncData`, breaking syntax). The patcher now walks back to the opening `const {` line and inserts there.
7
27
 
28
+ ## 0.5.0
29
+
30
+ ### Added
31
+ - **AI-first patching mode** (`--patch-mode ai`): sends entire files to an LLM for transformation instead of AST surgery. New `aiFilePatch.ts` module.
32
+ - **Structural validator** (`structuralValidator.ts`): pre/post-patch snapshot comparison that catches broken exports, missing functions, unreachable code, and function-value wrapping errors.
33
+ - **Nuxt runtimeConfig injection** (`injectNuxtRuntimeConfig.ts`): automatically adds `runtimeConfig.public.cmsAssetsUrl` to `nuxt.config` (inline or external file). Idempotent.
34
+ - **`__runtimeConfig` placeholder system**: planner emits `__runtimeConfig.public.cmsAssetsUrl` in Nuxt 3 client-side patches; `resolveRuntimeConfigRef` resolves it to an existing `useRuntimeConfig()` variable or injects a new one.
35
+ - **Nuxt 2 support**: scanner detects `asyncData` hooks and Vuex store actions with CMS fetches; planner generates `asyncData-return`, `vuex-action-return`, and `vuex-commit` wrap templates.
36
+ - **Factory return detection**: `isFactoryReturn()` skips objects like `return { getPage, generateMetadata }` where all shorthand props are locally defined functions.
37
+ - **`useAsyncData-transform` / `useFetch-transform`** injection types for Nuxt 3 pages and composables — adds `{ transform: (raw) => fn(raw, opts) }` option instead of wrapping the return.
38
+ - Callback-return filtering: return statements inside `useAsyncData`/`useFetch` callbacks are excluded from generic `return` candidates.
39
+ - Test fixtures for Nuxt 2 + Contentful (`nuxt2-contentful/`), Nuxt 3 + Prismic pages and composables.
40
+
41
+ ### Changed
42
+ - Scanner: multiline return expansion, improved `looksLikeDataReturn` heuristics, `isInsideCallbackOption` guard, non-data return exclusions.
43
+ - Planner: `buildCmsOptions` accepts `runtimeUrlExpr` for client-side Nuxt 3 patches.
44
+ - AST patcher: 5-strategy matching system with +-1 line tolerance and near-line fallback.
45
+ - String patcher (Vue/Svelte/Astro): deterministic `__runtimeConfig` resolution before string replacement.
46
+ - Verifier: expanded profiles and rescan logic.
47
+ - CLI version bumped to `0.5.0`.
48
+
49
+ ### Removed
50
+ - Deleted legacy `llmFallback.ts` (replaced by `aiFilePatch.ts` and `--patch-mode` system).
51
+
8
52
  ## 0.4.0
9
53
 
10
54
  ### Breaking changes
@@ -0,0 +1,9 @@
1
+ import {
2
+ aiReviewAll
3
+ } from "./chunk-GMERN6MA.js";
4
+ import "./chunk-W7TNFULQ.js";
5
+ import "./chunk-E74TGIFQ.js";
6
+ import "./chunk-QGM4M3NI.js";
7
+ export {
8
+ aiReviewAll
9
+ };