Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .agent/skills/test-copilot-pipe/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: test-copilot-pipe
description: Automotive deployment and testing of GitHub Copilot SDK Pipe plugin for frontend/backend status stability.
---

# 🤖 Skill: Test Copilot Pipe

This is a **universal testing framework** for publishing the latest `github_copilot_sdk.py` (Pipe) code to a local OpenWebUI instance and verifying it via an automated agent (`browser_subagent`).

## 🎯 Core Principles

- **Fixed Infrastructure**: The deployment script and the test entry URL are always static.
- **Dynamic Test Planning**: Specific test prompts and expectations (acceptance criteria) **must** be dynamically planned by you based on the code changes or specific user requests before execution.

---

## 🛠️ Static Environment Info

| Attribute | Fixed Value |
|------|--------|
| **Deployment Script** | `/Users/fujie/app/python/oui/openwebui-extensions/scripts/update_pipe.py` |
| **Python Path** | `/opt/homebrew/Caskroom/miniconda/base/envs/ai/bin/python3` |
| **Test URL** | `http://localhost:3003/?model=github_copilot_official_sdk_pipe.github_copilot_sdk-gpt-4.1` |

---

## 📋 Standard Workflow

### Step 1: Analyze Changes & Plan Test (Plan)

Before triggering the test, you must define the purpose of this test turn.
Example: *Modified tool calling logic -> Test prompt should trigger a specific tool; observe if the tool executes and returns the correct result.*

### Step 2: Deploy Latest Code (Deploy)

Use the `run_command` tool to execute the fixed update task:

```bash
/opt/homebrew/Caskroom/miniconda/base/envs/ai/bin/python3 /Users/fujie/app/python/oui/openwebui-extensions/scripts/update_pipe.py
```

> **Mechanism**: `update_pipe.py` automatically loads the API Key from `scripts/.env` in the same directory.
> **Verification**: Look for `✅ Successfully updated... version X.X.X`. If a 401 error occurs, remind the user to generate a new API Key in OpenWebUI and update `.env`.

### Step 3: Verify via Browser Subagent (Verify)

Use the `browser_subagent` tool. **You must fill in the `[Dynamic Content]` slots based on Step 1**:

```text
Task:
1. Access The Fixed URL: http://localhost:3003/?model=github_copilot_official_sdk_pipe.github_copilot_sdk-gpt-4.1
2. RELIABILITY WAIT: Wait until the page fully loads. Wait until the chat input text area (`#chat-input`) is present in the DOM.
3. ACTION - FAST INPUT: Use the `execute_browser_javascript` tool to instantly inject the query and submit it. Use exactly this script format to ensure stability:
`const input = document.getElementById('chat-input'); input.value = "[YOUR_DYNAMIC_TEST_PROMPT]"; input.dispatchEvent(new Event('input', { bubbles: true })); const e = new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true }); input.dispatchEvent(e);`
4. WAITING: Wait patiently for the streaming response to stop completely. You should wait for the Stop button to disappear, or wait for the system to settle (approximately 10-15 seconds depending on the query).
5. CHECK THE OUTCOME: [List the phenomena you expect to see, e.g., status bar shows specific text, tool card appears, result contains specific keywords, etc.]
6. CAPTURE: Take a screenshot of the settled state to prove the outcome.
7. REPORT: Report the EXACT outcome matching the criteria from step 5.
```

### Step 4: Evaluate & Iterate (Evaluate)

- **PASS**: Screenshot and phenomena match expectations. Report success to the user.
- **FAIL**: Analyze the issue based on screenshots/logs (e.g., race condition reappeared, API error). Modify the code and **re-run the entire skill workflow**.
121 changes: 121 additions & 0 deletions .github/TEMP_FILES_POLICY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Temporary Files Handling Policy

**Last Updated**: 2026-02-26
**Status**: Active Guideline

## Overview

All temporary files created during skill execution or development workflows must follow this centralized policy to maintain project cleanliness and workspace isolation alignment.

## Core Rule

**Temporary files MUST be stored in the project's `.temp/` directory, NOT in system directories like `/tmp`.**

## Rationale

1. **Workspace Isolation**: Aligns with OpenWebUI's workspace-per-user model
2. **Project Cohesion**: All project artifacts (temporary or permanent) stay within project boundaries
3. **Multi-User Safety**: Avoids conflicts between multiple developers using the same system
4. **Cleanup Traceability**: Easy to verify all temp files are cleaned up via single `.temp/` directory
5. **Debugging**: Inspectable before deletion if issues occur

## Usage Pattern

### Creating Temp File

```bash
# Step 1: Ensure temp directory exists
mkdir -p .temp

