Skip to content

Commit a473329

Browse files
committed
split-off! Update all model classes to Electron API 39.2
1 parent 0fa5477 commit a473329

2 files changed

Lines changed: 271 additions & 0 deletions

File tree

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
# Electron.NET Entities Audit – MCP-Driven Instructions (Internal)
2+
3+
> Internal instructions for Cline to restore the current reasoning state from zero.
4+
> Audience: the assistant only. Human readability is not required but acceptable.
5+
6+
---
7+
8+
## 1. Absolute Rules
9+
10+
1. Electron API information **must come only** from the MCP server `docs-mcp-server`.
11+
2. The only relevant library in that server for this task is currently:
12+
- `electronjs`
13+
3. Do **not** use:
14+
- Your own remembered Electron knowledge.
15+
- External web requests or documentation.
16+
- Any assumption that is not traceable to the MCP results.
17+
4. For **every Entity class and every member** (property/field):
18+
- Ensure **all members that exist in the Electron docs are present** in C#.
19+
- Ensure C# **types** match the Electron semantics (including, but not limited to, numeric ones).
20+
- Ensure XML documentation is **accurate and complete** relative to the MCP text (fix inaccuracies, add missing detail when MCP provides it).
21+
5. If the MCP docs (via `search_docs`) do not provide enough information to decide something:
22+
- **Do not modify** the affected Entity or property.
23+
- Explicitly treat it as “undecidable from MCP data alone”.
24+
6. Numeric properties are **high risk** for deserialization, especially when Electron sends fractional values into C# integral fields.
25+
- There is a dedicated tracking file: `ElectronNET.API/API/Entities/NumericPropertiesToCheck.txt`.
26+
- Only numeric properties in Bucket B or Bucket C (see section 4) — i.e. values that may practically be fractional or are ambiguous from MCP docs — must be listed there as `ClassName.PropertyName`. Clearly integral Bucket A fields (ids, counts, bit depths, etc.) are **not** recorded there.
27+
28+
---
29+
30+
## 2. Allowed MCP Tools and How to Use Them
31+
32+
Server: `docs-mcp-server`
33+
34+
### 2.1 Tools
35+
36+
- `list_libraries`
37+
- Purpose: confirm available libraries.
38+
- For this task: used once to discover `electronjs`. No need to repeat unless configuration changes.
39+
40+
- `search_docs`
41+
- **Primary tool.**
42+
- Parameters:
43+
- `library`: `"electronjs"`
44+
- `query`: free-text query targeting a specific Electron API or structure.
45+
- `limit`: small integer (`1``5`) to keep responses compact.
46+
- `version`: optional (may be added if version-specific behavior is needed later).
47+
- Behavior:
48+
- Returns a small number of documentation excerpts (markdown blocks) with URLs and surrounding context.
49+
- This is the authoritative source for field names, types, and semantics.
50+
- Usage patterns:
51+
- Structures: `"api/structures/<name>"` (e.g. `"api/structures/display"`).
52+
- Modules: `"api/<module>"` (e.g. `"api/screen"`, `"api/notification"`).
53+
54+
- **Do not use** for this workflow unless explicitly instructed:
55+
- `scrape_docs`, `refresh_version`, `list_jobs`, `get_job_info`, `cancel_job`, `remove_docs`.
56+
- `fetch_url` (direct URL fetch is not the intended access pattern for Electron docs here).
57+
58+
### 2.2 MCP Argument Discipline
59+
60+
- When calling any `docs-mcp-server` tool (`search_docs`, `list_libraries`, etc.), **only** send parameters that are explicitly defined by that tool.
61+
- Do **not** send extra fields such as `task_progress` or any other metadata; these can break the server.
62+
- For `search_docs`, the allowed parameters are: `library`, `query`, `limit`, and optional `version`.
63+
64+
### 2.3 MCP Connection Failures
65+
66+
- If any MCP call (`search_docs`, `list_libraries`, etc.) fails due to connection/tool errors (e.g. "No connection found for server", transport errors, malformed-argument errors):
67+
- **Do not** conclude that there is "no MCP coverage" or that docs do not exist.
68+
- **Do not** proceed with code or documentation changes for the affected Entity.
69+
- **Stop all MCP-dependent work** and explicitly request user assistance via the Cline follow-up mechanism (ask the user to "Retry MCP Connection" or otherwise fix the MCP integration).
70+
- Only treat a structure as "not found in MCP" when:
71+
- `search_docs` executes successfully, and
72+
- The server explicitly returns a "No results found" response for a reasonable, structure-targeted query.
73+
- Never apply the `Up-to-date with Electron API 39.2` remark, change types, or adjust members based on assumptions made while the MCP server is unavailable or misconfigured.
74+
75+
---
76+
77+
## 3. Core Workflow per Entity Class
78+
79+
Entity classes live under:
80+
81+
- `ElectronNET.API/API/Entities/*.cs`
82+
83+
For each C# Entity class:
84+
85+
1. **Identify matching Electron API document via MCP**
86+
- Use `search_docs(library="electronjs", query=...)` with a query that should land on the right Electron doc.
87+
- Example patterns:
88+
- `"api/structures/display"` → Display structure.
89+
- `"api/screen"` → Screen module.
90+
- `"api/structures/<entity-name>"` where `<entity-name>` matches or closely resembles the C# Entity name.
91+
- If multiple results come back, select the excerpt that:
92+
- Mentions the structure name, or
93+
- Clearly lists fields/properties that resemble the C# properties.
94+
- If no relevant result is found:
95+
- Mark the Entity as **"cannot be validated from MCP docs"**.
96+
- Do **not** change it.
97+
98+
2. **Extract Electron field definitions from MCP result**
99+
- From the chosen excerpt, enumerate:
100+
- Field names.
101+
- Field types (e.g. `string`, `number`, `boolean`, `Rectangle`, `Size`, `Point`, etc.).
102+
- Short description text for each field, as this is needed for numeric semantics.
103+
104+
3. **Read the C# Entity source**
105+
- Open `ElectronNET.API/API/Entities/<Entity>.cs`.
106+
- For each C# property, record:
107+
- `PropertyName`.
108+
- Type (e.g. `int`, `double`, `string`, `Rectangle`, `Size`, etc.).
109+
- XML summary comments, if any; these should be checked against MCP descriptions.
110+
111+
4. **Compare MCP definition to C# Entity**
112+
- For every field in MCP:
113+
- **Matched**: there is a C# property of the same concept.
114+
- **Missing**: no corresponding C# property.
115+
- For every C# property:
116+
- **Backed by MCP**: exists in MCP docs.
117+
- **Not backed**: not present in MCP docs; keep but mark as not documented by MCP.
118+
- For matched fields:
119+
- Check type compatibility (especially numerics).
120+
- Check XML doc comments for completeness and alignment with MCP description.
121+
122+
5. **Plan changes (still per Entity)**
123+
- For each matched field:
124+
- If type and docs align with MCP → no change.
125+
- If type is incompatible (or clearly suboptimal) given MCP semantics → mark for type change.
126+
- If XML docs are missing or inaccurate vs MCP text → mark for doc update.
127+
- For missing fields:
128+
- If MCP docs clearly define a field not present in C# → consider adding a property once in Act mode.
129+
- For extra C# properties not in MCP:
130+
- Leave them but note that they are not MCP-backed.
131+
132+
6. **Implementation (when performing edits)**
133+
- Apply type changes and doc updates that are justified **directly** by MCP snippets.
134+
- Add MCP-backed missing properties where the mapping is unambiguous.
135+
- After each file (or every 3–5 files, per user preference), update `NumericPropertiesToCheck.txt`.
136+
137+
---
138+
139+
## 4. Numeric Properties – Detailed Rules
140+
141+
For Electron fields typed as `number` in MCP docs, the assistant must classify them into 3 buckets **using only the MCP text**.
142+
143+
### 4.1 Bucket A – Clearly Integral
144+
145+
Criteria (derived strictly from MCP descriptions):
146+
147+
- Description uses *count/identifier* language, e.g.:
148+
- "ID", "identifier", "unique identifier", "index", "sequential number".
149+
- "The number of bits per pixel".
150+
- "The number of bits per color component".
151+
- Concept is inherently discrete (bits, channels, counts of items).
152+
153+
Actions:
154+
155+
- C# type should be an integral type (`int` or `long`), aligned with existing code conventions.
156+
- Record the property in `NumericPropertiesToCheck.txt` as `ClassName.PropertyName`.
157+
158+
### 4.2 Bucket B – Clearly Potentially Fractional (Double/Decimal)
159+
160+
Criteria based on MCP docs (no external memory):
161+
162+
- Description involves quantities that are naturally fractional:
163+
- Scale factors, ratios, percentages.
164+
- Frequencies or rates where fractional values conceptually make sense.
165+
- MCP examples (if present) show decimal literals (`1.5`, `0.8`, etc.).
166+
167+
Actions:
168+
169+
- C# type should be a floating-point type (`double` by default, `decimal` only if user later requests that convention).
170+
- Record in `NumericPropertiesToCheck.txt` as `ClassName.PropertyName`.
171+
- When explaining changes, explicitly state that the decision is inferred from the MCP description (e.g. "scale factor"), not from prior Electron knowledge.
172+
173+
### 4.3 Bucket C – Ambiguous Numeric (Do Not Change Type Blindly)
174+
175+
Criteria:
176+
177+
- MCP just says `number` with a neutral description.
178+
- Semantics are not clearly count/identifier and not clearly ratio/scale.
179+
180+
Actions:
181+
182+
- Do **not** change the existing C# type.
183+
- Still record `ClassName.PropertyName` in `NumericPropertiesToCheck.txt` for later manual/runtime inspection.
184+
185+
### 4.4 Process for Recording Numeric Properties
186+
187+
For each Entity, after aligning fields with MCP docs:
188+
189+
1. Identify all fields in the MCP snippet typed as `number` (or clearly numeric) and their corresponding C# properties.
190+
2. For each such property in **Bucket B or Bucket C only** (potentially fractional or ambiguous numerics):
191+
- Append a line to `NumericPropertiesToCheck.txt`:
192+
- `ClassName.PropertyName`
193+
3. Do **not** record Bucket A (clearly integral) fields in `NumericPropertiesToCheck.txt`.
194+
4. Keep this file updated after each file edit or after a small batch of files (3–5), as per the user’s guidance.
195+
196+
---
197+
198+
## 5. Documentation Updates
199+
200+
- When MCP docs provide clear textual descriptions or additional semantics:
201+
- Update the XML `<summary>` comments on C# properties to:
202+
- Correct inaccuracies.
203+
- Fill in missing details that MCP provides.
204+
- Always ensure that **every change to docs** can be traced back to an MCP snippet:
205+
- Include key phrases from MCP in your summary.
206+
- Do not introduce new semantics not present in MCP.
207+
- After a class has been fully audited against MCP docs (or explicitly determined to have no MCP counterpart but retained as project-specific), add a class-level remarks tag to mark its status:
208+
- Insert `/// <remarks>Up-to-date with Electron API 39.2</remarks>` immediately below the class `<summary>` XML doc.
209+
- Only add this remark when the mapping against MCP docs is complete and current.
210+
- For any member or type whose MCP docs include platform tags (e.g. `_macOS_`, `_Windows_`, `_Linux_`):
211+
- Add `[SupportedOSPlatform("...")]` attributes from `System.Runtime.Versioning` for each supported platform.
212+
- Do **not** add these attributes when MCP shows no platform restriction (i.e., supported on all major desktop platforms).
213+
- Prefer class-level attributes when the entire type is restricted to a single platform (e.g. options objects used only on Windows), and property-level attributes when only selected members are platform-specific.
214+
215+
---
216+
217+
## 6. High-Level Execution Strategy (File-by-File)
218+
219+
1. Enumerate all `*.cs` under `ElectronNET.API/API/Entities`.
220+
2. For each file, in order (A-to-Z across all Entities), in a single pass:
221+
- Use `search_docs` on `electronjs` to find the relevant Electron structure/module.
222+
- Compare the Entity against the MCP definition.
223+
- Immediately apply safe, MCP-backed changes (types + docs + missing fields) based on that comparison.
224+
- Update `NumericPropertiesToCheck.txt` with all numeric properties from that file.
225+
3. There is no separate "audit report" phase; validation and implementation are done together in this single pass. You may keep brief internal notes if helpful, but no per-Entity external reports are required.
226+
4. If at any point MCP does not contain the necessary information:
227+
- Stop for that Entity and mark it as unresolved rather than guessing.
228+
229+
---
230+
231+
## 7. Non-Negotiables
232+
233+
- Never assume or invent Electron field behavior.
234+
- Never infer numeric ranges, enums, or value sets beyond what MCP explicitly states.
235+
- For any doubt, prefer:
236+
- No change to code, plus
237+
- Recording the property in `NumericPropertiesToCheck.txt`, plus
238+
- A note that it is ambiguous from MCP docs.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Display.DisplayFrequency
2+
Display.ScaleFactor
3+
AddRepresentationOptions.ScaleFactor
4+
BitmapOptions.ScaleFactor
5+
CreateFromBitmapOptions.ScaleFactor
6+
CreateFromBufferOptions.ScaleFactor
7+
CreateInterruptedDownloadOptions.StartTime
8+
CPUUsage.PercentCPUUsage
9+
CPUUsage.IdleWakeupsPerSecond
10+
Margins.Top
11+
Margins.Bottom
12+
Margins.Left
13+
Margins.Right
14+
InputEvent.Location
15+
PrintOptions.ScaleFactor
16+
PrintDpi.Horizontal
17+
PrintDpi.Vertical
18+
BrowserWindowOptions.Opacity
19+
WebPreferences.ZoomFactor
20+
Cookie.ExpirationDate
21+
PrintToPDFOptions.Scale
22+
UploadFile.ModificationTime
23+
ProcessMetric.CreationTime
24+
Certificate.ValidStart
25+
Certificate.ValidExpiry
26+
CookieDetails.ExpirationDate
27+
PageSize.Height
28+
PageSize.Width
29+
EnableNetworkEmulationOptions.Latency
30+
EnableNetworkEmulationOptions.DownloadThroughput
31+
EnableNetworkEmulationOptions.UploadThroughput
32+
ProgressInfo.Percent
33+
UpdateInfo.StagingPercentage

0 commit comments

Comments
 (0)