# Happyebook2 Commands

> Use when working in the happyebook2 project and the user asks for common commands, Git status/log/diff/push checks, local preview server setup, asset/path troubleshooting, or validation commands for the HTML/CSS/Vanilla JS ebook site.

- Skill: `j945935cy/happyebook2-commands` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add j945935cy/happyebook2-commands`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j945935cy/happyebook2-commands/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: j945935cy (https://skillmd.com/u/j945935cy)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/j945935cy/happyebook2-commands

---


# 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:

```powershell
git -C C:\happyebook2 status --short --branch
```

Recent commits:

```powershell
git -C C:\happyebook2 log --oneline --decorate --max-count=10
```

Dated commit list:

```powershell
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:

```powershell
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:

```powershell
git -C C:\happyebook2 remote -v
```

Push current main when the user asks to publish:

```powershell
git -C C:\happyebook2 push origin main
```

## Inspect Changes

Diff selected frontend files:

```powershell
git -C C:\happyebook2 diff -- src/index.html src/books.html src/script.js src/styles.css
```

Diff summary:

```powershell
git -C C:\happyebook2 diff --stat
```

Show commit files:

```powershell
git -C C:\happyebook2 show --stat --oneline --name-only <commit>
```

Show commit line counts:

```powershell
git -C C:\happyebook2 show --numstat --format=medium <commit>
```

Show a commit diff for specific files:

```powershell
git -C C:\happyebook2 show --format= --unified=3 <commit> -- src/books.json src/script.js
```

## File And Search Commands

List frontend files:

```powershell
Get-ChildItem -LiteralPath C:\happyebook2\src | Select-Object Name,Length
```

List image assets:

```powershell
Get-ChildItem -LiteralPath C:\happyebook2\assets\images | Select-Object Name,Length
```

Find navigation markup:

```powershell
Select-String -Path C:\happyebook2\src\*.html -Pattern '<nav class="site-nav"'
```

Find important JS sections:

```powershell
Select-String -Path C:\happyebook2\src\script.js -Pattern 'const initBooksPage|const sampleBooks|const createBookCard' -Context 0,4
```

Find card and responsive CSS:

```powershell
Select-String -Path C:\happyebook2\src\styles.css -Pattern 'book-card|card-actions|filter-bar|@media' -Context 0,2
```

Read common files:

```powershell
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:

```powershell
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:

```powershell
python -m http.server 8090 --bind 127.0.0.1 --directory C:\happyebook2
```

Open:

```text
http://127.0.0.1:8090/src/index.html
http://127.0.0.1:8090/src/books.html
```

Check whether port 8090 is listening:

```powershell
Get-NetTCPConnection -LocalPort 8090 -State Listen
```

Check Python servers:

```powershell
Get-Process python -ErrorAction SilentlyContinue
```

Test page and asset responses:

```powershell
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.

