From b7485fd3cf6ee0f721e9a88ba72ebb3747def35d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:39:18 +0000 Subject: [PATCH 1/6] Initial plan From ad3bf134a13ac5c0bb5cdc6828d13f0204d04c8d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:50:04 +0000 Subject: [PATCH 2/6] Create comprehensive Copilot instructions for GitHub Chinese client app Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com> --- .github/copilot-instructions.md | 186 ++++++++++++++++++++++++++++++++ lib/jquery.min.js | 0 2 files changed, 186 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 lib/jquery.min.js diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..ba924ae --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,186 @@ +# GitHub 中文版 (Chinese GitHub Client) + +Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. + +This is a Chinese-language GitHub client web application built as a Single Page Application (SPA) using HTML5, CSS3, jQuery, Bootstrap v3, and the EasyWebApp framework. The application provides a localized interface for browsing GitHub repositories, users, organizations, and gists. + +## Working Effectively + +### Quick Start +- **NEVER build or compile anything** - this is a static web application that runs directly in the browser +- Start HTTP server: `python3 -m http.server 8080` (starts in ~1-2 seconds, NEVER CANCEL) +- Alternative: `npx http-server -p 8080` (requires npm, starts in ~5-10 seconds, NEVER CANCEL) +- Access application: `http://localhost:8080` +- **CRITICAL**: External CDN dependencies may be blocked in some environments - document this limitation + +### Dependencies and Limitations +- **External CDNs Required**: The application depends on external CDNs (cdn.bootcss.com) for: + - jQuery 3.3.1 + - Bootstrap 3.3.7 + - RequireJS 2.3.5 + - Marked (markdown parser) + - Layer.js (UI dialogs) + - HTML5 History API polyfill + - MutationObserver polyfill +- **GitHub API Token**: Hardcoded token in `script/index.js` may be expired (returns 403 Forbidden) +- **Network Access**: CDN blocking will prevent full functionality in restricted environments + +### Validation Requirements +- **ALWAYS** test HTTP server startup with both Python and Node.js options +- **ALWAYS** verify static file serving for HTML, CSS, JS, JSON files +- Test navigation structure by accessing key routes: + - Main page: `/` + - Configuration: `/page/index.json` + - Components: `/component/NavBar.html` +- **IMPORTANT**: Due to CDN dependencies, full functionality testing requires network access +- Document any CDN accessibility issues encountered + +## Project Structure + +### Key Directories and Files +``` +/home/runner/work/GitHub/GitHub/ +├── index.html # Main application entry point +├── ReadMe.md # Project documentation (Chinese) +├── .editorconfig # Code formatting rules +├── .gitignore # Git ignore rules +├── script/ # JavaScript modules +│ ├── index.js # Main application logic & GitHub API integration +│ ├── EasyWebApp.js # Web component framework +│ ├── jQueryKit.js # jQuery utilities +│ ├── FixData.js # GitHub API data transformation +│ └── TimeKit.js # Time formatting utilities +├── component/ # Reusable UI components +│ ├── NavBar.html # Main navigation bar +│ ├── PageList.html # Paginated list component +│ ├── Tab.html # Tab navigation component +│ └── loading.html # Loading indicator +├── page/ # SPA page templates +│ ├── index.json # Navigation configuration +│ ├── Event.html # GitHub events feed +│ ├── Repository/ # Repository-related pages +│ ├── User/ # User and organization pages +│ └── Gist/ # Gist pages +├── style/ # CSS stylesheets +│ ├── BootEWA.css # Bootstrap + EasyWebApp styles +│ └── index.css # Application-specific styles +└── image/ # Static assets +``` + +### Architecture Overview +- **Module System**: AMD modules loaded with RequireJS +- **Framework**: EasyWebApp v4 for component-based development +- **UI Library**: Bootstrap v3 for responsive design +- **API Integration**: Direct GitHub REST API calls with OAuth token +- **Routing**: Client-side routing using EasyWebApp +- **Localization**: Chinese language interface throughout + +## Validation Scenarios + +After making changes, ALWAYS run through these validation steps: + +### HTTP Server Testing +```bash +# Test Python HTTP server (recommended) +cd /home/runner/work/GitHub/GitHub +python3 -m http.server 8080 & +sleep 2 +curl -I http://localhost:8080/ +# Should return HTTP/1.0 200 OK + +# Test Node.js alternative +pkill -f "python3.*http.server" +npx http-server -p 8080 & +sleep 5 +curl -I http://localhost:8080/ +# Should return HTTP/1.1 200 OK +``` + +### File Serving Validation +```bash +# Test key file types are served correctly +curl -s http://localhost:8080/page/index.json | jq .title +# Should return "GitHub 中文版" + +curl -I http://localhost:8080/component/NavBar.html +# Should return 200 OK with text/html content-type + +curl -I http://localhost:8080/script/index.js +# Should return 200 OK with application/javascript content-type +``` + +### Application Structure Verification +```bash +# Verify all required directories exist +ls -la /home/runner/work/GitHub/GitHub/{script,component,page,style,image} + +# Count HTML templates (should be ~19 files) +find /home/runner/work/GitHub/GitHub -name "*.html" | wc -l + +# Verify JavaScript modules exist +ls /home/runner/work/GitHub/GitHub/script/*.js +``` + +## Common Tasks + +### Server Operations +- Start Python server: `python3 -m http.server 8080` (fastest startup) +- Start Node.js server: `npx http-server -p 8080` (more features) +- Stop servers: `pkill -f "python3.*http.server"` or `pkill -f "npx.*http-server"` +- Check server status: `curl -I http://localhost:8080/` + +### Code Navigation +- **Main logic**: `script/index.js` - GitHub API integration, routing, error handling +- **Framework**: `script/EasyWebApp.js` - Component system implementation +- **Navigation**: `page/index.json` - Menu structure and routing configuration +- **Components**: `component/*.html` - Reusable UI components +- **Pages**: `page/*/` - Individual SPA page templates +- **Styling**: `style/BootEWA.css` and `style/index.css` + +### Troubleshooting +- **CDN Loading Issues**: External dependencies from cdn.bootcss.com may be blocked +- **GitHub API Access**: Token in script/index.js may be expired (check for 403 responses) +- **CORS Errors**: Use proper HTTP server, not file:// protocol +- **Module Loading**: RequireJS errors indicate missing or blocked CDN dependencies + +## Important Notes + +### Security Considerations +- **Exposed API Token**: GitHub personal access token is hardcoded in `script/index.js` +- **CORS Configuration**: Application expects to run from HTTP server, not file system +- **CDN Dependencies**: External resource loading creates security and availability dependencies + +### Development Workflow +1. **ALWAYS** start HTTP server before testing changes +2. **NEVER** try to build or compile - this is a static application +3. **VERIFY** that static files serve correctly after modifications +4. **TEST** navigation and component loading when changing templates +5. **DOCUMENT** any CDN access issues encountered in your environment + +### Performance Expectations +- Server startup: 1-10 seconds depending on method used +- File serving: Near-instantaneous for static assets +- Component loading: Dependent on CDN accessibility and network speed +- **NEVER CANCEL** server operations during startup phase + +## Frequent Commands Reference + +### Repository root listing +``` +.editorconfig +.git/ +.gitignore +ReadMe.md +component/ +image/ +index.html +page/ +script/ +style/ +``` + +### Required HTTP server test +```bash +cd /home/runner/work/GitHub/GitHub && python3 -m http.server 8080 +``` +Expected output: `Serving HTTP on :: port 8080 (http://[::]:8080/) ...` \ No newline at end of file diff --git a/lib/jquery.min.js b/lib/jquery.min.js new file mode 100644 index 0000000..e69de29 From 219151c844600220395085ced617ba7aee6888ce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 15:50:36 +0000 Subject: [PATCH 3/6] Clean up accidentally committed lib directory and update gitignore Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com> --- .gitignore | 1 + lib/jquery.min.js | 0 2 files changed, 1 insertion(+) delete mode 100644 lib/jquery.min.js diff --git a/.gitignore b/.gitignore index 2f2e6c9..16311c7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ node_modules/* bower_components/* .vscode/* +lib/ diff --git a/lib/jquery.min.js b/lib/jquery.min.js deleted file mode 100644 index e69de29..0000000 From 1bb7bc44307e8b1fb36973052b068675d86c52b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:36:56 +0000 Subject: [PATCH 4/6] Update Copilot instructions based on review feedback: prioritize Node.js and note future refactoring plans Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com> --- .github/copilot-instructions.md | 50 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ba924ae..0bbbd61 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -8,21 +8,21 @@ This is a Chinese-language GitHub client web application built as a Single Page ### Quick Start - **NEVER build or compile anything** - this is a static web application that runs directly in the browser -- Start HTTP server: `python3 -m http.server 8080` (starts in ~1-2 seconds, NEVER CANCEL) -- Alternative: `npx http-server -p 8080` (requires npm, starts in ~5-10 seconds, NEVER CANCEL) +- Start HTTP server: `npx http-server -p 8080` (requires npm, starts in ~5-10 seconds, NEVER CANCEL) +- Alternative: `python3 -m http.server 8080` (starts in ~1-2 seconds, NEVER CANCEL) - Access application: `http://localhost:8080` - **CRITICAL**: External CDN dependencies may be blocked in some environments - document this limitation ### Dependencies and Limitations -- **External CDNs Required**: The application depends on external CDNs (cdn.bootcss.com) for: +- **External CDNs Required**: The application currently depends on external CDNs (cdn.bootcss.com, will migrate to unpkg.com) for: - jQuery 3.3.1 - Bootstrap 3.3.7 - - RequireJS 2.3.5 + - RequireJS 2.3.5 (will migrate to ECMAScript modules) - Marked (markdown parser) - Layer.js (UI dialogs) - HTML5 History API polyfill - MutationObserver polyfill -- **GitHub API Token**: Hardcoded token in `script/index.js` may be expired (returns 403 Forbidden) +- **GitHub API Token**: Hardcoded token in `script/index.js` may be expired (will migrate to OAuth token system) - **Network Access**: CDN blocking will prevent full functionality in restricted environments ### Validation Requirements @@ -68,10 +68,10 @@ This is a Chinese-language GitHub client web application built as a Single Page ``` ### Architecture Overview -- **Module System**: AMD modules loaded with RequireJS +- **Module System**: AMD modules loaded with RequireJS (will migrate to ECMAScript modules) - **Framework**: EasyWebApp v4 for component-based development - **UI Library**: Bootstrap v3 for responsive design -- **API Integration**: Direct GitHub REST API calls with OAuth token +- **API Integration**: Direct GitHub REST API calls with OAuth token (will migrate to OAuth system) - **Routing**: Client-side routing using EasyWebApp - **Localization**: Chinese language interface throughout @@ -81,19 +81,19 @@ After making changes, ALWAYS run through these validation steps: ### HTTP Server Testing ```bash -# Test Python HTTP server (recommended) +# Test Node.js HTTP server (recommended for JavaScript project) cd /home/runner/work/GitHub/GitHub -python3 -m http.server 8080 & -sleep 2 -curl -I http://localhost:8080/ -# Should return HTTP/1.0 200 OK - -# Test Node.js alternative -pkill -f "python3.*http.server" npx http-server -p 8080 & sleep 5 curl -I http://localhost:8080/ # Should return HTTP/1.1 200 OK + +# Test Python alternative (fallback) +pkill -f "npx.*http-server" +python3 -m http.server 8080 & +sleep 2 +curl -I http://localhost:8080/ +# Should return HTTP/1.0 200 OK ``` ### File Serving Validation @@ -124,9 +124,9 @@ ls /home/runner/work/GitHub/GitHub/script/*.js ## Common Tasks ### Server Operations -- Start Python server: `python3 -m http.server 8080` (fastest startup) -- Start Node.js server: `npx http-server -p 8080` (more features) -- Stop servers: `pkill -f "python3.*http.server"` or `pkill -f "npx.*http-server"` +- Start Node.js server: `npx http-server -p 8080` (recommended for JavaScript project) +- Start Python server: `python3 -m http.server 8080` (alternative option) +- Stop servers: `pkill -f "npx.*http-server"` or `pkill -f "python3.*http.server"` - Check server status: `curl -I http://localhost:8080/` ### Code Navigation @@ -138,17 +138,17 @@ ls /home/runner/work/GitHub/GitHub/script/*.js - **Styling**: `style/BootEWA.css` and `style/index.css` ### Troubleshooting -- **CDN Loading Issues**: External dependencies from cdn.bootcss.com may be blocked -- **GitHub API Access**: Token in script/index.js may be expired (check for 403 responses) +- **CDN Loading Issues**: External dependencies from cdn.bootcss.com may be blocked (will migrate to unpkg.com) +- **GitHub API Access**: Token in script/index.js may be expired (will migrate to OAuth token system) - **CORS Errors**: Use proper HTTP server, not file:// protocol -- **Module Loading**: RequireJS errors indicate missing or blocked CDN dependencies +- **Module Loading**: RequireJS errors indicate missing or blocked CDN dependencies (will migrate to ECMAScript modules) ## Important Notes ### Security Considerations -- **Exposed API Token**: GitHub personal access token is hardcoded in `script/index.js` +- **Exposed API Token**: GitHub personal access token is hardcoded in `script/index.js` (will migrate to OAuth system) - **CORS Configuration**: Application expects to run from HTTP server, not file system -- **CDN Dependencies**: External resource loading creates security and availability dependencies +- **CDN Dependencies**: External resource loading creates security and availability dependencies (will migrate to unpkg.com) ### Development Workflow 1. **ALWAYS** start HTTP server before testing changes @@ -181,6 +181,6 @@ style/ ### Required HTTP server test ```bash -cd /home/runner/work/GitHub/GitHub && python3 -m http.server 8080 +cd /home/runner/work/GitHub/GitHub && npx http-server -p 8080 ``` -Expected output: `Serving HTTP on :: port 8080 (http://[::]:8080/) ...` \ No newline at end of file +Expected output: Server starts and serves files on port 8080 \ No newline at end of file From 7f12608a1e031e3b01ab6e73752e911489473b6b Mon Sep 17 00:00:00 2001 From: South Drifter Date: Tue, 12 Aug 2025 00:40:04 +0800 Subject: [PATCH 5/6] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 16311c7..2f2e6c9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ node_modules/* bower_components/* .vscode/* -lib/ From 27b4565219b60ae845062d7e1a3f336adccd3c77 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:47:46 +0000 Subject: [PATCH 6/6] Remove all Python references and focus on JavaScript-only approach Co-authored-by: TechQuery <19969570+TechQuery@users.noreply.github.com> --- .github/copilot-instructions.md | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0bbbd61..3a1a4a7 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,7 +9,6 @@ This is a Chinese-language GitHub client web application built as a Single Page ### Quick Start - **NEVER build or compile anything** - this is a static web application that runs directly in the browser - Start HTTP server: `npx http-server -p 8080` (requires npm, starts in ~5-10 seconds, NEVER CANCEL) -- Alternative: `python3 -m http.server 8080` (starts in ~1-2 seconds, NEVER CANCEL) - Access application: `http://localhost:8080` - **CRITICAL**: External CDN dependencies may be blocked in some environments - document this limitation @@ -26,7 +25,7 @@ This is a Chinese-language GitHub client web application built as a Single Page - **Network Access**: CDN blocking will prevent full functionality in restricted environments ### Validation Requirements -- **ALWAYS** test HTTP server startup with both Python and Node.js options +- **ALWAYS** test HTTP server startup with Node.js - **ALWAYS** verify static file serving for HTML, CSS, JS, JSON files - Test navigation structure by accessing key routes: - Main page: `/` @@ -81,19 +80,12 @@ After making changes, ALWAYS run through these validation steps: ### HTTP Server Testing ```bash -# Test Node.js HTTP server (recommended for JavaScript project) +# Start Node.js HTTP server (JavaScript project) cd /home/runner/work/GitHub/GitHub npx http-server -p 8080 & sleep 5 curl -I http://localhost:8080/ # Should return HTTP/1.1 200 OK - -# Test Python alternative (fallback) -pkill -f "npx.*http-server" -python3 -m http.server 8080 & -sleep 2 -curl -I http://localhost:8080/ -# Should return HTTP/1.0 200 OK ``` ### File Serving Validation @@ -124,9 +116,8 @@ ls /home/runner/work/GitHub/GitHub/script/*.js ## Common Tasks ### Server Operations -- Start Node.js server: `npx http-server -p 8080` (recommended for JavaScript project) -- Start Python server: `python3 -m http.server 8080` (alternative option) -- Stop servers: `pkill -f "npx.*http-server"` or `pkill -f "python3.*http.server"` +- Start Node.js server: `npx http-server -p 8080` (JavaScript project) +- Stop server: `pkill -f "npx.*http-server"` - Check server status: `curl -I http://localhost:8080/` ### Code Navigation @@ -158,7 +149,7 @@ ls /home/runner/work/GitHub/GitHub/script/*.js 5. **DOCUMENT** any CDN access issues encountered in your environment ### Performance Expectations -- Server startup: 1-10 seconds depending on method used +- Server startup: 5-10 seconds with Node.js HTTP server - File serving: Near-instantaneous for static assets - Component loading: Dependent on CDN accessibility and network speed - **NEVER CANCEL** server operations during startup phase