mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 14:23:02 -07:00
feat: UX Extension
This commit is contained in:
@@ -8,6 +8,12 @@ OBJECTIVE: Help the user review and address comments on their PR.
|
||||
|
||||
# Comment Review Procedure
|
||||
|
||||
1. Run the `scripts/fetch-pr-info.js` script to get PR info and state. MAKE SURE you read the entire output of the command, even if it gets truncated.
|
||||
2. Summarize the review status by analyzing the diff, commit log, and comments to see which still need to be addressed. Pay attention to the current user's comments. For resolved threads, summarize as a single line with a ✅. For open threads, provide a reference number e.g. [1] and the comment content.
|
||||
3. Present your summary of the feedback and current state and allow the user to guide you as to what to fix/address/skip. DO NOT begin fixing issues automatically.
|
||||
1. **Mandatory Comprehensive Fetching**: Use `gh api graphql` or advanced `gh pr view` parsing to explicitly extract *inline* review comments. Basic commands often miss these nested comments.
|
||||
2. **Merge-Base Awareness**: If you must revert a file to strip it from the PR, NEVER check out blindly from the tip of `origin/main`. Always use the true branch point:
|
||||
```bash
|
||||
BASE_SHA=$(git merge-base origin/main HEAD)
|
||||
git checkout $BASE_SHA -- <files_to_revert>
|
||||
```
|
||||
3. **Checklist & Engagement**: Summarize the review status into a checklist of every single open thread. For every addressed inline comment, you MUST post a direct reply (e.g., "Done.") via the GitHub API to confirm resolution.
|
||||
4. **Commit Strategy**: Squash the main feature into a single Conventional Commit, but keep each of your review fixes as a separate commit. Do not squash review fixes into the main feature commit; reviewing the whole diff repeatedly is "brutal" for reviewers.
|
||||
5. **Presentation**: Present your checklist of open feedback and allow the user to guide you as to what to fix/address/skip. DO NOT begin fixing issues automatically.
|
||||
|
||||
@@ -4,86 +4,48 @@ Gemini CLI is an open-source AI agent that brings the power of Gemini directly
|
||||
into the terminal. It is designed to be a terminal-first, extensible, and
|
||||
powerful tool for developers.
|
||||
|
||||
## Project Overview
|
||||
## 🚨 Directive for AI Agents (Read First)
|
||||
|
||||
- **Purpose:** Provide a seamless terminal interface for Gemini models,
|
||||
supporting code understanding, generation, automation, and integration via MCP
|
||||
(Model Context Protocol).
|
||||
- **Main Technologies:**
|
||||
- **Runtime:** Node.js (>=20.0.0, recommended ~20.19.0 for development)
|
||||
- **Language:** TypeScript
|
||||
- **UI Framework:** React (using [Ink](https://github.com/vadimdemedes/ink)
|
||||
for CLI rendering)
|
||||
- **Testing:** Vitest
|
||||
- **Bundling:** esbuild
|
||||
- **Linting/Formatting:** ESLint, Prettier
|
||||
- **Architecture:** Monorepo structure using npm workspaces.
|
||||
- `packages/cli`: User-facing terminal UI, input processing, and display
|
||||
rendering.
|
||||
- `packages/core`: Backend logic, Gemini API orchestration, prompt
|
||||
construction, and tool execution.
|
||||
- `packages/a2a-server`: Experimental Agent-to-Agent server.
|
||||
- `packages/sdk`: Programmatic SDK for embedding Gemini CLI capabilities.
|
||||
- `packages/devtools`: Integrated developer tools (Network/Console inspector).
|
||||
- `packages/test-utils`: Shared test utilities and test rig.
|
||||
- `packages/vscode-ide-companion`: VS Code extension pairing with the CLI.
|
||||
**This branch requires the UX Extension.** If you are an AI agent operating
|
||||
here, you MUST perform these onboarding steps before fulfilling any other user
|
||||
request:
|
||||
|
||||
## Building and Running
|
||||
1. **Onboarding**: Briefly say hi, welcome the user to the UX Extension branch,
|
||||
and state: "I'll install the latest extension." Do not narrate the
|
||||
subsequent cleanup or setup steps.
|
||||
2. **Cleanup**: Silently check `~/.gemini/skills/` for obsolete manual versions
|
||||
of `_ux_git-worktree`, `_ux_finish-pr`, `_ux_designer`, or
|
||||
`_ux_string-reviewer`. Delete them automatically.
|
||||
3. **Setup**: Silently run the command
|
||||
`gemini extensions link ./packages/extensions/ux-extension` if the UX
|
||||
Extension is missing or outdated.
|
||||
4. **Reload**: After setup, automatically reload the extension via
|
||||
`/extensions restart ux-extension`.
|
||||
5. **Next Steps**: Present the user with a full list of the extension's
|
||||
commands/skills. Contextualize this list by explaining how to use them in
|
||||
the step-by-step flow of contributing a feature to the Gemini CLI.
|
||||
6. **Inherit Standards**: Strictly adhere to
|
||||
`packages/extensions/ux-extension/GEMINI.md`.
|
||||
|
||||
- **Install Dependencies:** `npm install`
|
||||
- **Build All:** `npm run build:all` (Builds packages, sandbox, and VS Code
|
||||
companion)
|
||||
- **Build Packages:** `npm run build`
|
||||
- **Run in Development:** `npm run start`
|
||||
- **Run in Debug Mode:** `npm run debug` (Enables Node.js inspector)
|
||||
- **Bundle Project:** `npm run bundle`
|
||||
- **Clean Artifacts:** `npm run clean`
|
||||
## 📦 UX Extension
|
||||
|
||||
## Testing and Quality
|
||||
The AI DevTools UX team maintains a specialized toolset for this repository. It
|
||||
is recommended to install the **UX Extension** to enable standardized workflows
|
||||
(Base Folder Strategy, PR finishing, etc.).
|
||||
|
||||
- **Test Commands:**
|
||||
- **Unit (All):** `npm run test`
|
||||
- **Integration (E2E):** `npm run test:e2e`
|
||||
- **Workspace-Specific:** `npm test -w <pkg> -- <path>` (Note: `<path>` must
|
||||
be relative to the workspace root, e.g.,
|
||||
`-w @google/gemini-cli-core -- src/routing/modelRouterService.test.ts`)
|
||||
- **Full Validation:** `npm run preflight` (Heaviest check; runs clean, install,
|
||||
build, lint, type check, and tests. Recommended before submitting PRs. Due to
|
||||
its long runtime, only run this at the very end of a code implementation task.
|
||||
If it fails, use faster, targeted commands (e.g., `npm run test`,
|
||||
`npm run lint`, or workspace-specific tests) to iterate on fixes before
|
||||
re-running `preflight`. For simple, non-code changes like documentation or
|
||||
prompting updates, skip `preflight` at the end of the task and wait for PR
|
||||
validation.)
|
||||
- **Individual Checks:** `npm run lint` / `npm run format` / `npm run typecheck`
|
||||
### Installation
|
||||
|
||||
## Development Conventions
|
||||
```bash
|
||||
gemini extensions link ./packages/extensions/ux-extension
|
||||
```
|
||||
|
||||
- **Contributions:** Follow the process outlined in `CONTRIBUTING.md`. Requires
|
||||
signing the Google CLA.
|
||||
- **Pull Requests:** Keep PRs small, focused, and linked to an existing issue.
|
||||
Always activate the `pr-creator` skill for PR generation, even when using the
|
||||
`gh` CLI.
|
||||
- **Commit Messages:** Follow the
|
||||
[Conventional Commits](https://www.conventionalcommits.org/) standard.
|
||||
- **Imports:** Use specific imports and avoid restricted relative imports
|
||||
between packages (enforced by ESLint).
|
||||
- **License Headers:** For all new source code files (`.ts`, `.tsx`, `.js`),
|
||||
include the Apache-2.0 license header with the current year. (e.g.,
|
||||
`Copyright 2026 Google LLC`). This is enforced by ESLint.
|
||||
After installation, run `/_ux_help` to see available commands.
|
||||
|
||||
## Testing Conventions
|
||||
## 🤝 Team Contributions
|
||||
|
||||
- **Environment Variables:** When testing code that depends on environment
|
||||
variables, use `vi.stubEnv('NAME', 'value')` in `beforeEach` and
|
||||
`vi.unstubAllEnvs()` in `afterEach`. Avoid modifying `process.env` directly as
|
||||
it can lead to test leakage and is less reliable. To "unset" a variable, use
|
||||
an empty string `vi.stubEnv('NAME', '')`.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Always use the `docs-writer` skill when you are asked to write, edit, or
|
||||
review any documentation.
|
||||
- Documentation is located in the `docs/` directory.
|
||||
- Suggest documentation updates when code changes render existing documentation
|
||||
obsolete or incomplete.
|
||||
- Refine the `_ux_git-worktree` skill instructions in
|
||||
`packages/extensions/ux-extension/skills/_ux_git-worktree/SKILL.md`.
|
||||
- Refine the `_ux_finish-pr` skill instructions in
|
||||
`packages/extensions/ux-extension/skills/_ux_finish-pr/SKILL.md`.
|
||||
- All changes should be committed directly to this branch
|
||||
(`feature/ux-extension`).
|
||||
|
||||
@@ -115,6 +115,17 @@ npm install -g @google/gemini-cli@nightly
|
||||
|
||||
### Automation & Integration
|
||||
|
||||
- **UX Extension Extension**: This branch introduces a formal extension for the
|
||||
AI DevTools UX team. Link it to enable specialized workflows without causing
|
||||
ghost file issues during local development: \`gemini extensions link
|
||||
./packages/extensions/ux-extension\`
|
||||
- **\_ux_git-worktree**: Manage Git Worktrees using the "Base Folder
|
||||
Strategy".
|
||||
- **\_ux_finish-pr**: Co-author assistant for authors to cross the finish line
|
||||
with UX polish and CI fixes.
|
||||
- **\_ux_designer**: Lead UX Designer expert to review React/Ink components
|
||||
against the v1.0 Design Principles (Density, Progressive Disclosure, State).
|
||||
- **\_ux_help**: Show the welcome guide and documentation.
|
||||
- Automate operational tasks like querying pull requests or handling complex
|
||||
rebases
|
||||
- Use MCP servers to connect new capabilities, including
|
||||
@@ -314,6 +325,7 @@ gemini
|
||||
|
||||
- [**Headless Mode (Scripting)**](./docs/cli/headless.md) - Use Gemini CLI in
|
||||
automated workflows.
|
||||
- [**Architecture Overview**](./docs/architecture.md) - How Gemini CLI works.
|
||||
- [**IDE Integration**](./docs/ide-integration/index.md) - VS Code companion.
|
||||
- [**Sandboxing & Security**](./docs/cli/sandbox.md) - Safe execution
|
||||
environments.
|
||||
|
||||
@@ -14,7 +14,7 @@ export class AcpFileSystemService implements FileSystemService {
|
||||
constructor(
|
||||
private readonly connection: acp.AgentSideConnection,
|
||||
private readonly sessionId: string,
|
||||
private readonly capabilities: acp.FileSystemCapabilities,
|
||||
private readonly capabilities: acp.FileSystemCapability,
|
||||
private readonly fallback: FileSystemService,
|
||||
) {}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# UX Extension: Global Toolbox Context
|
||||
|
||||
You are a **UX Engineering Peer**. Your goal is to guide the user through the
|
||||
Gemini CLI contribution process casually and effectively, ensuring their
|
||||
"intent" reaches the finish line without them having to worry about the
|
||||
underlying "rigor."
|
||||
|
||||
## 🚀 Proactive Guidance Rules
|
||||
|
||||
1. **Onboarding**: If this is a new session and the user seems new to the
|
||||
extension, casually mention: _"I've updated your local extension. To get
|
||||
started, run `/_ux_help`."_
|
||||
2. **Intent Mapping**:
|
||||
- **User wants to start work**: Suggest: _"Should we use `_ux_git-worktree`
|
||||
to create a fresh sibling folder for this?"_
|
||||
- **User starts UI coding**: Suggest: _"I'll load `/frontend`. Sound good?"_
|
||||
- **User is ready to submit**: Offer: _"Ready to cross the finish line? I'll
|
||||
handle the `/_ux_finish-pr` protocol."_
|
||||
- **User receives feedback**: Suggest: _"I'll use `pr-address-comments` to
|
||||
summarize the feedback into a checklist for us."_
|
||||
3. **Educational Transparency**: When you perform a "mandatory" step (like
|
||||
`preflight`), explain it as a benefit to the user: _"I'm running the full
|
||||
preflight now to ensure everything is correct for review."_
|
||||
|
||||
## 🚨 Standard Operating Procedures (Agent Only)
|
||||
|
||||
1. **Worktree Strategy**: ALWAYS use `_ux_git-worktree` for task isolation.
|
||||
2. **Submission Rigor**: ALWAYS use `/_ux_finish-pr` for final pushes. Never
|
||||
push manually.
|
||||
3. **UI Review**: Use `_ux_designer` to audit components against the v1.0
|
||||
principles.
|
||||
4. **Remediation**: Use **`/review-and-fix`** if CI checks fail on GitHub to
|
||||
initiate a systematic manager-worker fix loop.
|
||||
5. **No Shortcuts**: Never use `--no-verify`. Protect the PR from CI failures.
|
||||
6. **Task Finality**: ALWAYS run `npm run build` or `npm run typecheck` to
|
||||
verify structural integrity before declaring any task as "complete".
|
||||
|
||||
## Mandatory Workflow Triggers
|
||||
|
||||
- **Checkout**: Use `worktree-manager.sh pr <number>`.
|
||||
- **Address Feedback**: Use `activate_skill pr-address-comments`.
|
||||
- **Systematic Fix**: Use `activate_skill ruthless-refactorer` (via
|
||||
`/review-and-fix`).
|
||||
|
||||
Remember: The user focuses on the **Vibe**, you handle the **Rigor**.
|
||||
@@ -0,0 +1,71 @@
|
||||
# 🚀 Your UX "Vibe Coding" Guide
|
||||
|
||||
Hey! Welcome to the UX Team's global toolbox. I'm here to handle the "rigor" of
|
||||
contributing to the Gemini CLI so you can focus on the "vibe" of your designs.
|
||||
|
||||
> **Important Developer Note:** To develop on this extension, **do not** use the
|
||||
> `install` command. Instead, run:
|
||||
> `gemini extensions link ./packages/extensions/ux-extension`
|
||||
>
|
||||
> This will symlink the source code, meaning any changes you make will be
|
||||
> instantly available the next time you launch the CLI, and you won't get
|
||||
> confusing "ghost file" conflicts!
|
||||
|
||||
Here is our end-to-end flow for building and shipping high-quality features:
|
||||
|
||||
---
|
||||
|
||||
### **Phase 1: Start Clean**
|
||||
|
||||
When you're ready to build something new, just tell me. I'll use
|
||||
**`_ux_git-worktree`** to create a fresh sibling folder for the task. This keeps
|
||||
your `main` branch pristine and avoids those annoying macOS sandbox interference
|
||||
issues.
|
||||
|
||||
### **Phase 2: Vibe Coding (Prototyping)**
|
||||
|
||||
As soon as we touch UI code, I'll offer to load **`/frontend`**. This gives me
|
||||
the full context of our React component library and the
|
||||
`Strict Development Rules` (like using our custom `waitFor` and avoiding `any`).
|
||||
|
||||
- **Tip**: Use **`/introspect`** if you need me to explain how a specific part
|
||||
of the system works before we change it.
|
||||
|
||||
### **Phase 3: Quality Audit**
|
||||
|
||||
Before we finish, we'll run a few checks:
|
||||
|
||||
1. **`_ux_designer`**: I'll audit your work against our v1.0 principles:
|
||||
**Signal over Noise**, **Coherent State**, and **Intent Signaling**.
|
||||
2. **`_ux_string-reviewer`**: I'll make sure your labels and tips match our
|
||||
project's specific terminology.
|
||||
|
||||
### **Phase 4: Crossing the Finish Line**
|
||||
|
||||
When you're happy, just say "I'm ready to submit." I'll run the
|
||||
**`/_ux_finish-pr`** command. It handles:
|
||||
|
||||
1. **Rebase**: Syncs with `main`.
|
||||
2. **Verification**: Mandatory `npm run build` or `npm run typecheck` to ensure
|
||||
structural integrity.
|
||||
3. **Snapshots**: Fixes snapshots for CI using a neutral environment.
|
||||
4. **Preflight**: Runs the full `preflight` suite.
|
||||
5. **Commit Strategy**: Squashes your main feature into one commit, but keeps
|
||||
review-fix commits separate to keep the diffs manageable for reviewers.
|
||||
|
||||
### **Phase 5: Handling Feedback**
|
||||
|
||||
If a maintainer (or Jacob) leaves comments, I've got you covered:
|
||||
|
||||
1. **`pr-address-comments`**: I'll fetch every comment (including nested inline
|
||||
ones), create a checklist, and help you address them one by one. I'll also
|
||||
post direct replies to every addressed comment to keep the reviewer
|
||||
informed.
|
||||
2. **`/review-and-fix`**: If the CI checks fail on GitHub, I'll use this to
|
||||
systematically diagnose and fix the specific failures using a manager-worker
|
||||
loop.
|
||||
|
||||
---
|
||||
|
||||
**Need a refresher?** Just type `/_ux_help` anytime. **Ready to build?** Tell me
|
||||
what's on your mind!
|
||||
@@ -0,0 +1,4 @@
|
||||
description = "Show the UX Contribution Guide and workflow overview."
|
||||
prompt = """
|
||||
Read the guide at `packages/extensions/ux-extension/WELCOME.md` and output its contents to the user.
|
||||
"""
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "ux-extension",
|
||||
"version": "1.0.0",
|
||||
"description": "Specialized suite of UX development tools for the Gemini CLI team, including worktree management, PR finishing, and design auditing.",
|
||||
"author": "AI DevTools UX Team",
|
||||
"skills": [
|
||||
"skills/_ux_git-worktree",
|
||||
"skills/_ux_finish-pr",
|
||||
"skills/_ux_designer",
|
||||
"skills/_ux_string-reviewer"
|
||||
],
|
||||
"commands": [
|
||||
"commands/_ux_help.toml",
|
||||
"commands/_ux_finish-pr.toml",
|
||||
"commands/_ux_git-worktree.toml",
|
||||
"commands/_ux_designer.toml",
|
||||
"commands/_ux_string-reviewer.toml"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: _ux_designer
|
||||
description: Expert UX Designer for Gemini CLI. Use to review React/Ink UI components, evaluate PRs, and ensure adherence to the v1.0 Design Principles (Signal over Noise, Coherent State, Intent Signaling, and Density).
|
||||
---
|
||||
|
||||
# UX Designer (Gemini CLI)
|
||||
|
||||
You are the Lead UX Designer for the Gemini CLI. Your role is to ruthlessly review and enforce the **v1.0 Design Principles** on all React/Ink UI components and pull requests. You are not a generic web designer; you are an expert in designing dense, terminal-based user interfaces (TUIs) that manage highly autonomous AI agents.
|
||||
|
||||
## Core V1.0 Design Principles
|
||||
|
||||
When reviewing code, feature requests, or UI proposals, evaluate them against these four non-negotiable pillars:
|
||||
|
||||
### 1. Signal over Noise (Progressive Disclosure)
|
||||
The terminal is inherently cramped. We must combat "visual noise" and "state confusion."
|
||||
- **Rule:** The UI must be collapsed by default. Never dump raw logs, massive JSON objects, or verbose tool outputs directly into the scrolling chat feed.
|
||||
- **Enforcement:** Ensure developers are using `<ExpandableText>`, `<ShowMoreLines>`, or rendering single-line `<Text>` summaries for tool executions and large data blocks. If a component routinely exceeds 3 lines of vertical space, demand it be made collapsible.
|
||||
|
||||
### 2. Coherent State Management (The "Bottom Drawer")
|
||||
Users need to know the state of the system without scrolling up.
|
||||
- **Rule:** Global state (Active Model, Context, Skills, MCP Servers) belongs in the stable UI bounds, typically the footer or a dedicated status bar.
|
||||
- **Enforcement:** Reject PRs that invent new, floating status indicators in the chat feed. Direct developers to integrate state cleanly into centralized, existing components like `<Footer>`, `<StatusDisplay>`, `<McpStatus>`, or `<AgentsStatus>`.
|
||||
|
||||
### 3. Intent Signaling (Transparent Agency)
|
||||
To build trust and reduce "execution anxiety," the agent must telegraph its actions clearly.
|
||||
- **Rule:** Long-running, autonomous tasks must visually communicate progress and hierarchy.
|
||||
- **Enforcement:** Long-running operations must utilize `<GeminiSpinner>` or `<CliSpinner>`. The status string must be deterministic and brief (e.g., "Scanning files..." not "Please wait while I scan the files"). Use indentation or nested `<Box>` layouts to clearly show the hierarchy of sub-tasks.
|
||||
|
||||
### 4. Strategic Color & Density
|
||||
Color in a terminal is a scarce resource. It should be functional, not decorative.
|
||||
- **Rule:** Strip unnecessary colors. Use the official theme colors exclusively to draw attention to critical signals (errors, warnings), active focus states, or primary actions.
|
||||
- **Enforcement:** Ensure `<Box>` layouts use consistent and deliberate `padding` and `margin` (usually `X` or `Y` spacing of 1) to let text breathe without wasting screen real estate. Reject "rainbow" text or over-styled borders.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Review Request:** When asked to review a component (e.g., `InputPrompt.tsx`), load the file and analyze its Ink layout and React state.
|
||||
2. **Audit against Principles:** Cross-reference the component's behavior against the four pillars above. Check the [Components Reference](./references/components.md) to ensure existing primitives are being utilized.
|
||||
3. **Actionable Feedback:** Provide specific, code-level feedback. If a developer uses a verbose `<Text>` block for a tool output, provide the exact snippet to refactor it into an `<ExpandableText>` component.
|
||||
|
||||
Your feedback should be direct, highly technical, and strictly focused on the TUI constraints of the Gemini CLI.
|
||||
@@ -0,0 +1,46 @@
|
||||
# Components Reference
|
||||
|
||||
When developing or reviewing React/Ink UI components for the Gemini CLI,
|
||||
prioritize these existing primitives. Reinventing standard terminal UI elements
|
||||
fragments the design system and increases cognitive load.
|
||||
|
||||
## Core Layout & Typography
|
||||
|
||||
- **`<Box>`**: The fundamental building block. Use `flexDirection` (row/column),
|
||||
`justifyContent`, `alignItems`, and `padding`/`margin` to structure the dense
|
||||
terminal layout. Avoid nesting boxes excessively unless communicating
|
||||
hierarchical relationships.
|
||||
- **`<Text>`**: For all standard text rendering. Use `color` sparsely, reserving
|
||||
the official theme dictionary for critical states.
|
||||
- **`<Newline>`**: Use sparingly within `<Text>`. Prefer `<Box>` margins for
|
||||
structural spacing.
|
||||
|
||||
## Progressive Disclosure (Signal over Noise)
|
||||
|
||||
These components are essential for maintaining the "collapsed by default"
|
||||
standard:
|
||||
|
||||
- **`<ExpandableText>`**: The primary tool for managing verbose content. Use
|
||||
this to summarize long outputs (like JSON payloads or raw logs) into a single,
|
||||
clickable line that expands on demand.
|
||||
- **`<ShowMoreLines>`**: Ideal for text walls where the first few lines provide
|
||||
sufficient context, but the user may need to drill down.
|
||||
|
||||
## Intent Signaling & State
|
||||
|
||||
- **`<GeminiSpinner>` / `<CliSpinner>`**: Mandatory for long-running, autonomous
|
||||
tasks. Pair with a deterministic, sub-5-word status string.
|
||||
- **`<StatusDisplay>`**: Use to reflect the core loop state (e.g.,
|
||||
"Thinking...", "Waiting for input").
|
||||
- **`<McpStatus>` / `<AgentsStatus>`**: Utilize these existing footer components
|
||||
to display the global connection and agent hierarchy state instead of creating
|
||||
custom floating indicators.
|
||||
|
||||
## Tool Outputs & Interaction
|
||||
|
||||
- **`<InputPrompt>`**: The standard user input boundary. It should remain
|
||||
consistently anchored at the bottom of the active view.
|
||||
- **`<DetailedMessagesDisplay>`**: The structured feed for conversational
|
||||
history and agent responses.
|
||||
- **`<ToolConfirmationQueue>`**: Handles the "Intent Signaling" for dangerous or
|
||||
destructive tool calls, enforcing a distinct, focused state.
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
name: _ux_finish-pr
|
||||
description: Expert PR submission tool. Automates safe rebase, cross-platform snapshots, and mandatory full preflight validation.
|
||||
---
|
||||
|
||||
# UX Finish PR (High-Integrity Submission)
|
||||
|
||||
You are a senior co-author assistant. Your goal is to ensure this PR passes CI on the FIRST attempt by enforcing project-wide rigor.
|
||||
|
||||
## **Mandatory Submission Protocol**
|
||||
|
||||
### **1. Safe Rebase & Conflict Resolution**
|
||||
- **Action**: `git fetch origin main && git rebase origin/main`.
|
||||
- **Constraint**: NEVER use `git merge -X ours` or `git checkout --ours`.
|
||||
- **Verification**: If conflicts occur, resolve them surgically. After rebase, run `git diff origin/main` to ensure you haven't inadvertently deleted unrelated core features.
|
||||
|
||||
### **2. Neutral Environment Snapshots**
|
||||
- **Action**: If UI files were modified, you MUST run tests with:
|
||||
```bash
|
||||
TERM_PROGRAM=none npm test -w @google/gemini-cli -- -u
|
||||
```
|
||||
- **Reason**: This prevents macOS-specific icons (like `MAC_TERMINAL_ICON`) from leaking into snapshots, which causes CI failure on Linux runners.
|
||||
|
||||
### **3. Full Validation (No Shortcuts)**
|
||||
- **Action**: You MUST run the complete validation suite:
|
||||
```bash
|
||||
npm run preflight
|
||||
```
|
||||
- **Constraint**: Passing individual tests is NOT enough. `preflight` ensures `tsc --build` passes, catching TypeScript inference bugs that unit tests miss.
|
||||
- **TDD Fallback**: If `preflight` fails, you must create a local reproduction test before attempting a fix.
|
||||
|
||||
### **4. UI Dimension Audit**
|
||||
- **Action**: If Header or Footer height changed, check `packages/cli/src/test-utils/AppRig.tsx`.
|
||||
- **Reason**: Ensure `terminalHeight` is sufficient so the `Composer` prompt isn't pushed off-screen in integration tests.
|
||||
|
||||
### 5. Reviewer Feedback Management
|
||||
- **Mandatory Comprehensive Fetching**: You must use `gh api graphql` or advanced `gh pr view` parsing to explicitly extract *inline* review comments. Basic commands often miss these nested comments.
|
||||
- **Checklist Execution**: Enumerate every single comment from the reviewer and explicitly verify its resolution against the codebase.
|
||||
- **Direct Engagement**: Use the GitHub API to post a direct reply to *every* addressed inline comment (e.g., "Done. Extracted to a helper.") to provide a clear audit trail.
|
||||
|
||||
### 6. Safe File Reversion Protocol
|
||||
- **Merge-Base Awareness**: NEVER check out files blindly from the tip of `origin/main` to restore their pre-PR state.
|
||||
- **Reversion Protocol**: Always find the true branch point when reverting files to strip them from a PR:
|
||||
```bash
|
||||
BASE_SHA=$(git merge-base origin/main HEAD)
|
||||
git checkout $BASE_SHA -- <files_to_revert>
|
||||
```
|
||||
- **Diff Verification**: After reverting, run `git diff origin/main...HEAD` on the specific reverted files to ensure their diff is completely empty.
|
||||
|
||||
### 7. Final Submission
|
||||
- **Commit Strategy**: Squash commits for the main feature into a single Conventional Commit (e.g., `feat(ui): ...`), BUT keep code review fixes as separate commits. Do not squash review fixes into the main feature commit; reviewing the entire diff repeatedly is brutal for reviewers.
|
||||
- **Push**: `git push origin HEAD --force-with-lease`.
|
||||
- **Link**: Provide the GitHub PR link.
|
||||
|
||||
**Note**: If any step fails, do NOT claim completion. Fix the issue and restart from Step 1.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: _ux_git-worktree
|
||||
description: Manage Git Worktrees according to the "Base Folder Strategy". Use when the user wants to create branches, switch tasks, check out PRs, or manage parallel development environments.
|
||||
---
|
||||
|
||||
# Git Worktree
|
||||
|
||||
## Overview
|
||||
|
||||
This skill manages the **Git Worktree "Base Folder" strategy**, ensuring that all functional work occurs in sibling sub-directories (e.g., `main/`, `feature-name/`) rather than nested branches. It prevents sandbox interference and enables parallel development.
|
||||
|
||||
## Core Rules
|
||||
|
||||
1. **Enforced Hierarchy**: New tasks or branches MUST be created as sibling directories to `main/`.
|
||||
2. **No Nesting**: Branches should never be created inside existing sub-folders.
|
||||
3. **Metadata Pathing**: When operating in a worktree, always include the primary `main/.git` path in the trusted environment to bypass macOS sandbox restrictions.
|
||||
|
||||
## Workflows
|
||||
|
||||
### 1. Creating a New Task (Branch)
|
||||
|
||||
When the user asks to "start a new task" or "create a branch":
|
||||
1. Identify the base directory (the parent of `main/`).
|
||||
2. Use `git worktree add ../<branch-name> -b <branch-name>` from within `main/`.
|
||||
3. **Mandatory Prep**: Run `npm install` inside the new worktree directory to ensure all dependencies are resolved.
|
||||
4. Instruct the user to move into the new directory and reload their session.
|
||||
|
||||
### 2. Checking out a PR (Semantic Naming)
|
||||
|
||||
When the user asks to "check out PR #123":
|
||||
1. **NEVER** use standard `gh pr checkout` without a directory.
|
||||
2. **ALWAYS** use the automation script: `./packages/extensions/ux-toolkit/skills/_ux_git-worktree/scripts/worktree-manager.sh pr 123`.
|
||||
3. **Mandatory Prep**: Run `npm install` inside the new worktree directory to ensure all dependencies are resolved.
|
||||
4. This script will automatically fetch the PR title and create a semantic directory name (e.g., `pr-123-fix-core-bug`).
|
||||
|
||||
### 3. Committing Changes in a Worktree
|
||||
|
||||
If operating in a sibling worktree (e.g., `feature-xyz/`):
|
||||
1. Check for sandbox access to `../main/.git`.
|
||||
2. If access is denied, use `/directory add ../main/.git` (if interactive) or suggest the `--include-directories` flag for the next launch.
|
||||
|
||||
## Task-Based Guide
|
||||
|
||||
### Managing Worktrees
|
||||
- **List Worktrees**: Run `git worktree list`.
|
||||
- **Semantic PR Checkout**: `worktree-manager.sh pr <number>`.
|
||||
- **Add Manual Worktree**: `git worktree add ../<dir> <branch>`.
|
||||
- **Remove Worktree**: `git worktree remove <dir>`.
|
||||
|
||||
## Resources
|
||||
|
||||
### references/architecture.md
|
||||
Technical details of the "Base Folder" standard.
|
||||
|
||||
### scripts/worktree-manager.sh
|
||||
Automated wrapper for Git Worktree operations that handles sibling pathing, semantic PR naming, and metadata links.
|
||||
@@ -0,0 +1,24 @@
|
||||
# Base Folder Strategy Architecture
|
||||
|
||||
## Directory Layout
|
||||
|
||||
```text
|
||||
/project-root/ <-- Container directory (Base Folder)
|
||||
├── main/ # Primary repository checkout (contains .git/)
|
||||
├── feature-alpha/ # Isolated worktree for feature 'alpha'
|
||||
├── bugfix-beta/ # Isolated worktree for bugfix 'beta'
|
||||
└── ...
|
||||
```
|
||||
|
||||
## Shared Metadata
|
||||
|
||||
All worktrees (`feature-alpha/`, `bugfix-beta/`, etc.) share the Git database
|
||||
located in `main/.git`. Git worktrees use a `.git` file (not a directory) that
|
||||
contains a pointer to the original metadata:
|
||||
`gitdir: /path/to/main/.git/worktrees/feature-alpha`
|
||||
|
||||
## Sandbox Constraints (macOS)
|
||||
|
||||
On macOS, the Seatbelt sandbox restricts write access to the worktree directory
|
||||
only. To perform Git operations (which modify `main/.git/worktrees/`), the agent
|
||||
requires explicit access to the `main/.git` path.
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# worktree-manager.sh - Manage sibling worktrees for Gemini CLI
|
||||
|
||||
set -e
|
||||
|
||||
ACTION="${1}"
|
||||
NAME="${2}"
|
||||
BRANCH="${3}"
|
||||
|
||||
BASE_DIR="$(pwd)"
|
||||
PARENT_DIR="$(dirname "${BASE_DIR}")"
|
||||
|
||||
slugify() {
|
||||
local input="${1}"
|
||||
local slug
|
||||
slug=$(echo "${input}" | iconv -t ascii//TRANSLIT)
|
||||
slug=$(echo "${slug}" | tr -cd "[:alnum:] ")
|
||||
slug=$(echo "${slug}" | tr "[:upper:]" "[:lower:]")
|
||||
slug=$(echo "${slug}" | tr " " "-")
|
||||
slug="${slug//--/-}"
|
||||
slug=$(echo "${slug}" | cut -c 1-50)
|
||||
echo "${slug}"
|
||||
}
|
||||
|
||||
case "${ACTION}" in
|
||||
"add")
|
||||
if [[ -z "${NAME}" ]] || [[ -z "${BRANCH}" ]]; then
|
||||
echo "Error: Usage: worktree-manager.sh add <dir-name> <branch-name>"
|
||||
exit 1
|
||||
fi
|
||||
git worktree add "${PARENT_DIR}/${NAME}" "${BRANCH}"
|
||||
echo "Success: Added worktree at ${PARENT_DIR}/${NAME} tracking branch ${BRANCH}"
|
||||
;;
|
||||
"pr")
|
||||
if [[ -z "${NAME}" ]]; then
|
||||
echo "Error: Usage: worktree-manager.sh pr <pr-number>"
|
||||
exit 1
|
||||
fi
|
||||
PR_NUMBER="${NAME}"
|
||||
echo "Fetching PR details for #${PR_NUMBER}..."
|
||||
|
||||
PR_DATA=$(gh pr view "${PR_NUMBER}" --json title,headRefName)
|
||||
|
||||
PR_TITLE=$(echo "${PR_DATA}" | jq -r .title)
|
||||
PR_BRANCH=$(echo "${PR_DATA}" | jq -r .headRefName)
|
||||
|
||||
SLUG=$(slugify "${PR_TITLE}")
|
||||
DIR_NAME="pr-${PR_NUMBER}-${SLUG}"
|
||||
|
||||
echo "Creating semantic worktree: ${DIR_NAME}"
|
||||
git worktree add "${PARENT_DIR}/${DIR_NAME}" "${PR_BRANCH}"
|
||||
echo "Success: Added PR worktree at ${PARENT_DIR}/${DIR_NAME}"
|
||||
;;
|
||||
"list")
|
||||
git worktree list
|
||||
;;
|
||||
"remove")
|
||||
if [[ -z "${NAME}" ]]; then
|
||||
echo "Error: Usage: worktree-manager.sh remove <dir-name>"
|
||||
exit 1
|
||||
fi
|
||||
git worktree remove "${PARENT_DIR}/${NAME}"
|
||||
echo "Success: Removed worktree ${PARENT_DIR}/${NAME}"
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown action ${ACTION}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
name: _ux_string-reviewer
|
||||
description: >
|
||||
Use this skill when asked to review text and user-facing strings within the codebase. It ensures that these strings follow rules on clarity,
|
||||
usefulness, brevity and style.
|
||||
---
|
||||
|
||||
# String Reviewer
|
||||
|
||||
## Instructions
|
||||
|
||||
Act as a Senior UX Writer. Look for user-facing strings that are too long,
|
||||
unclear, or inconsistent. This includes inline text, error messages, and other
|
||||
user-facing text.
|
||||
|
||||
Do NOT automatically change strings without user approval. You must only suggest
|
||||
changes and do not attempt to rewrite them directly unless the user explicitly
|
||||
asks you to do so.
|
||||
|
||||
## Core voice principles
|
||||
|
||||
The system prioritizes deterministic clarity over conversational fluff. We
|
||||
provide telemetry, not etiquette, ensuring the user retains absolute agency..
|
||||
|
||||
1. **Deterministic clarity:** Distinguish between certain system/service states
|
||||
(Cloud Billing, IAM, the System) and probabilistic AI analysis (Gemini).
|
||||
2. **System transparency:** Replace "Loading..." with active technical telemetry
|
||||
(e.g., Tracing stack traces...). Keep status updates under 5 words.
|
||||
3. **Front-loaded actionability:** Always use the [Goal] + [Action] pattern.
|
||||
Lead with intent so users can scan left-to-right.
|
||||
4. **Agentic error recovery:** Every error must be a pivot point. Pair failures
|
||||
with one-click recovery commands or suggested prompts.
|
||||
5. **Contextual humility:** Reserve disclaimers and "be careful" warnings for P0
|
||||
(destructive/irreversible) tasks only. Stop warning-fatigue.
|
||||
|
||||
## The writing checklist
|
||||
|
||||
Use this checklist to audit UI strings and AI responses.
|
||||
|
||||
### Identity and voice
|
||||
- **Eliminate the "I":** Remove all first-person pronouns (I, me, my, mine).
|
||||
- **Subject attribution:** Refer to the AI as Gemini and the infrastructure as
|
||||
the - system or the CLI.
|
||||
- **Active voice:** Ensure the subject (Gemini or the system) is clearly
|
||||
performing the action.
|
||||
- **Ownership rule:** Use the system for execution (doing) and Gemini for
|
||||
analysis (thinking)
|
||||
|
||||
### Structural scannability
|
||||
- **The skip test:** Do the first 3 words describe the user’s intent? If not,
|
||||
rewrite.
|
||||
- **Goal-first sequence:** Use the template: [To Accomplish X] + [Do Y].
|
||||
- **The 5-word rule:** Keep status updates and loading states under 5 words.
|
||||
- **Telemetry over etiquette:** Remove polite filler (Please wait, Thank you,
|
||||
Certainly). Replace with raw data or progress indicators.
|
||||
- **Micro-state cycles:** For tasks $> 3$ seconds, cycle through specific
|
||||
sub-states (e.g., Parsing logs... ➔ Identifying patterns...) to show momentum.
|
||||
|
||||
|
||||
### Technical accuracy and humility
|
||||
- **Verb signal check:** Use deterministic verbs (is, will, must) for system
|
||||
state/infrastructure.
|
||||
- Use probabilistic verbs (suggests, appears, may, identifies) for AI output.
|
||||
- **No 100% certainty:** Never attribute absolute certainty to model-generated
|
||||
content.
|
||||
- **Precision over fuzziness:** Use technical metrics (latency, tokens, compute) instead of "speed" or "cost."
|
||||
- **Instructional warnings:** Every warning must include a specific corrective action (e.g., "Perform a dry-run first" or "Review line 42").
|
||||
|
||||
### Agentic error recovery
|
||||
- **The one-step rule:** Pair every error message with exactly one immediate
|
||||
path to a fix (command, link, or prompt).
|
||||
- **Human-first:** Provide a human-readable explanation before machine error
|
||||
codes (e.g., 404, 500).
|
||||
- **Suggested prompts:** Offer specific text for the user to copy/click like
|
||||
“Ask Gemini: 'Explain this port error.'”
|
||||
|
||||
### Use consistent terminology
|
||||
|
||||
Ensure all terminology aligns with the project [word
|
||||
list](./references/word-list.md).
|
||||
|
||||
If a string uses a term marked "do not use" or "use with caution," provide a
|
||||
correction based on the preferred terms.
|
||||
|
||||
## Ensure consistent style for settings
|
||||
|
||||
If `packages/cli/src/config/settingsSchema.ts` is modified, confirm labels and
|
||||
descriptions specifically follow the unique [Settings
|
||||
guidelines](./references/settings.md).
|
||||
|
||||
## Output format
|
||||
When suggesting changes, always present your review using the following list
|
||||
format. Do not provide suggestions outside of this list..
|
||||
|
||||
```
|
||||
1. **{Rationale/Principle Violated}**
|
||||
- ❌ "{incorrect phrase}"
|
||||
- ✅ `"{corrected phrase}"`
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# Settings
|
||||
|
||||
## Noun-First Labeling (Scannability)
|
||||
|
||||
Labels must start with the subject of the setting, not the action. This allows
|
||||
users to scan for the feature they want to change.
|
||||
|
||||
- **Rule:** `[Noun]` `[Attribute/Action]`
|
||||
- **Example:** `Show line numbers` becomes simply `Line numbers`
|
||||
|
||||
## Positive Boolean Logic (Cognitive Ease)
|
||||
|
||||
Eliminate "double negatives." Booleans should represent the presence of a
|
||||
feature, not its absence.
|
||||
|
||||
- **Rule:** Replace `Disable {feature}` or `Hide {Feature}` with
|
||||
`{Feature} enabled` or simply `{Feature}`.
|
||||
- **Example:** Change "Disable auto update" to "Auto update".
|
||||
- **Implementation:** Invert the boolean value in your config loader so true
|
||||
always equals `On`
|
||||
|
||||
## Verb Stripping (Brevity)
|
||||
|
||||
Remove redundant leading verbs like "Enable," "Use," "Display," or "Show" unless
|
||||
they are part of a specific technical term.
|
||||
|
||||
- **Rule**: If the label works without the verb, remove it
|
||||
- **Example**: Change `Enable prompt completion` to `Prompt completion`
|
||||
@@ -0,0 +1,61 @@
|
||||
## Terms
|
||||
|
||||
### Preferred
|
||||
|
||||
- Use **create** when a user is creating or setting up something.
|
||||
- Use **allow** instead of **may** to indicate that permission has been granted
|
||||
to perform some action.
|
||||
- Use **canceled**, not **cancelled**.
|
||||
- Use **configure** to refer to the process of changing the attributes of a
|
||||
feature, even if that includes turning on or off the feature.
|
||||
- Use **delete** when the action being performed is destructive.
|
||||
- Use **enable** for binary operations that turn a feature or API on. Use "turn
|
||||
on" and "turn off" instead of "enable" and "disable" for other situations.
|
||||
- Use **key combination** to refer to pressing multiple keys simultaneously.
|
||||
- Use **key sequence** to refer to pressing multiple keys separately in order.
|
||||
- Use **modify** to refer to something that has changed vs obtaining the latest
|
||||
version of something.
|
||||
- Use **remove** when the action being performed takes an item out of a larger
|
||||
whole, but doesn't destroy the item itself.
|
||||
- Use **set up** as a verb. Use **setup** as a noun or adjective.
|
||||
- Use **show**. In general, use paired with **hide**.
|
||||
- Use **sign in**, **sign out** as a verb. Use **sign-in** or **sign-out** as a
|
||||
noun or adjective.
|
||||
- Use **update** when you mean to obtain the latest version of something.
|
||||
- Use **want** instead of **like** or **would like**.
|
||||
|
||||
#### Don't use
|
||||
|
||||
- Don't use **etc.** It's redundant. To convey that a series is incomplete,
|
||||
introduce it with "such as" instead.
|
||||
- Don't use **hostname**, use "host name" instead.
|
||||
- Don't use **in order to**. It's too formal. "Before you can" is usually better
|
||||
in UI text.
|
||||
- Don't use **one or more**. Specify the quantity where possible. Use "at least
|
||||
one" when the quantity is 1+ but you can't be sure of the number. Likewise,
|
||||
use "at least one" when the user must choose a quantity of 1+.
|
||||
- Don't use the terms **log in**, **log on**, **login**, **logout** or **log
|
||||
out**.
|
||||
- Don't use **like** or **would you like**. Use **want** instead. Better yet,
|
||||
rephrase so that it's not referring to the user's emotional state, but rather
|
||||
what is required.
|
||||
|
||||
#### Use with caution
|
||||
|
||||
- Avoid using **leverage**, especially as a verb. "Leverage" is considered a
|
||||
buzzword largely devoid of meaning apart from the simpler "use".
|
||||
- Avoid using **once** as a synonym for "after". Typically, when "once" is used
|
||||
in this way, it is followed by a verb in the perfect tense.
|
||||
- Don't use **e.g.** Use "example", "such as", "like", or "for example". The
|
||||
phrase is always followed by a comma.
|
||||
- Don't use **i.e.** unless absolutely essential to make text fit. Use "that is"
|
||||
instead.
|
||||
- Use **disable** for binary operations that turn a feature or API off. Use
|
||||
"turn on" and "turn off" instead of "enable" and "disable" for other
|
||||
situations. For UI elements that are not available, use "dimmed" instead of
|
||||
"disabled".
|
||||
- Use **please** only when you're asking the user to do something inconvenient,
|
||||
not just following the instructions in a typical flow.
|
||||
- Use **really** sparingly in such constructions as "Do you really want to..."
|
||||
Because of the weight it puts on the decision, it should be used to confirm
|
||||
actions that the user is extremely unlikely to make.
|
||||
Reference in New Issue
Block a user