# Phase 4 Commit Strategy and Phase 5 Wiki, per Project (Copilot CLI)

## Phase 4: Commit & PR  -  project-specific strategy

### my-figma-app
1. **Ask**: "Want to commit?"
   - **No** → Pause; the user continues with `resume` when ready
   - **Yes** → continue:
2. Run `/figma-iteration-commit {ComponentName}`
   - Build verification, test, key sync, code review, submodule commits to `iteration/develop`, push with rebase-retry, issue housekeeping, auto-unblock dependents  -  the skill handles all of it
   - Do NOT commit manually  -  the skill manages everything
3. Log: `📦 Phase 4: figma-iteration-commit  -  {ComponentName}`

### my-app / generic
1. **Ask**: "Want to commit?"
   - **No** → Pause; the user continues with `resume` when ready
   - **Yes** → continue:
2. Stage changes: `git add` with specific files (NOT `git add -A`  -  avoid committing .env, credentials, or other sensitive files)
3. Commit with convention: `{type}({scope}): {description} [PROJ-{id}]`
   - Author: resolved from `prefs.global.identities[]` (e.g. `Ada Lovelace <ada@example.com>`)  -  NEVER hardcode.
4. Push to remote
5. **Ask**: "Want to open a Pull Request?"
   - **No** → go to Phase 5 (only commit + push will have been done)
   - **Yes** → create the PR (target: source branch)
6. **Issue body update** (if GitHub Issue exists):
   - Fill PR links in issue body: `- **common:** {PR URL}`, `- **uicomponents:** {PR URL}`
   - Update Progress flags: `Implementation 🟢`, `Testing 🟢`, `Code Connect 🟢`
   - Write the updated body to a temp file and use `gh issue edit {issueNo} --body-file <file>`  -  preserve all existing sections
7. Log: `📦 Phase 4: Commit {sha}  -  PR #{number}`

## Phase 5 Report Step 2: Wiki + Figma screenshots

For component tasks with a GitHub Issue. Skip this sub-step if the task is NOT a
component implementation (e.g., bug fix, refactor).

**Wiki submodule location**: `~/my-figma-app/<project>Packages/Packages/my-ui-components-wiki`

1. **Determine wiki path** from component location:
   - `DesignSystemCore/SeatMap/SeatMapAircraftDetails/` → `{wikiRoot}/DesignSystemCore/SeatMap/SeatMapAircraftDetails/`
   - Pattern: `{wikiRoot}/{category}/{ComponentName}/`
2. **Create directory**: `mkdir -p {wikiComponentPath}/assets`
3. **Fetch Figma screenshot** via REST API:
   ```bash
   FIGMA_TOKEN=$(~/.copilot/lib/credential-store.sh get "Figma_Access_Token")
   printf 'X-Figma-Token: %s\n' "$FIGMA_TOKEN" | curl -s -H @- \
     "https://api.figma.com/v1/images/{fileKey}?ids={nodeId}&format=png&scale=2"
   # Download the image URL to {wikiComponentPath}/assets/screenshot.png
   ```
4. **Generate main wiki page** (`{ComponentName}.md`):
   - Follow existing wiki convention (see Tooltip.md, FileUploadFileDescription.md as references)
   - Sections: title, screenshot embed, Figma link, Screen/Section/Size, Overview, Testing Identifiers, Localization Keys, Accessibility, Analytics Events, Sub-Components, Platform Implementations, Changelog
   - Screenshot embed: `[[/{wikiCategory}/{ComponentName}/assets/screenshot.png|{ComponentName}]]`
5. **Generate iOS wiki page** (`{ComponentName}-iOS.md`):
   - Sections: Initializer (with code), Parameters table, Modifiers, Usage examples, Design Tokens table, Testing Identifiers iOS, Code Connect status, Snapshot Tests (with image embeds), Test Coverage, Changelog
   - Snapshot image embeds use `[[/{wikiCategory}/{ComponentName}/assets/ios_{variant}.png]]` format
   - Note: actual snapshot images are generated when tests run in CI/locally
6. **Commit and push wiki**:
   ```bash
   cd {wikiRoot}
   git add {wikiCategory}/{ComponentName}/
   git commit -F - <<'MA_MSG'
   docs({scope}): add {ComponentName} wiki pages [PROJ-{id}]
   MA_MSG
   git fetch origin && git rebase origin/master
   git push origin HEAD:master
   ```
7. **Update issue Wiki flag**: Set `Wiki` → `🟢` in issue body
8. Log: `📖 Phase 5 Step 2: Wiki  -  {ComponentName}.md + {ComponentName}-iOS.md + screenshot`
