Merge branch 'main' into worktree-con-plan-bug

Resolves conflict in packages/core/src/tools/enter-plan-mode.test.ts by removing an assertion for directory creation, which has been centralized in config.ts in this branch.
This commit is contained in:
Mahima Shanware
2026-04-10 18:00:53 +00:00
372 changed files with 12785 additions and 6055 deletions
+40 -18
View File
@@ -696,9 +696,9 @@ function doIt() {
throw abortError;
});
await expect(invocation.execute(abortController.signal)).rejects.toBe(
abortError,
);
await expect(
invocation.execute({ abortSignal: abortController.signal }),
).rejects.toBe(abortError);
calculateSpy.mockRestore();
});
@@ -715,7 +715,9 @@ function doIt() {
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.llmContent).toMatch(/Successfully modified file/);
expect(fs.readFileSync(filePath, 'utf8')).toBe(newContent);
@@ -738,7 +740,9 @@ function doIt() {
new_string: 'replacement',
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.llmContent).toMatch(/0 occurrences found for old_string/);
expect(result.returnDisplay).toMatch(
/Failed to edit, could not find the string to replace./,
@@ -769,7 +773,9 @@ function doIt() {
});
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.error).toBeUndefined();
expect(result.llmContent).toMatch(/Successfully modified file/);
@@ -789,7 +795,7 @@ function doIt() {
};
const invocation = tool.build(params);
await invocation.execute(new AbortController().signal);
await invocation.execute({ abortSignal: new AbortController().signal });
const finalContent = fs.readFileSync(filePath, 'utf8');
expect(finalContent).toBe(newContent);
@@ -805,7 +811,7 @@ function doIt() {
};
const invocation = tool.build(params);
await invocation.execute(new AbortController().signal);
await invocation.execute({ abortSignal: new AbortController().signal });
const finalContent = fs.readFileSync(filePath, 'utf8');
expect(finalContent).toBe(newContentWithCRLF);
@@ -833,7 +839,9 @@ function doIt() {
});
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.error?.type).toBe(
ToolErrorType.EDIT_NO_CHANGE_LLM_JUDGEMENT,
@@ -877,7 +885,7 @@ function doIt() {
.mockResolvedValueOnce(externallyModifiedContent); // Second call in `attemptSelfCorrection`
const invocation = tool.build(params);
await invocation.execute(new AbortController().signal);
await invocation.execute({ abortSignal: new AbortController().signal });
// Assert that the file was read twice (initial read, then re-read for hash comparison).
expect(readTextFileSpy).toHaveBeenCalledTimes(2);
@@ -939,7 +947,9 @@ function doIt() {
instruction: 'test',
...params,
});
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.error?.type).toBe(expectedError);
},
);
@@ -1021,7 +1031,9 @@ function doIt() {
...(allow_multiple !== undefined && { allow_multiple }),
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
if (shouldSucceed) {
expect(result.error).toBeUndefined();
@@ -1163,7 +1175,9 @@ function doIt() {
ai_proposed_content: '',
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
if (
result.returnDisplay &&
@@ -1216,7 +1230,9 @@ function doIt() {
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_OCCURRENCE_FOUND);
expect(mockFixLLMEditWithInstruction).not.toHaveBeenCalled();
@@ -1237,7 +1253,7 @@ function doIt() {
};
const invocation = tool.build(params);
await invocation.execute(new AbortController().signal);
await invocation.execute({ abortSignal: new AbortController().signal });
expect(mockFixLLMEditWithInstruction).toHaveBeenCalled();
});
@@ -1266,7 +1282,9 @@ function doIt() {
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(discoverJitContext).toHaveBeenCalled();
expect(result.llmContent).toContain('Newly Discovered Project Context');
@@ -1295,7 +1313,9 @@ function doIt() {
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.llmContent).not.toContain(
'Newly Discovered Project Context',
@@ -1331,7 +1351,9 @@ function doIt() {
};
const invocation = tool.build(params);
const result = await invocation.execute(new AbortController().signal);
const result = await invocation.execute({
abortSignal: new AbortController().signal,
});
expect(result.llmContent).toMatch(/Successfully modified file/);