Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: switch to some new AI snapshots #232

Merged
merged 4 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading