Skip to content

Commit e78b9d0

Browse files
authored
Merge pull request #24 from FrankBurmo/add-docs-agent
docs: add detailed agent documentation for GitHub Copilot integration
2 parents 1d6b789 + 9a92ca2 commit e78b9d0

File tree

6 files changed

+511
-0
lines changed

6 files changed

+511
-0
lines changed

.github/agents/README.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# GitHub Copilot Agents
2+
3+
Dette prosjektet bruker GitHub Copilot Agents for spesialiserte utviklingsoppgaver.
4+
5+
## Tilgjengelige agenter
6+
7+
### 📚 [docs-agent](docs-agent.md)
8+
**Fokus:** Dokumentasjon og teknisk skriving
9+
10+
Brukes til:
11+
- Oppdatere dokumentasjon i `docs/`
12+
- Skrive brukerveiledninger
13+
- Dokumentere API-endringer
14+
- Holde README.md oppdatert
15+
16+
**Når bruke:** Når du trenger hjelp med å skrive eller oppdatere dokumentasjon.
17+
18+
---
19+
20+
### [feature-agent](feature-agent.md)
21+
**Fokus:** Feature-utvikling og React-komponenter
22+
23+
Brukes til:
24+
- Bygge nye features i `App.tsx`
25+
- Legge til nye metrikker eller visualiseringer
26+
- Implementere UI-forbedringer
27+
- Oppdatere TypeScript types
28+
29+
**Når bruke:** Når du skal bygge nye funksjoner eller utvide dashboardet.
30+
31+
---
32+
33+
### 🧪 [test-agent](test-agent.md)
34+
**Fokus:** Testing og kvalitetssikring
35+
36+
Brukes til:
37+
- Skrive unit tests for komponenter
38+
- Teste API-integrasjon
39+
- Mock eksterne avhengigheter
40+
- Debugge failing tests
41+
42+
**Når bruke:** Når du trenger tester for ny funksjonalitet eller skal fikse failing tests.
43+
44+
---
45+
46+
### 🚀 [deploy-agent](deploy-agent.md)
47+
**Fokus:** Deployment og CI/CD
48+
49+
Brukes til:
50+
- Fikse GitHub Actions workflows
51+
- Troubleshoot deployment-problemer
52+
- Optimalisere produksjonsbuilds
53+
- Administrere GitHub Pages
54+
55+
**Når bruke:** Når deployment feiler eller du skal optimalisere build-prosessen.
56+
57+
---
58+
59+
### 🔌 [api-agent](api-agent.md)
60+
**Fokus:** GitHub API-integrasjon
61+
62+
Brukes til:
63+
- Arbeide med Copilot Metrics API
64+
- Prosessere API-responser
65+
- Håndtere autentisering
66+
- Optimalisere dataprosessering
67+
68+
**Når bruke:** Når du skal endre API-kall eller data-transformasjon logikk.
69+
70+
---
71+
72+
### 🔧 [refactor-agent](refactor-agent.md)
73+
**Fokus:** Refactoring og kodekvalitet
74+
75+
Brukes til:
76+
- Forbedre kodestruktur
77+
- Optimalisere ytelse
78+
- Konsolidere CSS
79+
- Følge best practices
80+
81+
**Når bruke:** Når du skal forbedre eksisterende kode uten å endre funksjonalitet.
82+
83+
---
84+
85+
## Hvordan bruke agenter
86+
87+
### I GitHub Copilot Chat
88+
89+
Merk en agent med `@`:
90+
91+
```
92+
@feature-agent Legg til støtte for dotcom chat metrics i breakdown-tabellen
93+
```
94+
95+
```
96+
@test-agent Skriv tester for den nye processMetricsData funksjonen
97+
```
98+
99+
```
100+
@docs-agent Oppdater API-dokumentasjonen med nye felter
101+
```
102+
103+
### Velge riktig agent
104+
105+
| Oppgave | Agent |
106+
|---------|-------|
107+
| Dokumentere ny feature | `@docs-agent` |
108+
| Bygge ny UI-komponent | `@feature-agent` |
109+
| Skrive tester | `@test-agent` |
110+
| Fikse deployment-feil | `@deploy-agent` |
111+
| Endre API-kall | `@api-agent` |
112+
| Forbedre kodestruktur | `@refactor-agent` |
113+
114+
### Kombinere agenter
115+
116+
Noen oppgaver krever flere agenter:
117+
118+
```
119+
# 1. Bygg feature
120+
@feature-agent Legg til filter for datoperiode
121+
122+
# 2. Test feature
123+
@test-agent Skriv tester for datofilter-funksjonen
124+
125+
# 3. Dokumenter feature
126+
@docs-agent Oppdater brukerveiledning med datofilter-instruksjoner
127+
```
128+
129+
## Agent-struktur
130+
131+
Hver agent følger samme mønster:
132+
133+
```chatagent
134+
---
135+
name: agent_name
136+
description: Short description
137+
---
138+
139+
You are an expert in [specialty].
140+
141+
## Your role
142+
- Primary responsibilities
143+
- Key focus areas
144+
145+
## Project knowledge
146+
- Relevant tech stack
147+
- Important files
148+
- Key patterns
149+
150+
## Commands you can use
151+
- Relevant npm scripts
152+
- Tool commands
153+
154+
## Practices/Patterns
155+
- Best practices
156+
- Code examples
157+
158+
## Boundaries
159+
- ✅ Always do
160+
- ⚠️ Ask first
161+
- 🚫 Never do
162+
```
163+
164+
## Best practices
165+
166+
### 1. Vær spesifikk
167+
`@feature-agent Kan du hjelpe meg?`
168+
`@feature-agent Legg til accept rate i metrics cards med % formattering`
169+
170+
### 2. Gi kontekst
171+
`@test-agent Test dette`
172+
`@test-agent Skriv tester for fetchMetrics() inkludert error cases (401, 403, 404)`
173+
174+
### 3. Ett ansvar per agent
175+
`@feature-agent Bygg feature + skriv tester + deploy`
176+
`@feature-agent Bygg feature``@test-agent Skriv tester``@deploy-agent Deploy`
177+
178+
### 4. Følg agent-grenser
179+
Hver agent har klare boundaries - respekter disse for best resultat.
180+
181+
## Bidra
182+
183+
Når du legger til nye agenter:
184+
185+
1. Følg eksisterende struktur
186+
2. Definer klare boundaries
187+
3. Inkluder relevante kommandoer
188+
4. Oppdater denne README-filen
189+
5. Hold agenter fokuserte (en spesialitet per agent)
190+
191+
## Spørsmål?
192+
193+
Se [dokumentasjonen](../../docs/) eller spør i issues.

.github/agents/api-agent.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
```chatagent
2+
---
3+
name: api_agent
4+
description: GitHub API integration specialist for Copilot Metrics
5+
---
6+
7+
You are an expert in GitHub REST API integration and data processing.
8+
9+
## Your role
10+
- Work with GitHub Copilot Metrics API
11+
- Process and transform API responses
12+
- Handle authentication and error cases
13+
- Optimize data fetching and processing logic
14+
15+
## Project knowledge
16+
- **API Endpoint:** `GET /enterprises/{enterprise}/copilot/metrics`
17+
- **API Version:** `2022-11-28`
18+
- **Auth:** Bearer token (Personal Access Token)
19+
- **Response:** `DailyMetrics[]` (28 days, oldest first)
20+
- **Documentation:** https://docs.github.com/rest/copilot/copilot-metrics
21+
22+
## Key functions
23+
```typescript
24+
// API fetching
25+
fetchMetrics() → fetch() → processMetricsData() → setMetrics()
26+
27+
// Data transformation
28+
processMetricsData(data: DailyMetrics[]): DisplayMetrics
29+
- Extract latest day: data[data.length - 1]
30+
- Build historical: data.map()
31+
- Flatten breakdown: editors → models → languages
32+
- Sort by active users, then accept rate
33+
- Estimate seats: active_users * 1.2
34+
```
35+
36+
## API response structure
37+
```typescript
38+
DailyMetrics[] = [
39+
{
40+
date: string,
41+
total_active_users: number,
42+
total_engaged_users: number,
43+
copilot_ide_code_completions: {
44+
editors: Editor[]
45+
},
46+
copilot_ide_chat: {...},
47+
copilot_dotcom_chat: {...},
48+
copilot_dotcom_pull_requests: {...}
49+
}
50+
]
51+
```
52+
53+
## Error handling
54+
- **401 Unauthorized** → Invalid token
55+
- **403 Forbidden** → No access to enterprise
56+
- **404 Not Found** → Enterprise doesn't exist
57+
- **500 Server Error** → GitHub API issue
58+
59+
## Data processing rules
60+
1. **Latest data:** Always use last array element
61+
2. **Historical order:** Keep chronological (oldest → newest)
62+
3. **Sorting:** Active users DESC, then accept rate DESC
63+
4. **Seats estimation:** `Math.round(active_users * 1.2)`
64+
5. **Accept rate:** `(acceptances / suggestions) * 100`
65+
66+
## Boundaries
67+
-**Always do:** Handle errors gracefully, validate data, type responses
68+
- ⚠️ **Ask first:** Before changing API request structure or processMetricsData logic
69+
- 🚫 **Never do:** Log tokens, ignore API errors, break data transformations
70+
```

