Skip to content

Commit 9b15797

Browse files
committed
fix cursorrules
1 parent 4004004 commit 9b15797

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

.cursorrule

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,8 @@ my-project/
178178
│ ├── flow.ts
179179
│ ├── types.ts
180180
│ └── utils/
181-
│ ├── index.ts
182181
│ ├── callLlm.ts
183182
│ └── searchWeb.ts
184-
├── tests/
185-
│ ├── flow.test.ts
186-
│ └── nodes.test.ts
187183
├── docs/
188184
│ └── design.md
189185
├── package.json
@@ -195,15 +191,14 @@ my-project/
195191
- **`src/utils/`**: Contains all utility functions.
196192
- It's recommended to dedicate one TypeScript file to each API call, for example `callLlm.ts` or `searchWeb.ts`.
197193
- Each file should export functions that can be imported elsewhere in the project
198-
- Include tests in the `tests` directory for each utility function
194+
- Include test cases for each utility function using `utilityFunctionName.test.ts`
199195
- **`src/nodes.ts`**: Contains all the node definitions.
200196

201197
```typescript
202198
// src/types.ts
203199
export interface QASharedStore {
204200
question?: string;
205201
answer?: string;
206-
[key: string]: unknown;
207202
}
208203
```
209204

@@ -212,9 +207,12 @@ my-project/
212207
import { Node } from "pocketflow";
213208
import { callLlm } from "./utils/callLlm";
214209
import { QASharedStore } from "./types";
210+
import PromptSync from "prompt-sync";
211+
212+
const prompt = PromptSync();
215213

216214
export class GetQuestionNode extends Node<QASharedStore> {
217-
async exec(_: unknown): Promise<string> {
215+
async exec(): Promise<string> {
218216
// Get question directly from user input
219217
const userQuestion = prompt("Enter your question: ") || "";
220218
return userQuestion;
@@ -260,6 +258,7 @@ my-project/
260258
// src/flow.ts
261259
import { Flow } from "pocketflow";
262260
import { GetQuestionNode, AnswerNode } from "./nodes";
261+
import { QASharedStore } from "./types";
263262

264263
export function createQaFlow(): Flow {
265264
// Create nodes
@@ -270,7 +269,7 @@ my-project/
270269
getQuestionNode.next(answerNode);
271270

272271
// Create flow starting with input node
273-
return new Flow(getQuestionNode);
272+
return new Flow<QASharedStore>(getQuestionNode);
274273
}
275274
```
276275

@@ -299,12 +298,6 @@ my-project/
299298
main().catch(console.error);
300299
```
301300

302-
- **`tests/`**: Contains test files that verify the functionality of your nodes, flows, and utilities.
303-
304-
- Use a testing framework like Jest or Mocha
305-
- Write tests for each node, flow, and utility function
306-
- Consider using mock data and interfaces for testing
307-
308301
- **`package.json`**: Contains project metadata and dependencies.
309302

310303
- **`tsconfig.json`**: Contains TypeScript compiler configuration.

docs/guide.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,8 @@ my-project/
172172
│ ├── flow.ts
173173
│ ├── types.ts
174174
│ └── utils/
175-
│ ├── index.ts
176175
│ ├── callLlm.ts
177176
│ └── searchWeb.ts
178-
├── tests/
179-
│ ├── flow.test.ts
180-
│ └── nodes.test.ts
181177
├── docs/
182178
│ └── design.md
183179
├── package.json
@@ -189,15 +185,14 @@ my-project/
189185
- **`src/utils/`**: Contains all utility functions.
190186
- It's recommended to dedicate one TypeScript file to each API call, for example `callLlm.ts` or `searchWeb.ts`.
191187
- Each file should export functions that can be imported elsewhere in the project
192-
- Include tests in the `tests` directory for each utility function
188+
- Include test cases for each utility function using `utilityFunctionName.test.ts`
193189
- **`src/nodes.ts`**: Contains all the node definitions.
194190
195191
```typescript
196192
// src/types.ts
197193
export interface QASharedStore {
198194
question?: string;
199195
answer?: string;
200-
[key: string]: unknown;
201196
}
202197
```
203198

@@ -206,9 +201,12 @@ my-project/
206201
import { Node } from "pocketflow";
207202
import { callLlm } from "./utils/callLlm";
208203
import { QASharedStore } from "./types";
204+
import PromptSync from "prompt-sync";
205+
206+
const prompt = PromptSync();
209207

210208
export class GetQuestionNode extends Node<QASharedStore> {
211-
async exec(_: unknown): Promise<string> {
209+
async exec(): Promise<string> {
212210
// Get question directly from user input
213211
const userQuestion = prompt("Enter your question: ") || "";
214212
return userQuestion;
@@ -254,6 +252,7 @@ my-project/
254252
// src/flow.ts
255253
import { Flow } from "pocketflow";
256254
import { GetQuestionNode, AnswerNode } from "./nodes";
255+
import { QASharedStore } from "./types";
257256

258257
export function createQaFlow(): Flow {
259258
// Create nodes
@@ -264,7 +263,7 @@ my-project/
264263
getQuestionNode.next(answerNode);
265264

266265
// Create flow starting with input node
267-
return new Flow(getQuestionNode);
266+
return new Flow<QASharedStore>(getQuestionNode);
268267
}
269268
```
270269

@@ -293,12 +292,6 @@ my-project/
293292
main().catch(console.error);
294293
```
295294

296-
- **`tests/`**: Contains test files that verify the functionality of your nodes, flows, and utilities.
297-
298-
- Use a testing framework like Jest or Mocha
299-
- Write tests for each node, flow, and utility function
300-
- Consider using mock data and interfaces for testing
301-
302295
- **`package.json`**: Contains project metadata and dependencies.
303296

304297
- **`tsconfig.json`**: Contains TypeScript compiler configuration.

0 commit comments

Comments
 (0)