Inspector Editing Mode (Session-Scoped)
قانونیک «حالت ویرایش بازرس» جلسهمحور و باحفظ وضعیت را برای نگهداری مشترک مؤلفههای React و بازرسان توسعه مجزای مربوطه بدون آلودگی بینجلسهای ایجاد میکند.
برای دسترسی به این قانون، به سیستم وارد شوید
با «نمایه توسعهدهنده Google» خود به سیستم وارد شوید تا قانون کامل استفادهشده در مجموعه Build It! را مشاهده و کپی کنید.
نمایه توسعهدهندگان نرمافزار لازم است
واجدشرایط نمایه توسعهدهندگان نیستید. به سرپرست فضای کاریتان اطلاع دهید تا این ویژگی را فعال کند.
ایجاد نمایه تولیدکننده
برای باز کردن قفل همه مهارتها، قوانین، پیاموارهها، و مصنوعات Build It!، «نمایه توسعهدهنده Google» رایگان ایجاد کنید.
برای باز کردن قفل، به Builder Central بپیوندید
با یک کلیک، نشان عضویت رایگان «سازنده» را مطالبه کنید تا همه مهارتها، قوانین، پیاموارهها، و مصنوعات Build It! را باز کنید.
نحوه عملکرد حالت ویرایش بازرس جلسهمحور
وقتی مؤلفههای میانای کاربر را با «بازرس مؤلفه» باز تکرار میکنید، میخواهید ویرایشهای مؤلفه نمای بازرس منطبق را در همان نوبت بهروز کند، بدون اینکه ویرایشهای بازرس را بهطور دائم در جلسههای آینده اجباری کند. این قانون بااستفاده از فایل نشانگر با گستره مکالمه، این مشکل را حل میکند:
- بهطور پیشفرض برای هر جلسه جدید خاموش است: مکالمههای کاملاً جدید در «حالت عادی» شروع میشوند تا ویرایشهای معمول فقط روی فایلهای دقیقی که درخواست میکنید اعمال شوند.
- ورود به «حالت ویرایش بازرس»: بگویید «Enter inspector editing mode» (ورود به حالت ویرایش بازرس) (یا «Turn on inspector mode» (روشن کردن حالت بازرس)). نماینده یک فایل نشانگر جلسهمحور در
<appDataDir>/brain/<conversation-id>/inspector-mode.activeایجاد میکند،src/dev/registry.tsرا میخواند، و هر مؤلفه ثبتشده تحت پوشش این جلسه را فهرست میکند. - همنگهداری خودکار: وقتی فعال باشد، هر تغییری که برای مؤلفه ثبتشده درخواست کنید ابتدا مؤلفه را بهروز میکند و بلافاصله
src/dev/inspectors/[ComponentName]Inspector.tsxمنطبق با آن را بااستفاده از گردش کار Component Inspector Updater همگامسازی میکند،npx tsc --noEmitرا اجرا میکند، و پاسخ را با تراشه تأیید مهر میکند. - هرزمان خواستید بهراحتی خارج شوید: بگویید «Exit inspector editing mode» (خروج از حالت ویرایش بازرس) تا فایل نشانگر برداشته شود و به ویرایش تکهدفی عادی برگردید. روشن کردن این حالت در یک جلسه هرگز بر جلسههای موازی یا آینده تأثیر نمیگذارد.
نحوه نصب کردن در Google Antigravity
این قانون را در فضای کاری Google Antigravity خود در کنار دو مهارت Episode 9 Component Inspector قرار دهید:
- پوشه
.agents/rules/را در فضای کاری پروژهتان ایجاد کنید (یا برای افزودن قانون فضای کاری، «سفارشیسازیهای» Google Antigravity > «قوانین» را باز کنید). - قانون کامل Markdown زیر را بهعنوان
inspector-editing-mode.mdدر.agents/rules/ذخیره کنید. - مهارتهای همراه Component Inspector Generator و Component Inspector Updater را نصب کنید تا عامل شما هم گردشهای کار داربستبندی و هم همگامسازی را که این قانون به آنها ارجاع میدهد داشته باشد.
Inspector Editing Mode Rule Definition
این تعریف کامل قانون را بهعنوان 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.