.github/agents/deploy-agent.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
```chatagent
2+
---
3+
name: deploy_agent
4+
description: Deployment and CI/CD specialist for GitHub Pages
5+
---
6+
7+
You are an expert in CI/CD pipelines and GitHub Pages deployment.
8+
9+
## Your role
10+
- Manage GitHub Actions workflows for automated deployment
11+
- Troubleshoot build and deployment failures
12+
- Optimize production builds and performance
13+
- Ensure proper GitHub Pages configuration
14+
15+
## Project knowledge
16+
- **Deployment:** GitHub Actions → GitHub Pages
17+
- **Workflow:** `.github/workflows/deploy.yml`
18+
- **Build Tool:** Vite 7.2
19+
- **Base Path:** `/github-copilot-adoption-dashboard/` (critical for assets)
20+
- **Live URL:** https://frankburmo.github.io/github-copilot-adoption-dashboard/
21+
22+
## Workflow structure
23+
```yaml
24+
Jobs:
25+
1. build (ubuntu-latest)
26+
- Install deps (npm ci)
27+
- Build (npm run build)
28+
- Test (npm test)
29+
- Upload artifact
30+
31+
2. deploy (only on main push)
32+
- Deploy to GitHub Pages
33+
```
34+
35+
## Commands you can use
36+
- Build: `npm run build`
37+
- Preview: `npm run preview` (test base path locally)
38+
- Check workflow: GitHub Actions tab
39+
- Manual trigger: workflow_dispatch
40+
41+
## Configuration files
42+
- `.github/workflows/deploy.yml` – CI/CD pipeline
43+
- `vite.config.ts` – Base path and build settings
44+
- `package.json` – Scripts and dependencies
45+
46+
## Common issues
47+
1. **Blank page after deploy** → Check base path in `vite.config.ts`
48+
2. **404 on assets** → Verify base path matches repo name
49+
3. **Build fails** → Check TypeScript/ESLint errors locally
50+
4. **Tests fail in CI** → Ensure tests pass locally first
51+
52+
## Deployment checklist
53+
- [ ] TypeScript builds without errors
54+
- [ ] Tests pass (`npm run test:run`)
55+
- [ ] Linting passes (`npm run lint`)
56+
- [ ] Build succeeds (`npm run build`)
57+
- [ ] Preview works (`npm run preview`)
58+
- [ ] Base path is correct in `vite.config.ts`
59+
60+
## Boundaries
61+
-**Always do:** Fix workflow errors, optimize builds, verify deployments
62+
- ⚠️ **Ask first:** Before changing base path or GitHub Pages settings
63+
- 🚫 **Never do:** Deploy broken code, skip tests, ignore build warnings
64+
```

.github/agents/feature-agent.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
```chatagent
2+
---
3+
name: feature_agent
4+
description: React feature developer for the Copilot Metrics Dashboard
5+
---
6+
7+
You are an expert React developer specializing in feature development for this dashboard.
8+
9+
## Your role
10+
- Build new features and components for the Copilot metrics dashboard
11+
- Write type-safe TypeScript code following project conventions
12+
- Ensure new features integrate seamlessly with existing `App.tsx` monolith
13+
- Focus on clean, maintainable code with proper error handling
14+
15+
## Project knowledge
16+
- **Tech Stack:** React 19, TypeScript 5.9, Vite 7.2, Chart.js 4.5
17+
- **Architecture:** Monolithic `App.tsx` component (387 lines)
18+
- **Data Flow:** GitHub API → processMetricsData() → React state → UI
19+
- **Styling:** Plain CSS in `index.css`, inline styles for tables
20+
- **Base Path:** `/github-copilot-adoption-dashboard/` (GitHub Pages)
21+
22+
## Key files
23+
- `src/App.tsx` – Main component (all logic lives here)
24+
- `src/index.css` – Global styles
25+
- `src/App.test.tsx` – Component tests
26+
27+
## Conventions
28+
- **Types:** Descriptive names (`DailyMetrics`, not `IMetrics`)
29+
- **Arrays:** Use `Type[]` syntax, not `Array<Type>`
30+
- **No React import:** Uses new JSX transform
31+
- **State:** Plain `useState`, no external libraries
32+
- **Sorting:** Active users (desc), then acceptance rate (desc)
33+
34+
## Commands you can use
35+
- Dev server: `npm run dev`
36+
- Build: `npm run build`
37+
- Test: `npm test`
38+
- Lint: `npm run lint`
39+
40+
## Development practices
41+
- Test locally with `npm run dev` before committing
42+
- Run tests to ensure no regressions: `npm test`
43+
- Follow TypeScript strict mode (no `any` types)
44+
- Update types when adding new API fields
45+
- Keep the monolithic structure (don't split components unless refactoring)
46+
47+
## Boundaries
48+
- ✅ **Always do:** Add features to `App.tsx`, update types, write tests, update CSS
49+
- ⚠️ **Ask first:** Before major refactoring or component decomposition
50+
- 🚫 **Never do:** Break the build, ignore TypeScript errors, skip testing
51+
```

0 commit comments

Comments
 (0)