Spaces:
Sleeping
Sleeping
Ming Wang commited on
Commit Β·
6546fce
1
Parent(s): 31bb5b3
Phase 5: docs, README, review checklist, demo script, CI workflow
Browse files- .github/workflows/ci.yml +29 -0
- README.md +141 -15
- docs/demo-script.md +170 -0
- docs/review-checklist.md +72 -0
.github/workflows/ci.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
pull_request:
|
| 7 |
+
branches: [main]
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
build:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
|
| 13 |
+
steps:
|
| 14 |
+
- uses: actions/checkout@v4
|
| 15 |
+
|
| 16 |
+
- uses: actions/setup-node@v4
|
| 17 |
+
with:
|
| 18 |
+
node-version: 20
|
| 19 |
+
cache: npm
|
| 20 |
+
cache-dependency-path: frontend/package-lock.json
|
| 21 |
+
|
| 22 |
+
- name: Install frontend dependencies
|
| 23 |
+
run: cd frontend && npm ci
|
| 24 |
+
|
| 25 |
+
- name: Build
|
| 26 |
+
run: cd frontend && npx ng build
|
| 27 |
+
|
| 28 |
+
- name: Lint
|
| 29 |
+
run: cd frontend && npx ng lint
|
README.md
CHANGED
|
@@ -1,34 +1,160 @@
|
|
| 1 |
# PulseFabric Monitor
|
| 2 |
|
| 3 |
-
> GitHub Codespaces + Copilot Demo
|
| 4 |
|
| 5 |
-
|
| 6 |
-
Date: March 23, 2026
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
---
|
| 11 |
|
| 12 |
-
## Getting Started
|
|
|
|
|
|
|
| 13 |
|
| 14 |
1. Click the green **Code** button on the repository page.
|
| 15 |
2. Select the **Codespaces** tab.
|
| 16 |
3. Click **Create codespace on main**.
|
| 17 |
-
4. Wait for the
|
| 18 |
-
5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
| 1 |
# PulseFabric Monitor
|
| 2 |
|
| 3 |
+
> Enterprise infrastructure monitoring dashboard β GitHub Codespaces + Copilot Demo
|
| 4 |
|
| 5 |
+
**Authors:** Mingchieh Wang, Wei Tien Pang
|
| 6 |
+
**Date:** March 23, 2026
|
| 7 |
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## What Is This?
|
| 11 |
+
|
| 12 |
+
PulseFabric Monitor is a live demo showing how **GitHub Codespaces** and **GitHub Copilot** can replace complex local dev setups with zero-friction, AI-assisted development.
|
| 13 |
+
|
| 14 |
+
The dashboard displays real-time KPI cards, traffic/incident charts, and alert feeds β all backed by a fake REST API. During a demo, presenters use Copilot Chat prompts to add new widgets **live**, proving that AI can follow strict coding rules and produce production-quality code.
|
| 15 |
+
|
| 16 |
+
### Key Highlights
|
| 17 |
+
|
| 18 |
+
- **Zero local setup** β open a Codespace and everything runs
|
| 19 |
+
- **AI governance** β 20 production code rules that Copilot must follow
|
| 20 |
+
- **Live coding demos** β 3 ready-to-use prompts for adding widgets on stage
|
| 21 |
+
- **Fallback branch** β `demo-completed` has scenario 2 pre-built as backup
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Tech Stack
|
| 26 |
+
|
| 27 |
+
| Layer | Technology |
|
| 28 |
+
|-------|-----------|
|
| 29 |
+
| Frontend | Angular 21, Angular Material (Material 3), ngx-echarts |
|
| 30 |
+
| Backend | json-server (fake REST API from `backend/db.json`) |
|
| 31 |
+
| Dev Environment | GitHub Codespaces, Dev Containers (Node.js 20) |
|
| 32 |
+
| AI Governance | copilot-instructions.md, prompt files, agent profiles |
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Project Structure
|
| 37 |
+
|
| 38 |
+
```
|
| 39 |
+
backend/
|
| 40 |
+
db.json β Fake REST data (KPIs, traffic, incidents, alerts)
|
| 41 |
+
|
| 42 |
+
frontend/src/app/
|
| 43 |
+
core/
|
| 44 |
+
models/api.models.ts β All typed DTOs
|
| 45 |
+
services/dashboard-api.service.ts β API abstraction layer
|
| 46 |
+
dashboard/
|
| 47 |
+
dashboard.ts / .html / .scss β Main dashboard page
|
| 48 |
+
kpi-card/ β Generic KPI card (input-driven)
|
| 49 |
+
chart-widget/ β Generic chart widget (input-driven)
|
| 50 |
+
alert-list/ β Alert list component
|
| 51 |
+
chart-config.factory.ts β Pure functions generating ECharts options
|
| 52 |
+
|
| 53 |
+
.github/
|
| 54 |
+
copilot-instructions.md β 20 production code rules for Copilot
|
| 55 |
+
prompts/ β 3 demo prompt files
|
| 56 |
+
agents/ β Custom agent profile
|
| 57 |
+
skills/ β Optional widget scaffolding skill
|
| 58 |
+
|
| 59 |
+
docs/
|
| 60 |
+
demo-script.md β Step-by-step demo script (3 scenarios)
|
| 61 |
+
review-checklist.md β Code review checklist
|
| 62 |
+
ai-working-rules.md β AI working rules summary
|
| 63 |
+
```
|
| 64 |
|
| 65 |
---
|
| 66 |
|
| 67 |
+
## Getting Started
|
| 68 |
+
|
| 69 |
+
### Option A: GitHub Codespaces (Recommended)
|
| 70 |
|
| 71 |
1. Click the green **Code** button on the repository page.
|
| 72 |
2. Select the **Codespaces** tab.
|
| 73 |
3. Click **Create codespace on main**.
|
| 74 |
+
4. Wait for the container to build β Node.js 20, Angular CLI, and all VS Code extensions install automatically.
|
| 75 |
+
5. Run the dev servers:
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
npm run dev
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
6. The Angular app opens at **port 4200** and the API runs at **port 3000**.
|
| 82 |
+
|
| 83 |
+
### Option B: Local Development
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
# Clone the repository
|
| 87 |
+
git clone https://github.com/mwangui/Zero-friction.git
|
| 88 |
+
cd Zero-friction
|
| 89 |
|
| 90 |
+
# Install root dependencies (concurrently, json-server)
|
| 91 |
+
npm install
|
| 92 |
|
| 93 |
+
# Install frontend dependencies
|
| 94 |
+
cd frontend && npm install && cd ..
|
| 95 |
|
| 96 |
+
# Start both servers
|
| 97 |
+
npm run dev
|
| 98 |
+
```
|
| 99 |
|
| 100 |
+
| URL | Service |
|
| 101 |
+
|-----|---------|
|
| 102 |
+
| `http://localhost:4200` | Angular dashboard |
|
| 103 |
+
| `http://localhost:3000` | json-server API |
|
| 104 |
|
| 105 |
+
The Angular dev server proxies `/api/*` requests to json-server automatically.
|
| 106 |
|
| 107 |
+
### Available Scripts
|
| 108 |
+
|
| 109 |
+
| Command | Description |
|
| 110 |
+
|---------|-------------|
|
| 111 |
+
| `npm run dev` | Start both Angular + json-server concurrently |
|
| 112 |
+
| `npm run dev:web` | Start Angular dev server only |
|
| 113 |
+
| `npm run dev:api` | Start json-server only |
|
| 114 |
+
| `npm run build:web` | Production build |
|
| 115 |
+
| `npm run validate` | Build + lint |
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## How to Demo
|
| 120 |
+
|
| 121 |
+
See [docs/demo-script.md](docs/demo-script.md) for the full script. Quick summary:
|
| 122 |
+
|
| 123 |
+
### Demo 1: Add a KPI Card
|
| 124 |
+
|
| 125 |
+
Open Copilot Chat and paste:
|
| 126 |
+
|
| 127 |
+
> Add a new KPI card called Active Sessions showing the number 14,200 with a trending up indicator. Put it next to the existing KPI cards. Follow all repo rules in copilot-instructions.md.
|
| 128 |
+
|
| 129 |
+
### Demo 2: Add a Chart to AI Drop Zone
|
| 130 |
+
|
| 131 |
+
> Add a CPU Load by Device bar chart to the AI Widget Drop Zone at the bottom of the dashboard. Show 5 devices with fake CPU percentage data. Add the data to db.json first, then create the chart. Follow all repo rules in copilot-instructions.md.
|
| 132 |
+
|
| 133 |
+
### Demo 3: Add a Brand New Widget
|
| 134 |
+
|
| 135 |
+
> Add a new AI Security Recommendations widget to the dashboard. It should show 3 recommendations, each with a priority level (High, Medium, Low) and a short description. Add the data to db.json first, then build the component. Follow all repo rules in copilot-instructions.md.
|
| 136 |
+
|
| 137 |
+
**Fallback:** If any demo fails live, switch to the `demo-completed` branch which has scenario 2 pre-built.
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
## AI Governance
|
| 142 |
+
|
| 143 |
+
This repo enforces 20 production code rules via `.github/copilot-instructions.md`. Key rules:
|
| 144 |
+
|
| 145 |
+
- **Implementation order:** db.json β typed model β service β UI (never skip steps)
|
| 146 |
+
- **No `any` type** β all data must be typed with interfaces
|
| 147 |
+
- **No hardcoded data** β everything flows from the API
|
| 148 |
+
- **CSS tokens only** β use `--mat-sys-*` and `--pf-*` variables
|
| 149 |
+
- **Reuse before creating** β extend existing components via inputs
|
| 150 |
+
|
| 151 |
+
See [docs/ai-working-rules.md](docs/ai-working-rules.md) for the full list.
|
| 152 |
+
|
| 153 |
+
---
|
| 154 |
|
| 155 |
+
## Branches
|
| 156 |
|
| 157 |
+
| Branch | Purpose |
|
| 158 |
+
|--------|---------|
|
| 159 |
+
| `main` | Clean baseline β ready for live demo |
|
| 160 |
+
| `demo-completed` | Scenario 2 (CPU Load chart) pre-built as fallback |
|
docs/demo-script.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Demo Script β PulseFabric Monitor
|
| 2 |
+
|
| 3 |
+
This script contains 3 live demo scenarios. Each scenario is designed to be executed in Copilot Chat during a presentation.
|
| 4 |
+
|
| 5 |
+
**Prerequisites:**
|
| 6 |
+
- Codespace is running (or local dev with `npm run dev`)
|
| 7 |
+
- Both servers are up: Angular on port 4200, json-server on port 3000
|
| 8 |
+
- Dashboard is visible in the browser at `http://localhost:4200`
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## Scenario 1: Add a KPI Card β "Active Sessions"
|
| 13 |
+
|
| 14 |
+
### Story
|
| 15 |
+
|
| 16 |
+
> "Our operations team wants to see how many users are currently connected. Let's add an Active Sessions KPI card to the dashboard β live, using only a Copilot Chat prompt."
|
| 17 |
+
|
| 18 |
+
### Copilot Chat Prompt
|
| 19 |
+
|
| 20 |
+
Copy and paste this into Copilot Chat:
|
| 21 |
+
|
| 22 |
+
> Add a new KPI card called Active Sessions showing the number 14,200 with a trending up indicator. Put it next to the existing KPI cards. Follow all repo rules in copilot-instructions.md.
|
| 23 |
+
|
| 24 |
+
### Expected AI Actions
|
| 25 |
+
|
| 26 |
+
1. **db.json** β Add a new entry to the `kpis` array:
|
| 27 |
+
```json
|
| 28 |
+
{
|
| 29 |
+
"id": "active-sessions",
|
| 30 |
+
"title": "Active Sessions",
|
| 31 |
+
"value": "14,200",
|
| 32 |
+
"trend": "up",
|
| 33 |
+
"trendLabel": "+8.3% from last hour",
|
| 34 |
+
"icon": "group"
|
| 35 |
+
}
|
| 36 |
+
```
|
| 37 |
+
2. **api.models.ts** β No change needed (KpiDto already covers the shape)
|
| 38 |
+
3. **dashboard-api.service.ts** β No change needed (getKpis already returns the array)
|
| 39 |
+
4. **UI** β No change needed (the `@for` loop renders it automatically)
|
| 40 |
+
|
| 41 |
+
### Expected Result
|
| 42 |
+
|
| 43 |
+
- A fifth KPI card appears in the grid: "Active Sessions β 14,200 β trending up"
|
| 44 |
+
- The card uses the same `<app-kpi-card>` component as existing cards
|
| 45 |
+
- `ng build` still passes
|
| 46 |
+
|
| 47 |
+
### What to Point Out
|
| 48 |
+
|
| 49 |
+
- Only `db.json` was changed β the AI understood the data-first pattern
|
| 50 |
+
- No new component was created β the existing KPI card is input-driven
|
| 51 |
+
- The AI followed the implementation order: db.json β model β service β UI
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## Scenario 2: Add a CPU Load Chart to AI Drop Zone
|
| 56 |
+
|
| 57 |
+
### Story
|
| 58 |
+
|
| 59 |
+
> "We have a drop zone at the bottom of the dashboard reserved for AI-generated widgets. Let's ask Copilot to fill it with a CPU Load by Device bar chart."
|
| 60 |
+
|
| 61 |
+
### Copilot Chat Prompt
|
| 62 |
+
|
| 63 |
+
Copy and paste this into Copilot Chat:
|
| 64 |
+
|
| 65 |
+
> Add a CPU Load by Device bar chart to the AI Widget Drop Zone at the bottom of the dashboard. Show 5 devices with fake CPU percentage data. Add the data to db.json first, then create the chart. Follow all repo rules in copilot-instructions.md.
|
| 66 |
+
|
| 67 |
+
### Expected AI Actions
|
| 68 |
+
|
| 69 |
+
1. **db.json** β Add a new `cpuLoad` collection (replacing the empty array):
|
| 70 |
+
```json
|
| 71 |
+
"cpuLoad": [
|
| 72 |
+
{ "device": "Server-A1", "load": 72 },
|
| 73 |
+
{ "device": "Server-B2", "load": 85 },
|
| 74 |
+
{ "device": "Router-C3", "load": 45 },
|
| 75 |
+
{ "device": "Switch-D4", "load": 91 },
|
| 76 |
+
{ "device": "Gateway-E5", "load": 63 }
|
| 77 |
+
]
|
| 78 |
+
```
|
| 79 |
+
2. **api.models.ts** β Add `CpuLoadDto` interface:
|
| 80 |
+
```typescript
|
| 81 |
+
export interface CpuLoadDto {
|
| 82 |
+
device: string;
|
| 83 |
+
load: number;
|
| 84 |
+
}
|
| 85 |
+
```
|
| 86 |
+
3. **dashboard-api.service.ts** β Add `getCpuLoad()` method
|
| 87 |
+
4. **chart-config.factory.ts** β Add `buildCpuLoadOption()` factory function using PALETTE colors
|
| 88 |
+
5. **dashboard.ts** β Add signal + service call in forkJoin
|
| 89 |
+
6. **dashboard.html** β Add `<app-chart-widget>` inside or near `#ai-dropzone`
|
| 90 |
+
|
| 91 |
+
### Expected Result
|
| 92 |
+
|
| 93 |
+
- A bar chart titled "CPU Load by Device" appears in the AI Widget Drop Zone area
|
| 94 |
+
- 5 bars showing percentage values for each device
|
| 95 |
+
- Colors come from the PALETTE constant (no raw hex in factory function)
|
| 96 |
+
- `ng build` still passes
|
| 97 |
+
|
| 98 |
+
### What to Point Out
|
| 99 |
+
|
| 100 |
+
- The AI followed all 6 steps of the implementation order
|
| 101 |
+
- No new component was created β the existing `ChartWidget` was reused
|
| 102 |
+
- Chart colors use the PALETTE constant, not hardcoded hex values
|
| 103 |
+
- The factory function is pure (no side effects)
|
| 104 |
+
|
| 105 |
+
### Fallback
|
| 106 |
+
|
| 107 |
+
If this scenario fails live, switch to the `demo-completed` branch:
|
| 108 |
+
```bash
|
| 109 |
+
git stash && git checkout demo-completed
|
| 110 |
+
```
|
| 111 |
+
Then restart the dev servers with `npm run dev`.
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Scenario 3: Add an AI Security Recommendations Widget
|
| 116 |
+
|
| 117 |
+
### Story
|
| 118 |
+
|
| 119 |
+
> "The security team wants an AI-powered recommendations panel. This requires a brand new component since it doesn't fit the KPI card or chart widget pattern. Let's see if Copilot can build it from scratch while following all 20 rules."
|
| 120 |
+
|
| 121 |
+
### Copilot Chat Prompt
|
| 122 |
+
|
| 123 |
+
Copy and paste this into Copilot Chat:
|
| 124 |
+
|
| 125 |
+
> Add a new AI Security Recommendations widget to the dashboard. It should show 3 recommendations, each with a priority level (High, Medium, Low) and a short description. Add the data to db.json first, then build the component. Follow all repo rules in copilot-instructions.md.
|
| 126 |
+
|
| 127 |
+
### Expected AI Actions
|
| 128 |
+
|
| 129 |
+
1. **db.json** β Add a `securityRecommendations` collection:
|
| 130 |
+
```json
|
| 131 |
+
"securityRecommendations": [
|
| 132 |
+
{ "id": 1, "priority": "high", "description": "Rotate API keys for production cluster β last rotated 90+ days ago" },
|
| 133 |
+
{ "id": 2, "priority": "medium", "description": "Enable MFA for 3 service accounts in US-East region" },
|
| 134 |
+
{ "id": 3, "priority": "low", "description": "Update TLS certificates to use SHA-256 on staging endpoints" }
|
| 135 |
+
]
|
| 136 |
+
```
|
| 137 |
+
2. **api.models.ts** β Add `SecurityRecommendationDto` interface
|
| 138 |
+
3. **dashboard-api.service.ts** β Add `getSecurityRecommendations()` method
|
| 139 |
+
4. **New component** β Create `security-recommendations/` under `dashboard/`:
|
| 140 |
+
- `security-recommendations.ts` β standalone, input-driven
|
| 141 |
+
- `security-recommendations.html` β flat HTML with Material components
|
| 142 |
+
- `security-recommendations.scss` β uses `--mat-sys-*` and `--pf-*` tokens
|
| 143 |
+
5. **dashboard.ts** β Import component, fetch data, store in signal
|
| 144 |
+
6. **dashboard.html** β Add `<app-security-recommendations>` tag
|
| 145 |
+
|
| 146 |
+
### Expected Result
|
| 147 |
+
|
| 148 |
+
- A new card-style widget appears showing 3 security recommendations
|
| 149 |
+
- Each item shows a priority badge (High/Medium/Low) with appropriate color
|
| 150 |
+
- The component uses Material 3 tokens for all styling
|
| 151 |
+
- `ng build` still passes
|
| 152 |
+
|
| 153 |
+
### What to Point Out
|
| 154 |
+
|
| 155 |
+
- The AI created a **new component** because the data doesn't fit existing patterns
|
| 156 |
+
- It still followed the strict order: db.json β model β service β UI
|
| 157 |
+
- TS, HTML, SCSS are in separate files (Rule 1)
|
| 158 |
+
- The component is standalone and input-driven (Rules 4, 11)
|
| 159 |
+
- No `any` type anywhere (Rule 3/19)
|
| 160 |
+
|
| 161 |
+
---
|
| 162 |
+
|
| 163 |
+
## Tips for Presenters
|
| 164 |
+
|
| 165 |
+
1. **Keep the terminal visible** β the audience should see file changes in real time
|
| 166 |
+
2. **Show the Source Control diff** β highlight which files Copilot changed
|
| 167 |
+
3. **Run `ng build`** after each scenario to prove the code compiles
|
| 168 |
+
4. **Refresh the browser** after scenario 1 (db.json change may need a server restart)
|
| 169 |
+
5. **Have the `demo-completed` branch ready** as a fallback for scenario 2
|
| 170 |
+
6. **Point out the rules** β open `copilot-instructions.md` to show what the AI is following
|
docs/review-checklist.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Code Review Checklist β PulseFabric Monitor
|
| 2 |
+
|
| 3 |
+
Use this checklist after any AI-generated or human code change. Every item must pass before merging.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## Implementation Order
|
| 8 |
+
|
| 9 |
+
- [ ] Data added to `backend/db.json` **before** any frontend code
|
| 10 |
+
- [ ] DTO interface added/updated in `core/models/api.models.ts`
|
| 11 |
+
- [ ] Service method added in `core/services/dashboard-api.service.ts`
|
| 12 |
+
- [ ] UI component consumes data through the service (never directly)
|
| 13 |
+
|
| 14 |
+
## TypeScript
|
| 15 |
+
|
| 16 |
+
- [ ] No `any` type β parameters, return types, variables, generics, assertions
|
| 17 |
+
- [ ] All data structures have typed interfaces
|
| 18 |
+
- [ ] No `console.log`, `console.warn`, or `console.error`
|
| 19 |
+
- [ ] No commented-out code blocks
|
| 20 |
+
- [ ] Every import is used β no orphan imports
|
| 21 |
+
- [ ] One component/service/model group per file
|
| 22 |
+
- [ ] Signals used for reactive state (`signal()`, `input()`, `computed()`)
|
| 23 |
+
- [ ] `inject()` used instead of constructor injection
|
| 24 |
+
|
| 25 |
+
## HTML Templates
|
| 26 |
+
|
| 27 |
+
- [ ] Flat structure β no unnecessary `<div>` wrappers
|
| 28 |
+
- [ ] No hardcoded data in templates
|
| 29 |
+
- [ ] No logic beyond simple bindings and control flow (`@if`, `@for`)
|
| 30 |
+
- [ ] Material components used where appropriate (`mat-card`, `mat-icon`, etc.)
|
| 31 |
+
|
| 32 |
+
## SCSS Styles
|
| 33 |
+
|
| 34 |
+
- [ ] All colors use tokens: `--mat-sys-*`, `--pf-*`, or SCSS variables
|
| 35 |
+
- [ ] No raw hex values (e.g., `#ff0000`)
|
| 36 |
+
- [ ] No raw px/rem values β use spacing tokens (`--pf-spacing-*`)
|
| 37 |
+
- [ ] Nesting depth β€ 3 levels
|
| 38 |
+
- [ ] `:host { display: block; }` present on components
|
| 39 |
+
|
| 40 |
+
## File Organization
|
| 41 |
+
|
| 42 |
+
- [ ] TS, HTML, SCSS in separate files (no inline templates/styles)
|
| 43 |
+
- [ ] Files use `kebab-case` naming
|
| 44 |
+
- [ ] Classes use `PascalCase`, variables use `camelCase`
|
| 45 |
+
- [ ] Standalone component (no NgModule)
|
| 46 |
+
|
| 47 |
+
## Component Design
|
| 48 |
+
|
| 49 |
+
- [ ] Input-driven β data passed via `input()` signals
|
| 50 |
+
- [ ] No data fetching inside the component
|
| 51 |
+
- [ ] Reuses existing components where possible (KpiCard, ChartWidget, AlertList)
|
| 52 |
+
- [ ] Adding a new instance requires only different inputs, not a new file
|
| 53 |
+
|
| 54 |
+
## Material 3 Compliance
|
| 55 |
+
|
| 56 |
+
- [ ] Uses Material 3 components from `@angular/material`
|
| 57 |
+
- [ ] Follows M3 spacing and typography guidelines
|
| 58 |
+
- [ ] Uses system variables for theming (`--mat-sys-*`)
|
| 59 |
+
- [ ] Card components use `appearance="outlined"`
|
| 60 |
+
|
| 61 |
+
## Validation
|
| 62 |
+
|
| 63 |
+
- [ ] `ng build` passes with zero errors
|
| 64 |
+
- [ ] No new budget warnings (echarts warning is pre-existing and acceptable)
|
| 65 |
+
- [ ] App loads correctly in browser at `http://localhost:4200`
|
| 66 |
+
- [ ] New feature is visible and functional
|
| 67 |
+
|
| 68 |
+
## Constants & Configuration
|
| 69 |
+
|
| 70 |
+
- [ ] No magic numbers β all values in named constants or enums
|
| 71 |
+
- [ ] Chart colors use `PALETTE` from `chart-config.factory.ts`
|
| 72 |
+
- [ ] API base URL comes from `environment.ts` (not hardcoded)
|