Happyebook2 Commands
Overview
Use this skill for repeatable command workflows in C:\happyebook2. The project is a static Happy eBook site built with HTML5, CSS3, and Vanilla JavaScript under src/, with assets in assets/.
Defaults
- Run commands from
C:\happyebook2. - Prefer
git -C C:\happyebook2 ...so commands are unambiguous. - Use PowerShell syntax.
- Keep responses in Traditional Chinese unless the user asks otherwise.
- Before pushing, confirm the working tree and latest commit.
- Do not use React, Vue, Angular, Tailwind, Bootstrap, jQuery, or external UI frameworks.
Git Commands
Status:
git -C C:\happyebook2 status --short --branch
Recent commits:
git -C C:\happyebook2 log --oneline --decorate --max-count=10
Dated commit list:
git -C C:\happyebook2 log --pretty=format:"%h %cd %s" --date=format:"%Y-%m-%d %H:%M:%S %z" --max-count=8
Filter by date:
git -C C:\happyebook2 log --pretty=format:"%h %cd %s" --date=format:"%Y-%m-%d %H:%M:%S %z" --since="YYYY-MM-DD 00:00:00" --until="YYYY-MM-DD 23:59:59" --all
Remote:
git -C C:\happyebook2 remote -v
Push current main when the user asks to publish:
git -C C:\happyebook2 push origin main
Inspect Changes
Diff selected frontend files:
git -C C:\happyebook2 diff -- src/index.html src/books.html src/script.js src/styles.css
Diff summary:
git -C C:\happyebook2 diff --stat
Show commit files:
git -C C:\happyebook2 show --stat --oneline --name-only <commit>
Show commit line counts:
git -C C:\happyebook2 show --numstat --format=medium <commit>
Show a commit diff for specific files:
git -C C:\happyebook2 show --format= --unified=3 <commit> -- src/books.json src/script.js
File And Search Commands
List frontend files:
Get-ChildItem -LiteralPath C:\happyebook2\src | Select-Object Name,Length
List image assets:
Get-ChildItem -LiteralPath C:\happyebook2\assets\images | Select-Object Name,Length
Find navigation markup:
Select-String -Path C:\happyebook2\src\*.html -Pattern '<nav class="site-nav"'
Find important JS sections:
Select-String -Path C:\happyebook2\src\script.js -Pattern 'const initBooksPage|const sampleBooks|const createBookCard' -Context 0,4
Find card and responsive CSS:
Select-String -Path C:\happyebook2\src\styles.css -Pattern 'book-card|card-actions|filter-bar|@media' -Context 0,2
Read common files:
Get-Content -LiteralPath C:\happyebook2\src\index.html -TotalCount 220
Get-Content -LiteralPath C:\happyebook2\src\books.html -TotalCount 120
Get-Content -LiteralPath C:\happyebook2\src\styles.css -TotalCount 260
Get-Content -LiteralPath C:\happyebook2\src\script.js -TotalCount 260
Validation
Check JavaScript syntax:
node --check C:\happyebook2\src\script.js
For broader frontend changes, also manually preview index.html and books.html in the local server.
Local Preview Server
Use the project root as the server root so src/ pages can resolve ../assets/images/... correctly.
Start preview server:
python -m http.server 8090 --bind 127.0.0.1 --directory C:\happyebook2
Open:
http://127.0.0.1:8090/src/index.html
http://127.0.0.1:8090/src/books.html
Check whether port 8090 is listening:
Get-NetTCPConnection -LocalPort 8090 -State Listen
Check Python servers:
Get-Process python -ErrorAction SilentlyContinue
Test page and asset responses:
Invoke-WebRequest -Uri http://127.0.0.1:8090/src/books.html -UseBasicParsing -TimeoutSec 5
Invoke-WebRequest -Uri http://127.0.0.1:8090/assets/images/book-git-github-start.svg -UseBasicParsing -TimeoutSec 5
Invoke-WebRequest -Uri http://127.0.0.1:8090/src/styles.css -UseBasicParsing -TimeoutSec 5
Troubleshooting Notes
If book covers show broken image icons during local preview, the server root is probably wrong. Do not serve only C:\happyebook2\src; serve C:\happyebook2 and open /src/books.html.
If localhost refuses connection, check the port listener first. Prefer http://127.0.0.1:8090/src/books.html for testing.
If port 8080 has stale connections, switch to 8090 instead of spending time untangling old sockets.