Skip to content

Commit 5ac9306

Browse files
authored
Add wiki documentation sync and Copilot skills infrastructure (#823)
1 parent 2fdb58c commit 5ac9306

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4209
-41
lines changed

.github/copilot-instructions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,12 @@ Format: `[Component/Feature] Description` (see existing entries for style)
248248
All code uses `DIPS.Mobile.UI.*` namespace. Platform folders (iOS/Android/dotnet) use same namespace as parent - no `.iOS` suffix.
249249

250250
## Wiki
251-
The codebase is documented in https://github.com/DIPSAS/DIPS.Mobile.UI/wiki
251+
The codebase is documented in https://github.com/DIPSAS/DIPS.Mobile.UI/wiki
252+
253+
Documentation source lives in the `wiki/` folder in the main repository and is auto-synced to the GitHub wiki via a GitHub Action on pushes to `main`. The `_Sidebar.md` is auto-generated alphabetically from all wiki pages — no manual sidebar edits needed.
254+
255+
**Documentation rules (enforced during PR creation and review):**
256+
1. **New features MUST have documentation** — add a `wiki/<FeatureName>.md` page in the PR
257+
2. **Changed behavior/API MUST update docs** — if code changes contradict existing wiki pages, update them
258+
3. **Breaking changes MUST update docs** — wiki must reflect the new API/behavior
259+
4. Always cross-reference changed code against existing `wiki/` pages to catch stale documentation
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
name: Write Component Documentation
3+
description: Generates wiki documentation for new DIPS.Mobile.UI components following established patterns and conventions.
4+
---
5+
6+
# Write Component Documentation
7+
8+
When asked to write documentation for a new component, generate a `wiki/<ComponentName>.md` page following the template and rules below.
9+
10+
## Trigger Phrases
11+
12+
- "Document this component"
13+
- "Write wiki page"
14+
- "Add documentation"
15+
- "Create wiki doc"
16+
17+
## Before Writing
18+
19+
1. **Read the component source code** — understand all public properties, bindable properties, events, commands, and options classes
20+
2. **Check for sub-components or variants** — e.g., `NavigationListItem` alongside `ListItem`, `FilledCheckBox` alongside `CheckBox`
21+
3. **Check for platform differences** — look at iOS/Android partial classes for behavioral differences
22+
4. **Check accessibility support** — does the component set semantic properties, use `TouchPlatformEffect`, or have accessibility-specific features?
23+
5. **Look at the sample app** — check `ComponentsSamples/` or `AccessibilitySamples/` for usage examples
24+
25+
## Template
26+
27+
Use the following structure. Sections marked **(if applicable)** should only be included when relevant.
28+
29+
```markdown
30+
<Short description of what the component is — 1-2 sentences. Written before any heading. Explain the purpose and when to use it.>
31+
32+
# Inspiration **(if applicable)**
33+
34+
<Links to design guidelines that inspired the component, e.g., Material Design, Apple Human Interface Guidelines.>
35+
36+
# Usage
37+
38+
<XAML example showing the most common/basic usage of the component.>
39+
40+
> <Any important notes about defaults, required properties, or common gotchas.>
41+
42+
# Styles **(if applicable)**
43+
44+
<List available styles/variants with a brief description of each.>
45+
46+
# Tips and tricks **(if applicable)**
47+
48+
<Practical guidance: recommended patterns, common combinations with other components, or things to watch out for.>
49+
50+
# Accessibility **(if applicable)**
51+
52+
<How the component behaves with VoiceOver/TalkBack. Any required semantic properties. Special accessibility features.>
53+
54+
# Properties
55+
56+
Inspect the [components properties class](<GitHub URL to .Properties.cs file>) to further customise and use it.
57+
```
58+
59+
### Sub-Component Pattern
60+
61+
When the component has variants or related sub-components, add them as `##` sections after the main component, each with their own `### Usage` and `### Properties`:
62+
63+
```markdown
64+
## SubComponentName
65+
66+
<Brief description of the sub-component.>
67+
68+
### Usage
69+
70+
<XAML example>
71+
72+
### Properties
73+
74+
Inspect the [components properties class](<GitHub URL>) to further customise and use it.
75+
```
76+
77+
## Writing Rules
78+
79+
### Intro
80+
- Start with a plain-text paragraph **before any heading** — describe what the component is and when people would use it
81+
- Keep it to 1-2 sentences
82+
83+
### Usage Sections
84+
- Always include at least one XAML code block with `xml` as the language tag
85+
- Use the `dui:` XML namespace prefix — do not show `xmlns` declarations (readers already know this)
86+
- Show the simplest working example first, then more advanced configurations
87+
- If C# code-behind is needed (e.g., ViewModel bindings, event handlers), include it after the XAML block using `csharp` as the language tag
88+
89+
### Properties
90+
- Always link to the `.Properties.cs` file on GitHub: `https://github.com/DIPSAS/DIPS.Mobile.UI/blob/main/src/library/DIPS.Mobile.UI/<path>/<Component>.Properties.cs`
91+
- Use the standard phrasing: *"Inspect the [components properties class](URL) to further customise and use it."*
92+
- This should be the **last section** (or last sub-section per component)
93+
94+
### Callouts
95+
- Use blockquotes (`>`) for notes, warnings, and platform-specific differences
96+
- Bold the callout type: `> **NB!**`, `> **NOTE:**`, `> **Important:**`
97+
- Use callouts for: default values, platform differences (iOS vs Android), UX warnings, required configurations
98+
99+
### Style
100+
- Use `#` (h1) for major sections
101+
- Use `##` (h2) for sub-components
102+
- Use `###` (h3) for sections within a sub-component
103+
- Be concise — developers scan documentation, not read it cover-to-cover
104+
- Write in present tense: *"The component displays..."* not *"The component will display..."*
105+
- Address the reader as *"you"*: *"Use this when you need..."*
106+
- Refer to end-users as *"people"*: *"People can tap to..."*
107+
108+
### What NOT to Include
109+
- No namespace/xmlns declarations (unless the component requires a non-standard namespace)
110+
- No installation or NuGet instructions
111+
- No `_Sidebar.md` references — it is auto-generated
112+
- No Figma links (designers maintain those separately)
113+
- Do not document internal/private APIs — only public-facing properties and usage

.github/instructions/create_pr.instructions.md renamed to .github/skills/pr-create/SKILL.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
2-
applyTo: '**'
2+
name: Create PR
3+
description: Creates a pull request with proper title, description, changelog updates, and wiki documentation checks.
34
---
5+
46
# Pull Request Creation Instructions
57

68
## Trigger Phrases
79
When I say **any** of these:
810
- "Create PR"
9-
- "Make PR"
11+
- "Make PR"
1012
- "PR"
1113
- "Create Pull Request"
1214
- "Make a PR"
@@ -15,12 +17,18 @@ When I say **any** of these:
1517

1618
## Action Steps
1719
1. **Check changes**: Get the diff between main branch and current branch
18-
2. **Update CHANGELOG.md**: Determine if Major/Minor/Patch bump is needed based on:
20+
2. **Update CHANGELOG.md** (only if `src/` has changes): Determine if Major/Minor/Patch bump is needed based on:
1921
- **Major**: Breaking changes (removed/changed public APIs)
2022
- **Minor**: New features (new components, properties, methods)
2123
- **Patch**: Bug fixes, internal improvements, accessibility fixes
2224
- Follow existing CHANGELOG.md format: `[Component/Feature] Description`
23-
3. **Generate PR**: Create pull request with title and body
25+
- **Skip** if the PR has no changes under `src/` — documentation-only, build scripts, CI/CD, and config changes do not require a changelog entry
26+
3. **Wiki documentation**: Check if documentation in `wiki/` needs to be added or updated:
27+
- **New feature?****MUST** add a new `wiki/<FeatureName>.md` page
28+
- **Changed behavior/API?****MUST** update the relevant existing wiki page
29+
- **Breaking change?****MUST** update wiki to reflect the new behavior
30+
- The sidebar is auto-generated — just add the `.md` file to `wiki/`
31+
4. **Generate PR**: Create pull request with title and body
2432

2533
## PR Format Requirements
2634

@@ -49,12 +57,16 @@ When I say **any** of these:
4957

5058
### Files Changed
5159
- Brief overview of major file changes
60+
```
5261

5362
## Additional Considerations
5463

5564
### Wiki Documentation
56-
If the change introduces new patterns or significant features, mention in the PR:
57-
> "This should be documented in the [wiki](https://github.com/DIPSAS/DIPS.Mobile.UI/wiki). Consider adding a page about [topic]."
65+
Documentation lives in the `wiki/` folder and is auto-synced to the GitHub wiki on merge to main.
66+
- **New features**: A wiki page in `wiki/` is **required** — not optional. Add it in the PR.
67+
- **Changed behavior**: Update the relevant `wiki/*.md` page in the same PR.
68+
- **Breaking changes**: Wiki must reflect the new API/behavior.
69+
- The `_Sidebar.md` is auto-generated from filenames — no manual sidebar edits needed.
5870

5971
### Tone and Style
6072
- **Clear**: Easy to understand what changed

.github/instructions/review.instructions.md renamed to .github/skills/pr-review/SKILL.md

Lines changed: 57 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
---
2-
applyTo: '**'
2+
name: Review PR
3+
description: Workflow and rules for AI-assisted pull request reviews.
34
---
5+
46
# Code Review Instructions
57

8+
## CRITICAL RULES
9+
10+
### NEVER Approve or Request Changes
11+
12+
**AI agents must NEVER use `--approve` or `--request-changes` flags.**
13+
14+
| Action | Allowed? | Why |
15+
|--------|----------|-----|
16+
| `gh pr review --approve` | **NEVER** | Approval is a human decision |
17+
| `gh pr review --request-changes` | **NEVER** | Blocking PRs is a human decision |
18+
19+
---
20+
621
## When I say "Review" or "Review my changes"
722
Perform a comprehensive code review of the current changes following these rules:
823

@@ -11,6 +26,34 @@ Perform a comprehensive code review of the current changes following these rules
1126
2. Analyze all modified files for adherence to project patterns
1227
3. Provide structured feedback with specific examples
1328

29+
### Post PR Overview Comment
30+
31+
When reviewing a PR, add a comment that gives the reviewer a clear understanding of the PR:
32+
33+
1. **Pull request overview** — A short summary based on the title, description, and changed files. Explain *what* the PR does and *why*.
34+
35+
2. **File summary** — A collapsible table listing each changed file with a brief description of the change. Use a `<details>` block so it can be minimized:
36+
37+
```markdown
38+
### Pull request overview
39+
40+
<one or two paragraphs summarizing the purpose and approach of the PR>
41+
42+
### Changes
43+
44+
- <bullet per logical change group>
45+
46+
<details>
47+
<summary>📁 File summary (<N> files changed)</summary>
48+
49+
| File | Description |
50+
|------|-------------|
51+
| `path/to/file.cs` | Brief description of what changed |
52+
| `path/to/other.cs` | Brief description of what changed |
53+
54+
</details>
55+
```
56+
1457
### Review Criteria
1558

1659
#### 1. Platform-Specific Implementation
@@ -53,32 +96,14 @@ Perform a comprehensive code review of the current changes following these rules
5396
-**Flag**: iOS-only or Android-only implementation without documented reason
5497
-**Check**: Visual consistency with design system
5598

56-
### Review Output Format
99+
#### 8. Wiki Documentation (wiki/)
100+
-**Flag**: New feature (component, effect, handler, service) without a corresponding wiki page in `wiki/`
101+
-**Flag**: Code changes that break or contradict existing wiki documentation (renamed APIs, changed behavior, removed features)
102+
-**Check**: If existing documented behavior changed, the relevant `wiki/*.md` page is updated in the same PR
103+
-**Check**: New wiki pages follow naming convention: `PascalCase.md` or `Hyphenated-Words.md`
104+
-**Check**: New wiki pages will appear in the auto-generated sidebar (no manual `_Sidebar.md` edits needed)
105+
- **Guidance**: Review all modified/added files and cross-reference with pages in `wiki/` to determine if documentation is affected
57106

58-
Provide feedback in this structure:
59-
60-
```markdown
61-
## Code Review Summary
62-
63-
### ✅ Strengths
64-
- [List positive aspects]
65-
66-
### ⚠️ Issues Found
67-
**Priority: High/Medium/Low**
68-
1. [Issue description]
69-
- **File**: `path/to/file.cs`
70-
- **Line**: XX
71-
- **Problem**: [What's wrong]
72-
- **Fix**: [Suggested solution with code example]
73-
74-
### 🔍 Questions/Clarifications
75-
- [Any unclear design decisions that need explanation]
76-
77-
### ✅ Approval Status
78-
- [ ] Ready to merge
79-
- [ ] Requires changes
80-
- [ ] Needs discussion
81-
```
82107

83108
### Common Review Patterns
84109

@@ -102,12 +127,10 @@ Provide feedback in this structure:
102127
- Require migration guide in PR description
103128
- Document deprecated APIs
104129

105-
### Things to Praise
106-
- Proper use of partial classes
107-
- Comprehensive accessibility support
108-
- Clear separation of concerns
109-
- Good test coverage in samples app
110-
- Well-documented platform differences
111-
130+
**For Documentation (wiki/):**
131+
- Check if any changed code contradicts existing wiki pages
132+
- Verify new features have a corresponding `wiki/<FeatureName>.md` page
133+
- If behavior or API changed, verify the relevant wiki page is updated
134+
- Praise when documentation is proactively added or updated
112135

113-
But use your judgment to adapt the review based on the specific changes made. You are encouraged to provide constructive feedback that helps maintain code quality and consistency across the project. Be a pro reviewer!
136+
But use your judgment to adapt the review based on the specific changes made. You are encouraged to provide constructive feedback that helps maintain code quality and consistency across the project. Be a pro reviewer!

.github/workflows/wiki-sync.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Sync Wiki
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'wiki/**'
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
sync-wiki:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Generate Sidebar
21+
run: |
22+
cd wiki
23+
echo "<!-- This file is auto-generated. Do not edit manually. -->" > _Sidebar.md
24+
echo "" >> _Sidebar.md
25+
echo "**[Home](Home)**" >> _Sidebar.md
26+
echo "" >> _Sidebar.md
27+
28+
# Collect all .md files except Home.md, _Sidebar.md, and _Footer.md
29+
# Sort them alphabetically and generate sidebar links
30+
for file in $(ls *.md | grep -v -E '^(Home|_Sidebar|_Footer)\.md$' | sort -f); do
31+
# Get the page name (filename without .md extension)
32+
page_name="${file%.md}"
33+
# Convert hyphens to spaces for display name
34+
display_name=$(echo "$page_name" | sed 's/-/ /g')
35+
echo "- [$display_name]($page_name)" >> _Sidebar.md
36+
done
37+
38+
- name: Sync to Wiki
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: |
42+
# Configure git
43+
git config --global user.name "github-actions[bot]"
44+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
45+
46+
# Clone the wiki repository
47+
wiki_url="https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.wiki.git"
48+
git clone "$wiki_url" /tmp/wiki-repo
49+
50+
# Remove all existing wiki content (except .git)
51+
find /tmp/wiki-repo -maxdepth 1 -not -name '.git' -not -name '.' -delete 2>/dev/null || true
52+
53+
# Copy all wiki content from the repo
54+
cp wiki/* /tmp/wiki-repo/
55+
56+
# Push changes if there are any
57+
cd /tmp/wiki-repo
58+
git add -A
59+
if git diff --cached --quiet; then
60+
echo "No changes to sync."
61+
else
62+
git commit -m "Sync wiki from main repository ($(date -u '+%Y-%m-%d %H:%M:%S UTC'))"
63+
git push
64+
echo "Wiki synced successfully."
65+
fi

0 commit comments

Comments
 (0)