From 3d8329d6ebed4c71d428250780acaf4ecfd23793 Mon Sep 17 00:00:00 2001 From: Morgante Pell Date: Sun, 11 Aug 2024 12:34:03 -0700 Subject: [PATCH] feat: switch to some new AI snapshots (#232) --- .grit/patterns/js/angularjs_to_angular.md | 10 ++++------ .grit/patterns/js/enzyme_rtl.md | 3 ++- .grit/patterns/js/es6_imports_to_require.md | 12 ++++++------ .grit/patterns/universal/ai/_js_transform.md | 3 +-- .grit/patterns/universal/ai/ai_rewrite.grit | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.grit/patterns/js/angularjs_to_angular.md b/.grit/patterns/js/angularjs_to_angular.md index db89b8f3..a074409c 100644 --- a/.grit/patterns/js/angularjs_to_angular.md +++ b/.grit/patterns/js/angularjs_to_angular.md @@ -1,12 +1,11 @@ --- -tags: [angularjs, angular, upgrade, wip, hidden, ai] +tags: [angularjs, angular, upgrade, wip, hidden, ai, flaky] --- # Upgrade from AngularJS to Angular [WIP] This pattern provides a basic build configuration for upgrading from AngularJS to Angular. It is still a work in progress. - ```grit language js @@ -30,7 +29,7 @@ angular.module('phoneList').component('phoneList', { 'Phone', function PhoneListController(Phone) { this.phones = Phone.query(); - this.orderProp = 'age'; + this.orderProp = 'brand'; }, ], }); @@ -47,15 +46,14 @@ import { Phone } from './phone.service'; @Component({ selector: 'app-phone-list', templateUrl: './phone-list.component.html', - providers: [Phone] + providers: [Phone], }) export class PhoneListComponent { phones: any[]; - orderProp = 'age'; + orderProp = 'brand'; constructor(private phoneService: Phone) { this.phones = this.phoneService.query(); } } - ``` diff --git a/.grit/patterns/js/enzyme_rtl.md b/.grit/patterns/js/enzyme_rtl.md index e6c65ea2..66c29918 100644 --- a/.grit/patterns/js/enzyme_rtl.md +++ b/.grit/patterns/js/enzyme_rtl.md @@ -124,7 +124,8 @@ describe('Modal', () => { ``` ```js -import { render, screen } from '@testing-library/react'; + +import { render, screen } from "@testing-library/react"; import TestModel from './modal'; diff --git a/.grit/patterns/js/es6_imports_to_require.md b/.grit/patterns/js/es6_imports_to_require.md index 84a6f705..e2b51d29 100644 --- a/.grit/patterns/js/es6_imports_to_require.md +++ b/.grit/patterns/js/es6_imports_to_require.md @@ -43,12 +43,12 @@ import defaultImport from '../../shared/default'; ``` ```ts -const { something, another } = require('./lib'); -const { assert } = require('chai'); -const { config: conf } = require('chai'); -const { mixed: mixie, foo } = require('life'); -const starImport = require('star'); +const { something, another } = require("./lib") +const { assert } = require("chai") +const { config: conf } = require("chai") +const { mixed: mixie, foo } = require("life") +const starImport = require("star") // no special handling for default. Also, comments get removed. -const defaultImport = require('../../shared/default'); +const defaultImport = require("../../shared/default") ``` diff --git a/.grit/patterns/universal/ai/_js_transform.md b/.grit/patterns/universal/ai/_js_transform.md index 20ef3c78..b0bbbd15 100644 --- a/.grit/patterns/universal/ai/_js_transform.md +++ b/.grit/patterns/universal/ai/_js_transform.md @@ -1,12 +1,11 @@ --- -tags: [ai, hidden, test] +tags: [ai, hidden, test, flaky] --- # AI transform - JS GritQL can use AI to transform a target variable based on some instruction using the `ai_transform` function. - ```grit language js diff --git a/.grit/patterns/universal/ai/ai_rewrite.grit b/.grit/patterns/universal/ai/ai_rewrite.grit index a1bab853..3e22b485 100644 --- a/.grit/patterns/universal/ai/ai_rewrite.grit +++ b/.grit/patterns/universal/ai/ai_rewrite.grit @@ -47,7 +47,7 @@ pattern after_each_file_global_rewrites() { ], $answer = llm_chat($messages, $pattern, model="claude-3-5-sonnet-20240620", stop_sequences=[""]), - $answer <: includes r"(?:\s+)([\s\S]+?)\s*"($final), + $answer <: includes r"(?:\s*)([\s\S]+?)\s*"($final), $body => `$final\n` } }