From 1b774be863baf703506365e5a1f43dc2e64061d6 Mon Sep 17 00:00:00 2001 From: Yassire Date: Fri, 3 Jul 2026 21:25:03 -0400 Subject: [PATCH] chore: repo health files, CI test wiring, and Playwright e2e smoke test - Add SECURITY.md and CODE_OF_CONDUCT.md (community health was at 50%) - Add bug/feature issue templates and a PR template - Wire the existing pytest suite under .claude/skills/*/scripts/tests into a new CI workflow; the test docstrings claimed "the existing pytest CI runs them" but no workflow actually did - Add @playwright/test to cli/ with a smoke test that loads the shipped preview/xiaomaomi-app.html and asserts no console errors - Fix a malformed SVG path (invalid `d` attribute) in preview/xiaomaomi-app.html found by that new test, replacing it with the equivalent valid paw icon path already used elsewhere in the file --- .github/ISSUE_TEMPLATE/bug_report.yml | 48 ++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 29 ++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 15 +++++ .github/workflows/tests.yml | 51 +++++++++++++++++ .gitignore | 3 + CODE_OF_CONDUCT.md | 38 +++++++++++++ SECURITY.md | 35 ++++++++++++ cli/package-lock.json | 64 ++++++++++++++++++++++ cli/package.json | 3 +- cli/playwright.config.ts | 18 ++++++ cli/tests/e2e/preview.spec.ts | 31 +++++++++++ preview/xiaomaomi-app.html | 4 +- 12 files changed, 336 insertions(+), 3 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/tests.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 SECURITY.md create mode 100644 cli/playwright.config.ts create mode 100644 cli/tests/e2e/preview.spec.ts diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..dbc5381 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,48 @@ +name: Bug Report +description: Report something broken in the skill, CLI, or generated design system +labels: [bug] +body: + - type: input + id: assistant + attributes: + label: AI assistant / platform + description: Claude Code, Cursor, Windsurf, etc. + validations: + required: true + - type: input + id: version + attributes: + label: ui-ux-pro-max-cli version + description: Output of `npm list -g ui-ux-pro-max-cli` or `uipro --version` + validations: + required: true + - type: input + id: os + attributes: + label: OS + placeholder: macOS 15 / Windows 11 / Ubuntu 24.04 + validations: + required: true + - type: textarea + id: command + attributes: + label: Exact command or prompt that triggered the bug + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behavior + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual behavior + validations: + required: true + - type: textarea + id: logs + attributes: + label: Error messages / screenshots + render: shell diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..3cc6cd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,29 @@ +name: Feature Request +description: Suggest a new UI style, color palette, industry rule, stack, or CLI feature +labels: [enhancement] +body: + - type: dropdown + id: category + attributes: + label: Category + options: + - New UI style + - New color palette + - New industry reasoning rule + - New tech stack support + - CLI improvement + - Other + validations: + required: true + - type: textarea + id: description + attributes: + label: What do you want to see added or changed? + validations: + required: true + - type: textarea + id: motivation + attributes: + label: Why is this useful? (use case, example project) + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1f33fc8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## What does this PR change? + + + +## Why? + + + +## Checklist + +- [ ] Changes were made in `src/ui-ux-pro-max/` (source of truth), not directly in `.claude/` or `.factory/` +- [ ] Ran `npm run sync:assets && npm run check:assets` in `cli/` if data/scripts/templates changed +- [ ] Added or updated tests if behavior changed (`.claude/skills/*/scripts/tests/`, `cli/tests/e2e/`) +- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `docs:`, etc.) +- [ ] This PR targets a feature branch, not pushed directly to `main` diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a6bdd0f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Tests + +on: + pull_request: + paths: + - '.claude/skills/**' + - 'cli/assets/skills/**' + - '.github/workflows/tests.yml' + push: + branches: [main] + workflow_dispatch: + +jobs: + pytest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.x' + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pytest + run: pip install pytest + + - name: Run skill regression tests + run: python3 -m pytest .claude/skills -v + + - name: Install Playwright deps + working-directory: cli + run: | + npm ci + npx playwright install --with-deps chromium + + - name: Run preview e2e smoke tests + working-directory: cli + run: npx playwright test + + - name: Upload Playwright report + if: always() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: cli/playwright-report/ + retention-days: 7 diff --git a/.gitignore b/.gitignore index 127b4b4..f6098a0 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ out/ .claude/settings.local.json .claude/session-state/ ui-ux-pro-max-website/* + +cli/playwright-report/ +cli/test-results/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8190df1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,38 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to a positive environment: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing for mistakes + +Examples of unacceptable behavior: + +- The use of sexualized language or imagery, and sexual attention of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information without explicit permission +- Other conduct which could reasonably be considered inappropriate + +## Enforcement Responsibilities + +Maintainers are responsible for clarifying and enforcing standards of acceptable behavior and will take appropriate, fair corrective action in response to any behavior deemed inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all community spaces (issues, pull requests, discussions) and also applies when an individual is officially representing the project in public spaces. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the maintainers by opening a [GitHub Discussion](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill/discussions) marked private/moderation, or via the contact listed on [uupm.cc](https://www.uupm.cc). All complaints will be reviewed and investigated promptly and fairly. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..f7ca4b0 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,35 @@ +# Security Policy + +## Supported Versions + +Only the latest released version of `ui-ux-pro-max-cli` and the latest `main` branch of this skill receive security fixes. + +| Version | Supported | +|---------|-----------| +| Latest release | ✅ | +| Older releases | ❌ | + +## Reporting a Vulnerability + +Please **do not** open a public GitHub issue for security vulnerabilities. + +Instead, report it privately using [GitHub's private vulnerability reporting](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill/security/advisories/new) (Security tab → "Report a vulnerability"). + +Include as much of the following as possible: + +- A description of the vulnerability and its potential impact +- Steps to reproduce (command, prompt, or CLI flags used) +- The version of `ui-ux-pro-max-cli` and the AI assistant/platform involved +- Any relevant logs or output + +We aim to acknowledge reports within 5 business days and to provide a fix or mitigation timeline within 14 days for confirmed issues. + +## Scope + +This project is a design-system generation skill: a Python search/CLI tool and static data (CSV/JSON) consumed by AI coding assistants. In-scope concerns include: + +- Arbitrary code execution via the CLI installer or search scripts +- Path traversal or unsafe file writes when running `uipro init` / `uipro uninstall` +- Supply-chain issues in the `ui-ux-pro-max-cli` npm package or its release pipeline + +Out of scope: the design output itself (colors, fonts, UI recommendations) is not a security surface. diff --git a/cli/package-lock.json b/cli/package-lock.json index fecd93c..10a4591 100644 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -18,12 +18,29 @@ "uipro": "dist/index.js" }, "devDependencies": { + "@playwright/test": "^1.61.1", "@types/bun": "^1.1.14", "@types/node": "^22.10.1", "@types/prompts": "^2.4.9", "typescript": "^5.7.2" } }, + "node_modules/@playwright/test": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.1.tgz", + "integrity": "sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.61.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@types/bun": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.5.tgz", @@ -131,6 +148,21 @@ "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", "license": "MIT" }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/get-east-asian-width": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", @@ -254,6 +286,38 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/playwright": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.1.tgz", + "integrity": "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.61.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.61.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.1.tgz", + "integrity": "sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", diff --git a/cli/package.json b/cli/package.json index e002893..00b04e8 100755 --- a/cli/package.json +++ b/cli/package.json @@ -37,12 +37,13 @@ "author": "", "license": "MIT", "dependencies": { - "commander": "^12.1.0", "chalk": "^5.3.0", + "commander": "^12.1.0", "ora": "^8.1.1", "prompts": "^2.4.2" }, "devDependencies": { + "@playwright/test": "^1.61.1", "@types/bun": "^1.1.14", "@types/node": "^22.10.1", "@types/prompts": "^2.4.9", diff --git a/cli/playwright.config.ts b/cli/playwright.config.ts new file mode 100644 index 0000000..b3687db --- /dev/null +++ b/cli/playwright.config.ts @@ -0,0 +1,18 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + testDir: './tests/e2e', + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + reporter: 'html', + use: { + trace: 'on-first-retry', + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + ], +}); diff --git a/cli/tests/e2e/preview.spec.ts b/cli/tests/e2e/preview.spec.ts new file mode 100644 index 0000000..c3cbc6a --- /dev/null +++ b/cli/tests/e2e/preview.spec.ts @@ -0,0 +1,31 @@ +import { test, expect } from '@playwright/test'; +import path from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +/** + * Smoke test for the generated design-system preview pages under /preview. + * These files are shipped as proof that the design system generator produces + * working, self-contained HTML (see README "How Design System Generation Works"). + * This guards against a preview shipping with broken markup or JS errors. + */ + +const PREVIEW_DIR = path.resolve(__dirname, '../../../preview'); +const PREVIEW_FILE = 'xiaomaomi-app.html'; + +test.describe('generated preview pages', () => { + test(`${PREVIEW_FILE} renders without console errors`, async ({ page }) => { + const consoleErrors: string[] = []; + page.on('console', (msg) => { + if (msg.type() === 'error') consoleErrors.push(msg.text()); + }); + page.on('pageerror', (err) => consoleErrors.push(err.message)); + + const fileUrl = pathToFileURL(path.join(PREVIEW_DIR, PREVIEW_FILE)).href; + await page.goto(fileUrl); + + await expect(page.locator('body')).toBeVisible(); + expect(consoleErrors, `console errors: ${consoleErrors.join('\n')}`).toHaveLength(0); + }); +}); diff --git a/preview/xiaomaomi-app.html b/preview/xiaomaomi-app.html index bbb516c..075a9a1 100644 --- a/preview/xiaomaomi-app.html +++ b/preview/xiaomaomi-app.html @@ -299,7 +299,7 @@
@@ -317,7 +317,7 @@

喵小橘

橘猫 · 1岁2个月