-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathtest-results-plan.txt
111 lines (87 loc) · 4.92 KB
/
test-results-plan.txt
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Using file provider: gemini
Using file model: gemini-2.0-flash-thinking-exp
Using thinking provider: openai
Using thinking model: o3-mini
Finding relevant files...
Running repomix to get file listing...
Found 85 files, approx 93609 tokens.
Asking gemini to identify relevant files using model: gemini-2.0-flash-thinking-exp with max tokens: 8192...
Found 5 relevant files:
src/commands/index.ts
src/types.ts
package.json
test.js
tests/
Extracting content from relevant files...
Generating implementation plan using openai with max tokens: 8192...
Below is one detailed plan to add a new “test” command to the repository. In this example, we create a new command file that implements the Command interface and then register it in the central command map. (Note: There’s already a package.json “test” script for vitest, but this “test” command is independent and meant to be used via the CLI for a custom operation.)
───────────────────────────────
Step 1. Create the Command Implementation
• Create a new file at src/commands/test.ts.
• In that file, implement a TestCommand class that conforms to the Command interface (defined in src/types.ts). For example, the command could simply yield a message indicating it has been executed.
Example content for src/commands/test.ts:
--------------------------------------------------
import type { Command, CommandOptions, CommandGenerator } from '../types.ts';
export class TestCommand implements Command {
async *execute(query: string, options: CommandOptions): CommandGenerator {
// Optionally, you might do some real testing logic here.
yield `Test command executed. Received query: "${query}" with options: ${JSON.stringify(options)}`;
}
}
--------------------------------------------------
───────────────────────────────
Step 2. Register the New Command
• Open the file src/commands/index.ts.
• Import the TestCommand.
• Add the command instance to the exported commands object with a key (e.g., "test").
Modify src/commands/index.ts to include the new command. For example, add the following:
--------------------------------------------------
import { TestCommand } from './test.ts'; // <-- add this import
export const commands: CommandMap = {
web: new WebCommand(),
repo: new RepoCommand(),
install: new InstallCommand(),
doc: new DocCommand(),
github: new GithubCommand(),
browser: new BrowserCommand(),
plan: new PlanCommand(),
ask: new AskCommand(),
mcp: new MCPCommand(),
test: new TestCommand(), // <-- new test command added here
};
--------------------------------------------------
───────────────────────────────
Step 3. Validate Your Command
Option A: Manually run the command via your CLI if the application has a mechanism for invoking the registered commands. For example:
• Run something like:
node dist/index.mjs test "sample query" --debug
• (Or use your built binary: cursor-tools test "sample query" --debug)
Option B: Write a simple unit test invoking the command’s execute() method.
Example for local testing (you might add a quick test in test.js or a dedicated test file):
--------------------------------------------------
// Example snippet to test the new command manually:
import { commands } from './src/commands/index.js';
async function run() {
const testCommand = commands.test;
const generator = testCommand.execute("hello world", { debug: true });
for await (const message of generator) {
console.log(message);
}
}
run();
--------------------------------------------------
───────────────────────────────
Assumptions & Options
• Assumption: The “test” command is meant as an additional command registered with the existing CLI application.
• Option: If you prefer to have the test command do something more advanced (for example, run a suite of internal tests, check external services, etc.), modify the logic inside execute().
• Option: Name the command differently if there could be any ambiguity with package.json’s “test” script. For example, you might call the key “cmd-test” in index.ts and update your CLI runner accordingly.
• Option: If the CLI framework supports help messages or documentation output, consider adding additional inline documentation in TestCommand.
───────────────────────────────
Commands to Run (After Your Changes)
1. Build/Compile your project. For example, if you’re using TypeScript, run:
npm run compile
or
tsc -build
2. Then run your application by invoking:
node dist/index.mjs test "sample query" --debug
This plan, along with the provided file paths and code snippets, should integrate the new test command with the existing repository structure.