# Step 2: Write temp file
cat > .temp/my_temp_file.md << 'EOF'
...content...
EOF

# Step 3: Use the file in your workflow
# (e.g., pass to gh CLI, process with script, etc.)
```

### Cleanup After Use

```bash
# Remove individual temp files
rm -f .temp/my_temp_file.md

# Or full cleanup of entire temp directory
rm -rf .temp/
```

## Skills Affected

| Skill | Implementation | Status |
|-------|----------------|--------|
| `pr-submitter` | PR body file (`.temp/pr_body.md`) | ✅ Updated |
| `release-prep` | Draft notes (if any) | ✅ Policy Added |
| `version-bumper` | Backup files (if any) | ℹ️ Check needed |
| Future skills | TBD | 📋 Must follow policy |

## .gitignore Configuration

The following entry in `.gitignore` ensures temp files are never committed:

```
# Temporary files
.temp/
.build/
```

## Examples

### Example 1: PR Submitter Skill
```bash
# Create PR body in temp directory
mkdir -p .temp
cat > .temp/pr_body.md << 'EOF'
## Summary
New feature implementation
EOF

# Use with gh CLI
gh pr create --body-file .temp/pr_body.md --title "feat: new feature"

# Cleanup
rm -f .temp/pr_body.md
```

### Example 2: Release Prepare Workflow
```bash
# Create draft changelog
mkdir -p .temp
cat > .temp/changelog_draft.md << 'EOF'
# v1.0.0 Release Notes
EOF

# Edit, validate, then integrate into real files
# ...

# Cleanup
rm -f .temp/changelog_draft.md
```

## Anti-Patterns (❌ Don't Do This)

- ❌ Writing temp files to `/tmp` — will be lost/orphaned
- ❌ Writing to root directory or `plugins/` — pollutes repo
- ❌ Not cleaning up temp files — accumulates clutter
- ❌ Committing `.temp/` files to git — defeats the purpose
- ❌ Using absolute paths — breaks workflow portability

## Enforcement

1. **Code Review**: PRs should verify no `/tmp` references in scripts
2. **CI/CD**: Setup can validate `.temp/` cleanup via git status before commit
3. **Documentation**: All skill docs must reference this policy (link to this file)
4. **Automated**: Consider adding pre-commit hook to ensure `.temp/` is not staged

## Questions / Clarifications

For questions about this policy, refer to:
- `.github/skills/pr-submitter/SKILL.md` — Practical example
- `.github/skills/release-prep/SKILL.md` — Policy integration
- `/memories/repo/temp-file-handling-convention.md` — Internal notes
31 changes: 23 additions & 8 deletions .github/skills/pr-submitter/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ This skill handles the final step of pushing a feature branch and creating a val

## Workflow

### Step 0 — Initialize Temp Directory (Project-Based)

For all temporary files, use the project's `.temp/` directory instead of system `/tmp`:

```bash
# Create temp directory if it doesn't exist
mkdir -p .temp
```

**Why**: All temporary files stay within the project workspace, avoiding system `/tmp` pollution and better aligning with OpenWebUI workspace isolation principles.

### Step 1 — Pre-Flight Checks

Run these checks before any push:
Expand Down Expand Up @@ -46,10 +57,10 @@ Gather:

### Step 3 — Build PR Body File (Shell-Escape-Safe)

**Always write the body to a temp file.** Never embed multi-line markdown with special characters directly in a shell command.
**Always write the body to a temp file in `.temp/` directory.** Never embed multi-line markdown with special characters directly in a shell command.

```bash
cat > /tmp/pr_body.md << 'HEREDOC'
cat > .temp/pr_body.md << 'HEREDOC'
## Summary

Brief one-sentence description of what this PR accomplishes.
Expand Down Expand Up @@ -101,12 +112,12 @@ Before submitting, verify the body file contains expected sections:

```bash
# Check key sections exist
grep -q "## Summary" /tmp/pr_body.md && echo "✅ Summary" || echo "❌ Summary missing"
grep -q "## Changes" /tmp/pr_body.md && echo "✅ Changes" || echo "❌ Changes missing"
grep -q "## 变更摘要" /tmp/pr_body.md && echo "✅ CN Section" || echo "❌ CN Section missing"
grep -q "## Summary" .temp/pr_body.md && echo "✅ Summary" || echo "❌ Summary missing"
grep -q "## Changes" .temp/pr_body.md && echo "✅ Changes" || echo "❌ Changes missing"
grep -q "## 变更摘要" .temp/pr_body.md && echo "✅ CN Section" || echo "❌ CN Section missing"

# Preview the body
cat /tmp/pr_body.md
cat .temp/pr_body.md
```

