Skip to content

Commit

Permalink
feat: switch to some new AI snapshots (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante authored Aug 11, 2024
1 parent 41f89f7 commit 3d8329d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
10 changes: 4 additions & 6 deletions .grit/patterns/js/angularjs_to_angular.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -30,7 +29,7 @@ angular.module('phoneList').component('phoneList', {
'Phone',
function PhoneListController(Phone) {
this.phones = Phone.query();
this.orderProp = 'age';
this.orderProp = 'brand';
},
],
});
Expand All @@ -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();
}
}

```
3 changes: 2 additions & 1 deletion .grit/patterns/js/enzyme_rtl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
12 changes: 6 additions & 6 deletions .grit/patterns/js/es6_imports_to_require.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```
3 changes: 1 addition & 2 deletions .grit/patterns/universal/ai/_js_transform.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion .grit/patterns/universal/ai/ai_rewrite.grit
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pattern after_each_file_global_rewrites() {
],

$answer = llm_chat($messages, $pattern, model="claude-3-5-sonnet-20240620", stop_sequences=["</file>"]),
$answer <: includes r"(?:\s+)([\s\S]+?)\s*</file>"($final),
$answer <: includes r"(?:\s*)([\s\S]+?)\s*</file>"($final),
$body => `$final\n`
}
}
Expand Down

0 comments on commit 3d8329d

Please sign in to comment.