-
Strictly Prohibit Bypassing Predefined Scripts:
- All infrastructure operations (project initialization, dependency installation, packaging, etc.) must and can only call the corresponding scripts in the directory (e.g., ).
- Absolutely forbidden for AI to write temporary Shell/PowerShell commands (such as , , ) to directly call underlying tools or manually create project structures.
- Reason: Predefined scripts encapsulate complex environment detection, error handling, and parameter validation logic. Bypassing scripts will lead to environment inconsistencies and unmaintainable "zombie projects".
-
Script Priority Principle:
- If the predefined script functions are insufficient (e.g., missing parameters), you must first modify the script itself before calling the new script.
- Strictly forbidden to use "one-time" command-line workarounds for convenience.
-
Shell Environment Safety:
- Ban Bash: In Windows environments, strictly prohibit using or any form of Bash wrapper to execute PowerShell scripts. This will cause path escape errors (Exit Code 127).
- Native PowerShell: Must directly execute scripts using the PowerShell terminal.
- Path Handling: For paths containing Chinese characters or spaces, they must be wrapped in double quotes in PowerShell, without Bash-style escaping.
The following rules must be strictly followed; violations will cause plugin instability or security vulnerabilities:
-
IGenerateContext Usage:
- It is Request-Scoped, strictly forbidden to cache it in static variables.
- If auxiliary methods need to access the environment, they must pass it through parameters.
-
Data Access:
- Must use (ServerCommand) or (ServerAPI).
- Strictly forbidden to use or other ADO.NET connection objects, as this will break Forguncy's transaction chain.
- Parameterized Queries: Strictly forbidden to concatenate SQL strings; must use parameterized queries (e.g.,
ExecuteNonQuery("... @Val", new { Val = x })
).
-
Logging & Exceptions:
- Strictly forbidden to use .
- Must use (or ) for logging.
- Critical logic must be wrapped in blocks.
-
Formulas & Variables:
- For all properties that support variable binding, must mark and set the type to .
- At runtime, must use for parsing; strictly forbidden to manually parse strings.
-
Configuration Consistency:
- Mandatory Rule: After refactoring, renaming, or deleting plugin components (Command, CellType, ServerAPI, etc.), must synchronously check and update .
- Tool Guarantee: Prioritize using the tool to verify consistency between configuration and code.
- Defensive Check: If a class file is deleted, be sure to confirm that no longer contains references to that class, otherwise it will cause Forguncy to fail to load the plugin.
-
Environment Dependencies & Build Repair (Critical Protocol):
- Trigger Conditions: When encountering failures, missing Assembly references (e.g.,
GrapeCity.Forguncy.ServerApi
not found), path errors (e.g., ForguncyPluginPackageTool
does not exist), or debugging startup failures (invalid path).
- Forbidden Actions: Absolutely forbidden for AI to use commands like , , to scan the user's hard drive (e.g., , ) to find installation paths. Absolutely forbidden to guess paths.
- Mandatory Action (STOP & ASK): Must immediately stop all subsequent operations and directly ask the user: "Detected missing or mismatched Forguncy Designer path. Please provide the installation path of the Forguncy Designer on your current computer (e.g.,
C:\Program Files\Forguncy\ForguncyDesigner
)."
-
Simplicity & Safety Principle:
- Minimal API: Strictly forbidden to expose internal technical parameters; only retain business semantic properties.
- Logic Reuse: Mandatory to extract data conversion pipeline functions to ensure consistent logic between and .
- Synchronized Lifecycle: JS lifecycle methods (e.g., ) absolutely forbidden to be declared as .
- Secure Data Access: Must use parameterized queries; strictly forbidden to concatenate SQL.
-
No Over-engineering:
- Prioritize using built-in Forguncy features.
- Keep the project structure flat; avoid unnecessary abstraction layers.
-
Designer Preview On-Demand Prompt:
- Strictly Forced Promotion: If the user does not explicitly express the need for "preview effects in the designer", strictly forbidden to include design-time logic such as in generated code or suggestions.
- Simplicity First: By default, only generate core runtime logic to keep the code structure clear. Only when the user emphasizes "what you see is what you get" should you introduce preview-related defensive programming and UI refresh techniques.
To improve development efficiency, this project provides the following supporting tools:
Please strictly follow the process defined in
and the following steps to handle user requests:
-
Common Misconception Corrections:
- ❌ Wrong Idea: "I am an AI and cannot run GUI, so I should generate code for the user to run themselves, or help the user create files manually."
- ✅ Correct Approach: Use tools to do the work. If the environment supports it, you should directly call to execute the predefined initialization script.
- ❌ Wrong Idea: "I called the script, so I assume the user has already created the project, and I can immediately continue generating subsequent code."
- ✅ Correct Approach: Must wait for confirmation. The builder is a GUI program, and AI cannot perceive when the user completes the clicks. Must explicitly pause and wait for the user to feedback "done" before continuing to generate code.
-
Execution Steps:
- Prepare Script: Use . This script has built-in common path detection logic.
- Execution Action:
- Recommended: Use the tool to execute the script directly in the terminal:
powershell -File scripts/init_project.ps1
.
- Mandatory Pause:
- Successful script execution only means "the builder has been launched", not that the project has been created.
- Strictly forbidden to continue generating subsequent business code (such as files) in the same response.
- Must reply with something like: "The builder has been launched. Please complete the project creation steps in the pop-up GUI window. Please tell me when it's done, and I will generate the subsequent code for you."
- Forbidden Degradation: Unless the user explicitly replies "I haven't installed the builder" or "the script can't run", strictly forbidden to actively provide a manual creation solution.
I want to create a new plugin for generating QR codes.
Initializing Forguncy plugin project for you.
Note: To avoid NuGet dependency version conflicts, I will try to launch the official builder for you.
(AI calls RunCommand to execute scripts/init_project.ps1 logic...)
Builder started successfully! Please complete the project creation in the pop-up window.
(AI stops generating, waiting for user reply)
Please tell me when it's done, and I will generate the C# code for QR code generation.
The project is created, continue.
Okay, now that the project is ready, let's write the code for QR code generation.
This is a server-side command plugin code:
csharp
using System;
// ... (code content) ...