Ask the user to confirm the body content before proceeding.
Expand All @@ -126,7 +137,7 @@ gh pr create \
--base main \
--head $(git branch --show-current) \
--title "<PR title from Step 2>" \
--body-file /tmp/pr_body.md
--body-file .temp/pr_body.md
```

Always use `--body-file`, never `--body` with inline markdown.
Expand All @@ -151,9 +162,11 @@ gh pr edit <PR-NUMBER> --body-file /tmp/pr_body.md
### Step 8 — Cleanup

```bash
rm -f /tmp/pr_body.md
rm -f .temp/pr_body.md
```

**Note**: The `.temp/` directory itself is preserved for reuse; only the individual PR body file is deleted. To fully clean up: `rm -rf .temp/`

Report final PR URL to the user.

---
Expand All @@ -167,6 +180,8 @@ Report final PR URL to the user.
| Newlines in `--body` | File-based only |
| `$variable` expansion | Use `<< 'HEREDOC'` (quoted) |
| Double quotes in body | Safe in heredoc file |
| Temp file storage | Use `.temp/` dir, not `/tmp` |
| Cleanup after use | Always delete temp file (keep dir) |

---

Expand Down
7 changes: 7 additions & 0 deletions .github/skills/release-prep/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ This skill covers:

It **stops before** `git push` or `gh pr create`. Use the `pr-submitter` skill for those steps.

### Temporary File Convention

Any temporary files created during release prep (e.g., draft changelogs) must:
- Be written to the project's `.temp/` directory, **NOT** system `/tmp`
- Be cleaned up before commit using `rm -f .temp/file_name`
- Never be committed to git (add `.temp/` to `.gitignore`)

---

## Workflow
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ logs/
# Temporary files
*.tmp
*.temp
.temp/
.build/

# OpenWebUI specific
# Add any specific ignores for OpenWebUI plugins if needed
Expand Down
29 changes: 29 additions & 0 deletions docs/plugins/pipes/github-copilot-sdk-publish-file-tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# GitHub Copilot SDK Pipe - `publish_file_from_workspace` Tool Guide

## Summary

`publish_file_from_workspace` is the file delivery tool used by the GitHub Copilot SDK Pipe to publish workspace-generated files into OpenWebUI storage and return stable preview/download links.

## Input

- `filename` (required): Relative file path under current workspace.

## Delivery Modes

- `artifacts` (default): Return `[Preview]` + `[Download]`, with optional `html_embed` rendering in HTML block.
- `richui`: Return `[Preview]` + `[Download]`; integrated preview is rendered by Rich UI emitter.

## PDF Rule

For PDF outputs, always return markdown links only (`[Preview]`, `[Download]` when available). Do not embed PDF using iframe or HTML.

## Recommended Steps

1. Generate file in workspace.
2. Publish via `publish_file_from_workspace(filename=...)`.
3. Return links according to embed mode.
4. Apply PDF link-only rule for `.pdf` files.

## Reference

- Plugin local guide: `plugins/pipes/github-copilot-sdk/PUBLISH_FILE_FROM_WORKSPACE.md`
29 changes: 29 additions & 0 deletions docs/plugins/pipes/github-copilot-sdk-publish-file-tool.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# GitHub Copilot SDK Pipe - `publish_file_from_workspace` 工具指南

## 简介

`publish_file_from_workspace` 是 GitHub Copilot SDK Pipe 的文件交付工具,用于将工作区生成文件发布到 OpenWebUI 存储,并返回稳定的预览/下载链接。

## 输入参数

- `filename`(必填):当前工作区下的相对路径文件名。

## 交付模式

- `artifacts`(默认):返回 `[Preview]` + `[Download]`,可选在 HTML 代码块中渲染 `html_embed`。
- `richui`:返回 `[Preview]` + `[Download]`,集成预览由 Rich UI 发射器自动渲染。

## PDF 规则

PDF 必须只返回 Markdown 链接(`[Preview]`、`[Download]` 可用时),禁止 iframe 或 HTML 嵌入。

## 推荐流程

1. 在工作区生成文件。
2. 调用 `publish_file_from_workspace(filename=...)` 发布。
3. 按当前模式返回链接。
4. `.pdf` 严格执行仅链接规则。

## 参考

- 插件内完整指南:`plugins/pipes/github-copilot-sdk/PUBLISH_FILE_FROM_WORKSPACE_CN.md`
Loading