Skip to content

Commit a0df60e

Browse files
committed
fix: frontend build error
1 parent 1830024 commit a0df60e

4 files changed

Lines changed: 44 additions & 3 deletions

File tree

.github/copilot-instructions.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Copilot Instructions — Shadmin
22

3-
Shadmin is a full-stack RBAC admin dashboard: Go backend (Gin + Ent ORM + Casbin) and React 19 frontend (Shadcn UI + TanStack Router/Query + Zustand).
3+
Shadmin is a full-stack RBAC admin dashboard with three main surfaces:
4+
- Go backend (`main.go`, `api/`, `domain/`, `repository/`, `usecase/`, `ent/`)
5+
- React 19 frontend (`web/`)
6+
- Thin Go CLI (`cli/`) for read-only agent workflows
47

58
## Build, Test, and Lint
69

@@ -29,6 +32,15 @@ pnpm format:check # Prettier check
2932
pnpm format # Prettier auto-fix
3033
```
3134

35+
### CLI (cli/)
36+
37+
```bash
38+
cd cli
39+
make build # Build shadmin-cli
40+
make install # Install into $GOBIN
41+
make test # CLI unit tests
42+
```
43+
3244
### Pre-commit hook
3345

3446
`.githooks/pre-commit` runs `go fmt`, `go vet`, `go test`, and frontend lint/format automatically.
@@ -72,6 +84,14 @@ web/src/
7284
└── context/ # Providers (theme, font, layout, search)
7385
```
7486

87+
### CLI — Read-Only Agent Client
88+
89+
- Separate Go module under `cli/`
90+
- JSON is the default output; `--pretty` switches to a tabular view
91+
- Auth uses OAuth device authorization and caches the JWT in `cli/.env` or `SHADMIN_CONFIG`
92+
- All requests reuse server-side RBAC; the CLI cannot bypass permissions
93+
- MVP commands are read-only (`login`, `whoami`, `users`, `roles`, `menus`, `api-resources`)
94+
7595
### Auth & Permissions
7696

7797
- **Authentication**: JWT access + refresh tokens. Middleware extracts claims into Gin context (`x-user-*` keys).
@@ -108,6 +128,13 @@ web/src/
108128

109129
All API responses use `domain.Response{Code, Msg, Data}`. Code `0` = success, `1` = error. Paginated results use `domain.PagedResult[T]` with `list`, `total`, `page`, `page_size`, `total_pages`.
110130

131+
### CLI Configuration
132+
133+
- CLI-only settings belong under `cli/` (`cli/.env.example`, `cli/.env`, or `SHADMIN_CONFIG`)
134+
- Do not add CLI settings to the repository root `.env` files; those are for the backend server
135+
- `cli/.env` is managed by `shadmin-cli login` and stores the local token cache
136+
- `shadmin-cli` is read-only in the MVP; new write commands should be designed with backend RBAC/Casbin first
137+
111138
### Naming
112139

113140
- **Go files/packages**: `lower_snake` (e.g., `loginlog_repository.go`)
@@ -125,6 +152,7 @@ Conventional Commits (`feat:`, `fix:`, `chore:`, `docs:`). Subject ≤ 72 chars.
125152
Before committing:
126153
- Backend: `go fmt ./...``go vet ./...``go test ./...`
127154
- Frontend (if changed): `pnpm lint``pnpm format:check`
155+
- CLI (if changed): `cd cli && make test`
128156
- Schema changes: `go generate ./ent`
129157
- API changes: regenerate Swagger
130158

CHANGLOGS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## 2026-05-18 v2.0.0
4+
5+
- Added CLI device auth
6+
- Added login slider CAPTCHA
7+
- Added department management
8+
- By default, the frontend build is registered via Go embed to simplify development and deployment

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#---------------------build web------------------------
22
FROM docker.io/library/node:22-alpine AS build_web
33
WORKDIR /app/web
4-
COPY web/package.json web/package-lock.json ./
4+
COPY web/package.json web/pnpm-lock.yaml ./
55
RUN npm install -g pnpm && pnpm install
66
COPY web/ ./
77
RUN pnpm run build
@@ -40,4 +40,3 @@ RUN useradd -U -u 1000 appuser && chown -R 1000:1000 /app
4040
USER 1000
4141
EXPOSE 55667
4242
CMD ["./shadmin-runner"]
43-

web/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
"format": "prettier --write .",
1313
"knip": "knip"
1414
},
15+
"pnpm": {
16+
"onlyBuiltDependencies": [
17+
"@swc/core",
18+
"esbuild"
19+
]
20+
},
1521
"dependencies": {
1622
"@hookform/resolvers": "^5.2.2",
1723
"@radix-ui/react-alert-dialog": "^1.1.15",

0 commit comments

Comments
 (0)