forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbest-practices.ts
More file actions
47 lines (43 loc) · 1.36 KB
/
best-practices.ts
File metadata and controls
47 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { declareTool } from './tool-registry';
export const BEST_PRACTICES_TOOL = declareTool({
name: 'get_best_practices',
title: 'Get Angular Coding Best Practices Guide',
description:
'You **MUST** use this tool to retrieve the Angular Best Practices Guide ' +
'before any interaction with Angular code (creating, analyzing, modifying). ' +
'It is mandatory to follow this guide to ensure all code adheres to ' +
'modern standards, including standalone components, typed forms, and ' +
'modern control flow. This is the first step for any Angular task.',
isReadOnly: true,
isLocalOnly: true,
factory: () => {
let bestPracticesText: string;
return async () => {
bestPracticesText ??= await readFile(
path.join(__dirname, '..', 'instructions', 'best-practices.md'),
'utf-8',
);
return {
content: [
{
type: 'text',
text: bestPracticesText,
annotations: {
audience: ['assistant'],
priority: 0.9,
},
},
],
};
};
},
});