diff --git a/src/utils/PromptCreator.ts b/src/utils/PromptCreator.ts index b72c248..877f57c 100644 --- a/src/utils/PromptCreator.ts +++ b/src/utils/PromptCreator.ts @@ -217,6 +217,7 @@ export class PromptCreator { } steps.push( "If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence.", + "Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step.", "Wrap the generated code with backticks, without any additional formatting.", "Do not provide any additional code beyond the minimal executable code required to perform the intent." ); diff --git a/src/utils/__snapshots__/PromptCreator.test.ts.snap b/src/utils/__snapshots__/PromptCreator.test.ts.snap index ec26b5a..bf1cac8 100644 --- a/src/utils/__snapshots__/PromptCreator.test.ts.snap +++ b/src/utils/__snapshots__/PromptCreator.test.ts.snap @@ -123,8 +123,9 @@ Please follow these steps carefully: 1. Analyze the provided intent and the view hierarchy to understand the required action. 2. Generate the minimal executable code required to perform the intent using the available API. 3. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -4. Wrap the generated code with backticks, without any additional formatting. -5. Do not provide any additional code beyond the minimal executable code required to perform the intent. +4. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +5. Wrap the generated code with backticks, without any additional formatting. +6. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt @@ -251,8 +252,9 @@ Please follow these steps carefully: 1. Analyze the provided intent and the view hierarchy to understand the required action. 2. Generate the minimal executable code required to perform the intent using the available API. 3. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -4. Wrap the generated code with backticks, without any additional formatting. -5. Do not provide any additional code beyond the minimal executable code required to perform the intent. +4. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +5. Wrap the generated code with backticks, without any additional formatting. +6. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt @@ -393,8 +395,9 @@ Please follow these steps carefully: 1. Analyze the provided intent and the view hierarchy to understand the required action. 2. Generate the minimal executable code required to perform the intent using the available API. 3. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -4. Wrap the generated code with backticks, without any additional formatting. -5. Do not provide any additional code beyond the minimal executable code required to perform the intent. +4. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +5. Wrap the generated code with backticks, without any additional formatting. +6. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt @@ -509,8 +512,9 @@ Please follow these steps carefully: 5. If the visual assertion fails, return code that throws an informative error explaining the failure. 6. If visual validation is not possible, proceed to generate the minimal executable code required to perform the intent. 7. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -8. Wrap the generated code with backticks, without any additional formatting. -9. Do not provide any additional code beyond the minimal executable code required to perform the intent. +8. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +9. Wrap the generated code with backticks, without any additional formatting. +10. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt @@ -626,8 +630,9 @@ Please follow these steps carefully: 1. Analyze the provided intent and the view hierarchy to understand the required action. 2. Generate the minimal executable code required to perform the intent using the available API. 3. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -4. Wrap the generated code with backticks, without any additional formatting. -5. Do not provide any additional code beyond the minimal executable code required to perform the intent. +4. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +5. Wrap the generated code with backticks, without any additional formatting. +6. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt @@ -757,8 +762,9 @@ Please follow these steps carefully: 1. Analyze the provided intent and the view hierarchy to understand the required action. 2. Generate the minimal executable code required to perform the intent using the available API. 3. If you cannot generate the relevant code due to ambiguity or invalid intent, return code that throws an informative error explaining the problem in one sentence. -4. Wrap the generated code with backticks, without any additional formatting. -5. Do not provide any additional code beyond the minimal executable code required to perform the intent. +4. Each step must be completely independent - do not rely on any variables or assignments from previous steps. Even if a variable was declared or assigned in a previous step, you must redeclare and reassign it in your current step. +5. Wrap the generated code with backticks, without any additional formatting. +6. Do not provide any additional code beyond the minimal executable code required to perform the intent. ### Verify the prompt