इंस्पेक्टर बदलाव मोड (सेशन के स्कोप वाला)
नियमयह सेशन के स्कोप वाले इंस्पेक्टर बदलाव मोड को चालू करता है. इससे React कॉम्पोनेंट और उनसे जुड़े अलग-अलग डेवलपमेंट इंस्पेक्टर को एक साथ मैनेज किया जा सकता है. साथ ही, सेशन के बीच डेटा लीक होने का खतरा नहीं रहता.
इस नियम को ऐक्सेस करने के लिए साइन इन करें
Build It! सीरीज़ में इस्तेमाल किए गए पूरे नियम को देखने और कॉपी करने के लिए, अपनी Google डेवलपर प्रोफ़ाइल से साइन इन करें.
डेवलपर प्रोफ़ाइल ज़रूरी है
आपके पास डेवलपर प्रोफ़ाइल बनाने की अनुमति नहीं है. इस सुविधा को चालू करने के लिए, अपने Workspace एडमिन को सूचना दें.
डेवलपर प्रोफ़ाइल बनाएं
Build It! की सभी स्किल, नियम, प्रॉम्प्ट, और आर्टफ़ैक्ट अनलॉक करने के लिए, बिना किसी शुल्क के Google डेवलपर प्रोफ़ाइल बनाएं.
अनलॉक करने के लिए, Builder Central में शामिल हों
Build It! की सभी स्किल, नियम, प्रॉम्प्ट, और आर्टफ़ैक्ट अनलॉक करने के लिए, एक क्लिक में बिल्डर मेंबर का बैज मुफ़्त में पाएं.
सेशन के स्कोप वाले इंस्पेक्टर बदलाव मोड के काम करने का तरीका
कॉम्पोनेंट इंस्पेक्टर की मदद से यूज़र इंटरफ़ेस (यूआई) कॉम्पोनेंट में बदलाव करने पर, आपको कॉम्पोनेंट में किए गए बदलावों को इंस्पेक्टर व्यू में तुरंत अपडेट करना होता है. हालांकि, आपको यह नहीं चाहिए कि इंस्पेक्टर में किए गए बदलाव, आने वाले सेशन में भी लागू रहें. यह नियम, बातचीत के स्कोप वाली मार्कर फ़ाइल का इस्तेमाल करके इस समस्या को हल करता है:
- हर नए सेशन के लिए डिफ़ॉल्ट रूप से बंद रहती है: नई बातचीत, नॉर्मल मोड में शुरू होती हैं. इससे, सामान्य बदलाव सिर्फ़ उन फ़ाइलों में होते हैं जिनके लिए आपने कहा है.
- इंस्पेक्टर एडिटिंग मोड में जाना: "इंस्पेक्टर एडिटिंग मोड में जाओ" (या "इंस्पेक्टर मोड चालू करो") कहें. एजेंट,
<appDataDir>/brain/<conversation-id>/inspector-mode.activeपर सेशन के स्कोप वाली मार्कर फ़ाइल बनाता है,src/dev/registry.tsको पढ़ता है, और इस सेशन के लिए रजिस्टर किए गए हर कॉम्पोनेंट की सूची बनाता है. - अपने-आप को-मेंटेनेंस होने की सुविधा: इसके चालू होने पर, रजिस्टर किए गए किसी कॉम्पोनेंट में बदलाव करने का अनुरोध करने पर, सबसे पहले कॉम्पोनेंट को अपडेट किया जाता है. इसके बाद, कॉम्पोनेंट इंस्पेक्टर अपडेटर वर्कफ़्लो का इस्तेमाल करके, उससे मैच होने वाले
src/dev/inspectors/[ComponentName]Inspector.tsxको तुरंत सिंक किया जाता है. साथ ही,npx tsc --noEmitको चलाया जाता है और जवाब पर पुष्टि करने वाली चिप लगाई जाती है. - किसी भी समय आसानी से बाहर निकलें: मार्कर फ़ाइल को हटाने और सामान्य सिंगल-टारगेट एडिटिंग पर वापस जाने के लिए, "Exit inspector editing mode" कहें. किसी एक सेशन में इस मोड को चालू करने से, साथ में चल रहे या आने वाले सेशन पर कोई असर नहीं पड़ता.
Google Antigravity में इंस्टॉल करने का तरीका
इस नियम को अपने Google Antigravity फ़ाइल फ़ोल्डर में, एपिसोड 9 के कॉम्पोनेंट इंस्पेक्टर की दो स्किल के साथ जोड़ें:
- अपने प्रोजेक्ट फ़ोल्डर में
.agents/rules/फ़ोल्डर बनाएं या फ़ोल्डर का नियम जोड़ने के लिए, Google Antigravity कस्टमाइज़ेशन > नियम खोलें. - नीचे दिए गए पूरे मार्कडाउन नियम को
.agents/rules/मेंinspector-editing-mode.mdके तौर पर सेव करें. - साथी स्किल Component Inspector Generator और Component Inspector Updater इंस्टॉल करें, ताकि आपके एजेंट के पास इस नियम में बताए गए स्कैफ़ोल्डिंग और सिंक्रनाइज़ेशन वर्कफ़्लो, दोनों मौजूद हों.
इंस्पेक्टर बदलाव मोड में नियम की जानकारी
इस पूरे नियम को अपने फ़ाइल फ़ोल्डर में inspector-editing-mode.md के तौर पर कॉपी करें.
# Inspector Editing Mode (Session-Scoped)
This rule establishes a stateful, session-scoped **Inspector Editing Mode** for co-maintaining React components and their corresponding isolated development inspectors (`src/dev/inspectors/[ComponentName]Inspector.tsx`).
---
## 1. Scope & Isolation Model
* **Session-Scoped**: The on/off state of this mode is strictly scoped to the current conversation session (`<conversation-id>`).
* **Default State**: Every new conversation session begins with Inspector Editing Mode **OFF** by default.
* **State Marker**:
- Activation is tracked at `<appDataDir>/brain/<conversation-id>/inspector-mode.active`.
- If this file exists for the active session's conversation ID, Inspector Editing Mode is **ON**.
- If this file does NOT exist, Inspector Editing Mode is **OFF**.
* **Zero Cross-Session Contamination**: Turning this mode on in one conversation has no effect on any other parallel or future conversation sessions.
---
## 2. Trigger Commands & State Transitions
### A. Entering Inspector Mode
* **Trigger Phrases**:
- *"Enter inspector editing mode"*
- *"Start inspector editing mode"*
- *"Turn on inspector mode"*
- *"Inspector mode on"*
* **Agent Action**:
1. Create the marker file at `<appDataDir>/brain/<conversation-id>/inspector-mode.active`.
2. Read `src/dev/registry.ts` to identify all currently registered components.
3. Respond confirming:
- Inspector Editing Mode is now **ACTIVE** for this session.
- Any subsequent changes to registered components will automatically update both the component and its dev inspector.
- List the currently registered components covered by this mode.
### B. Exiting Inspector Mode
* **Trigger Phrases**:
- *"Exit inspector editing mode"*
- *"Stop inspector editing mode"*
- *"Turn off inspector mode"*
- *"Inspector mode off"*
* **Agent Action**:
1. Remove the marker file at `<appDataDir>/brain/<conversation-id>/inspector-mode.active` if present.
2. Respond confirming that Inspector Editing Mode is now **DEACTIVATED** for this session and normal single-target editing has resumed.
### C. Status Query
* **Trigger Phrases**:
- *"Is inspector mode active?"*
- *"Inspector mode status"*
- *"What mode am I in?"*
* **Agent Action**:
- Check for the existence of `<appDataDir>/brain/<conversation-id>/inspector-mode.active`.
- Report whether the current session is in **Inspector Mode** or **Normal Mode**.
---
## 3. Co-Maintenance Behavior While Mode is ACTIVE
Whenever the user requests changes, fixes, or refactors to ANY component registered in `src/dev/registry.ts`:
1. **Step 1: Update the Core Component**
- Apply the requested code changes, props modifications, or behavioral logic in `src/components/.../[ComponentName].tsx` (or `src/views/.../[ComponentName].tsx`).
- Update any relevant unit tests in `scripts/` or `__tests__/`.
2. **Step 2: Automatically Synchronize the Dev Inspector**
- Locate the matching inspector at `src/dev/inspectors/[ComponentName]Inspector.tsx`.
- Apply the `component-inspector-updater` workflow:
- **Props & State**: Reconcile any new, altered, or deleted props into the *Editable State* or *Props State* categories.
- **Computed State**: Update derived `useMemo` metrics if underlying rules or formulas changed.
- **Test Verification Cards**: Synchronize the plain-English test fixtures at the bottom of the inspector with the new behavior, updating click handlers so `[Load Test Fixture]` accurately reflects the new state.
- **Preserve Custom Presets**: Keep all existing scenario presets (e.g. week overhauls, superset pairs, edge cases) intact, adapting their shapes to new prop signatures.
- **Advance Timestamp Chip**: Advance `const GENERATED_AT = 'YYYY-MM-DD HH:MM [TIMEZONE]';` to the current local timestamp.
- **No Auto-Scroll**: Ensure all internal scrolling is scoped strictly to element containers (`containerRef.current.scrollTop = containerRef.current.scrollHeight`) with zero page-level scrolling.
3. **Step 3: Verify Types**
- Run `npx tsc --noEmit` to ensure type alignment between the component and its inspector.
- **DO NOT** run raw `npm run build` while a local dev server is active to prevent wiping out `.next/` chunk manifests.
4. **Step 4: Badge Confirmation in Response**
- Include an explicit status chip in your response header or summary:
`[Inspector Mode: Synced <ComponentName> & Dev Inspector]`
---
## 4. Behavior While Mode is INACTIVE (Default)
* When the mode is OFF, the agent performs only the exact requested file modifications.
* Do NOT edit `src/dev/inspectors/` unless the user explicitly requests an inspector update or instructs the agent to create a brand new inspector route.