create-next-imagicma 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/package.json +1 -1
- package/template-hono/AGENTS.md +53 -95
- package/template-hono/README.md +3 -31
- package/template-hono/client/index.html +6 -1
- package/template-hono/client/public/imagicma-preview-feedback.js +734 -0
- package/template-hono/client/src/lib/imagicma-preview-picker.ts +282 -22
- package/template/.env.example +0 -10
- package/template/AGENTS.md +0 -225
- package/template/README.md +0 -34
- package/template/app/_components/DevPreviewShield.tsx +0 -638
- package/template/app/api/greeting/route.ts +0 -27
- package/template/app/error.tsx +0 -93
- package/template/app/favicon.ico +0 -0
- package/template/app/globals.css +0 -767
- package/template/app/hello/_components/HelloClient.tsx +0 -94
- package/template/app/hello/page.tsx +0 -23
- package/template/app/layout.tsx +0 -32
- package/template/app/page.tsx +0 -27
- package/template/app/providers.tsx +0 -25
- package/template/components/ui/accordion.tsx +0 -58
- package/template/components/ui/alert-dialog.tsx +0 -141
- package/template/components/ui/alert.tsx +0 -61
- package/template/components/ui/aspect-ratio.tsx +0 -7
- package/template/components/ui/avatar.tsx +0 -51
- package/template/components/ui/badge.tsx +0 -40
- package/template/components/ui/breadcrumb.tsx +0 -117
- package/template/components/ui/button.tsx +0 -64
- package/template/components/ui/calendar.tsx +0 -72
- package/template/components/ui/card.tsx +0 -87
- package/template/components/ui/carousel.tsx +0 -262
- package/template/components/ui/chart.tsx +0 -365
- package/template/components/ui/checkbox.tsx +0 -30
- package/template/components/ui/collapsible.tsx +0 -11
- package/template/components/ui/command.tsx +0 -153
- package/template/components/ui/context-menu.tsx +0 -200
- package/template/components/ui/dialog.tsx +0 -122
- package/template/components/ui/drawer.tsx +0 -118
- package/template/components/ui/dropdown-menu.tsx +0 -200
- package/template/components/ui/form.tsx +0 -178
- package/template/components/ui/hover-card.tsx +0 -29
- package/template/components/ui/input-otp.tsx +0 -71
- package/template/components/ui/input.tsx +0 -25
- package/template/components/ui/label.tsx +0 -26
- package/template/components/ui/menubar.tsx +0 -256
- package/template/components/ui/navigation-menu.tsx +0 -130
- package/template/components/ui/pagination.tsx +0 -119
- package/template/components/ui/popover.tsx +0 -31
- package/template/components/ui/progress.tsx +0 -28
- package/template/components/ui/radio-group.tsx +0 -44
- package/template/components/ui/resizable.tsx +0 -45
- package/template/components/ui/scroll-area.tsx +0 -48
- package/template/components/ui/select.tsx +0 -160
- package/template/components/ui/separator.tsx +0 -31
- package/template/components/ui/sheet.tsx +0 -140
- package/template/components/ui/sidebar.tsx +0 -732
- package/template/components/ui/skeleton.tsx +0 -17
- package/template/components/ui/slider.tsx +0 -28
- package/template/components/ui/switch.tsx +0 -29
- package/template/components/ui/table.tsx +0 -119
- package/template/components/ui/tabs.tsx +0 -55
- package/template/components/ui/textarea.tsx +0 -24
- package/template/components/ui/toast.tsx +0 -129
- package/template/components/ui/toaster.tsx +0 -35
- package/template/components/ui/toggle-group.tsx +0 -61
- package/template/components/ui/toggle.tsx +0 -45
- package/template/components/ui/tooltip.tsx +0 -30
- package/template/drizzle.config.ts +0 -50
- package/template/eslint.config.mjs +0 -18
- package/template/gitignore +0 -46
- package/template/hooks/use-greeting.ts +0 -15
- package/template/hooks/use-mobile.ts +0 -21
- package/template/hooks/use-toast.ts +0 -194
- package/template/lib/queryClient.ts +0 -59
- package/template/lib/theme/default-theme.ts +0 -11
- package/template/lib/utils.ts +0 -6
- package/template/next.config.ts +0 -8
- package/template/package.json +0 -76
- package/template/pnpm-lock.yaml +0 -6937
- package/template/postcss.config.mjs +0 -7
- package/template/process-compose.yaml +0 -13
- package/template/public/file.svg +0 -1
- package/template/public/globe.svg +0 -1
- package/template/public/imagicma-picker-bridge.js +0 -374
- package/template/public/next.svg +0 -1
- package/template/public/vercel.svg +0 -1
- package/template/public/window.svg +0 -1
- package/template/server/db.ts +0 -24
- package/template/server/storage.ts +0 -41
- package/template/shared/routes.ts +0 -13
- package/template/shared/schema.ts +0 -17
- package/template/tailwind.config.mjs +0 -96
- package/template/tsconfig.json +0 -35
- package/template/types/pg.d.ts +0 -19
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
## 模版源
|
|
6
6
|
|
|
7
|
-
- `../nextjs-app`
|
|
8
7
|
- `../hono-app`
|
|
9
8
|
如果要修改模版,请修改源头,然后执行 `pnpm run sync-template` 同步到当前模版目录,切记不可直接修改当前模版目录。
|
|
10
9
|
## 使用
|
|
@@ -50,7 +49,6 @@ pnpm run sync-template
|
|
|
50
49
|
|
|
51
50
|
默认同步:
|
|
52
51
|
|
|
53
|
-
- `../nextjs-app` -> `template/`
|
|
54
52
|
- `../hono-app` -> `template-hono/`
|
|
55
53
|
|
|
56
54
|
可通过环境变量覆盖:
|
package/package.json
CHANGED
package/template-hono/AGENTS.md
CHANGED
|
@@ -1,95 +1,53 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
- `
|
|
20
|
-
- `client
|
|
21
|
-
- `
|
|
22
|
-
- `client
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- `
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- 禁止直接执行 `vite` 或 `node dist/server/index.js` 或 `pnpm dev` 或 `pnpm start` 启动项目;只能通过 `restart_workflow` 启动。
|
|
55
|
-
- 禁止主动注入环境变量到 `process.env`。
|
|
56
|
-
- 端口契约只允许使用大写 `PORT`。
|
|
57
|
-
- 运行时端口读取顺序固定为:外部环境变量 `PORT` -> 项目内 `.imagicma/runtime.env`。
|
|
58
|
-
- 禁止写入 `/.imagicma/port.json`,禁止在 `process-compose.yaml` 中固化端口真相源。
|
|
59
|
-
|
|
60
|
-
## 状态文件写入规则
|
|
61
|
-
|
|
62
|
-
- 若维护 `docs/project_state.json`,每次写入前先读取最新版本。
|
|
63
|
-
- 若写入报冲突(文件已变更),必须重新读取后重试,不得忽略。
|
|
64
|
-
- `quality_gates.typecheck=true` 仅在构建命令真实通过后设置。
|
|
65
|
-
|
|
66
|
-
## UI 质量门禁(必须全部满足)
|
|
67
|
-
|
|
68
|
-
- `/` 路由必须可访问并落到首页组件。
|
|
69
|
-
- `client/src/pages/home.tsx` 不允许为空文件、空组件,或仅返回 `null` / 空白占位;首页必须渲染可见内容。
|
|
70
|
-
- 接入真实业务时,应将 `/` 首页替换为真实业务内容,不要长期保留模板默认文案或空白首页。
|
|
71
|
-
- 视觉风格必须明确:字体、颜色、间距、动效要统一。
|
|
72
|
-
- 必须定义可复用设计 token(颜色、圆角、阴影、间距等级)。
|
|
73
|
-
- 至少覆盖桌面与移动端关键断点,不允许内容溢出。
|
|
74
|
-
- 交互状态完整:hover/focus/disabled/loading/error/success。
|
|
75
|
-
- 在 `<Button>` 上使用自定义背景色类(如 `bg-*`)时,必须同时显式声明文本色类(如 `text-*`);禁止只改背景不改文字色。
|
|
76
|
-
- 优先复用 `Input/Button/Card/Checkbox/Select` 的默认视觉语言,必要时只做局部增强,不要重写整套样式。
|
|
77
|
-
- 列表增删改状态建议加入轻量动效(如 `framer-motion` 的入场/退出),并提供失败反馈(toast 或 inline alert)。
|
|
78
|
-
|
|
79
|
-
## 数据与安全
|
|
80
|
-
|
|
81
|
-
- 服务端数据库逻辑放在 `server/`,不要泄漏到客户端。
|
|
82
|
-
- API 响应必须经过 `shared/routes.ts` 的 Zod schema 校验。
|
|
83
|
-
- 不提交 `.env.local`、数据库密钥。
|
|
84
|
-
- 优先复用 `client/src/components/ui` 与 `client/src/hooks`,避免重复造轮子。
|
|
85
|
-
|
|
86
|
-
## 完成标准
|
|
87
|
-
|
|
88
|
-
只有以下全部满足才允许结束:
|
|
89
|
-
|
|
90
|
-
- `pnpm build` 通过(无 pnpm 时 `npm run build` 通过)
|
|
91
|
-
- 页面可在本地端口访问并完成核心流程
|
|
92
|
-
- `/` 首页路由可访问(允许临时隐藏默认模板 DOM)
|
|
93
|
-
- `run_test` 返回 `[run_test] ok`
|
|
94
|
-
- 关键日志无阻塞级错误
|
|
95
|
-
- UI 达到可演示级(非“功能可用但观感粗糙”)
|
|
1
|
+
# Repository Guidelines
|
|
2
|
+
|
|
3
|
+
## Project Structure & Module Organization
|
|
4
|
+
|
|
5
|
+
This is a `Hono + Vite + React` app. Keep browser code in `client/src`, server entrypoints in `server/`, and shared contracts in `shared/`.
|
|
6
|
+
|
|
7
|
+
- `client/src/pages/`: route-level pages such as `home.tsx`
|
|
8
|
+
- `client/src/components/`: reusable UI, with shadcn/ui primitives under `components/ui/`
|
|
9
|
+
- `client/src/lib/` and `client/src/hooks/`: client utilities and hooks
|
|
10
|
+
- `server/routes/`: Hono route modules
|
|
11
|
+
- `shared/routes.ts` and `shared/schema.ts`: Zod-backed API contracts and shared schema
|
|
12
|
+
- `scripts/`: guarded dev/start scripts; do not bypass them
|
|
13
|
+
- `.data/`: local SQLite data; treat as runtime state, not source
|
|
14
|
+
|
|
15
|
+
The homepage must never ship blank. `client/src/pages/home.tsx` should render visible, meaningful content on first load, not hidden placeholders or empty shells.
|
|
16
|
+
|
|
17
|
+
## Build, Test, and Development Commands
|
|
18
|
+
|
|
19
|
+
- `restart_workflow`: required agent entrypoint for restarting dev services; do not call `pnpm dev` directly
|
|
20
|
+
- `pnpm build`: builds the client with Vite and compiles the server with `tsc`
|
|
21
|
+
- `pnpm start`: runs the production server through the guarded startup script
|
|
22
|
+
- `pnpm check`: TypeScript type-check for both client and server configs
|
|
23
|
+
- `pnpm lint`: runs ESLint across the repository
|
|
24
|
+
- `pnpm db:push`: applies Drizzle schema changes to the local SQLite database
|
|
25
|
+
|
|
26
|
+
## Coding Style & Naming Conventions
|
|
27
|
+
|
|
28
|
+
Use TypeScript and ESM throughout. Follow the existing style: 2-space indentation, double quotes, semicolons, and trailing commas. Prefer:
|
|
29
|
+
|
|
30
|
+
- PascalCase for React components, for example `HelloClient.tsx`
|
|
31
|
+
- kebab-case for route/page files, for example `not-found.tsx`
|
|
32
|
+
- colocated logic in `hooks/`, `lib/`, and `routes/` before creating new top-level folders
|
|
33
|
+
|
|
34
|
+
Reuse the `@/` import alias for client code where it improves readability.
|
|
35
|
+
|
|
36
|
+
## Testing Guidelines
|
|
37
|
+
|
|
38
|
+
This template does not currently ship with a committed automated test runner or `pnpm test` script. Before opening a PR, run `pnpm check` and `pnpm lint`, then manually verify the main page and `GET /api/greeting`.
|
|
39
|
+
|
|
40
|
+
If you add tests, keep them as `*.test.ts` or `*.test.tsx`, or add a `tests/` folder and document the new command in `package.json`.
|
|
41
|
+
|
|
42
|
+
## Commit & Pull Request Guidelines
|
|
43
|
+
|
|
44
|
+
Recent history uses Conventional Commit prefixes such as `feat:`, `fix:`, and `chore:`; keep that format and write concise subjects. PRs should include:
|
|
45
|
+
|
|
46
|
+
- a short description of behavior changes
|
|
47
|
+
- linked issue or task when available
|
|
48
|
+
- screenshots or recordings for UI changes
|
|
49
|
+
- notes for env, port, or database-impacting changes
|
|
50
|
+
|
|
51
|
+
## Runtime & Configuration Notes
|
|
52
|
+
|
|
53
|
+
Agents must use `restart_workflow` instead of invoking `pnpm dev` manually. Do not pass a port on the command line or by prefixing `pnpm dev` with `PORT=...`; keep runtime port configuration in `.imagicma/runtime.env`. Database defaults to `./.data/app.db`, and overrides belong in `.env.local`, not committed secrets.
|
package/template-hono/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# hono-app
|
|
2
2
|
|
|
3
|
-
基于 **Hono + Vite + React**
|
|
3
|
+
基于 **Hono + Vite + React** 的全栈应用。
|
|
4
4
|
|
|
5
5
|
## 技术栈
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pnpm install
|
|
26
|
-
|
|
26
|
+
start_app.sh
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
启动时按以下顺序解析端口:
|
|
@@ -38,14 +38,7 @@ pnpm dev
|
|
|
38
38
|
PORT=6424
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
请勿直接执行 `vite`
|
|
42
|
-
|
|
43
|
-
## 构建与运行
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
pnpm build
|
|
47
|
-
pnpm start
|
|
48
|
-
```
|
|
41
|
+
请勿直接执行 `vite` 或 `pnpm dev` 启动,必须使用 `restart_workflow`。
|
|
49
42
|
|
|
50
43
|
- `build` 产出:
|
|
51
44
|
- 前端:`dist/client`
|
|
@@ -67,29 +60,8 @@ pnpm db:push
|
|
|
67
60
|
## 运行时文件
|
|
68
61
|
|
|
69
62
|
- `.imagicma/runtime.env`:项目运行端口契约,只使用大写 `PORT`
|
|
70
|
-
- `/.imagicma/port.json`:已废弃,不再使用
|
|
71
63
|
|
|
72
64
|
## 验证路径
|
|
73
65
|
|
|
74
66
|
- API:`GET /api/greeting`
|
|
75
67
|
- 页面:`/hello`
|
|
76
|
-
|
|
77
|
-
## E2E 与 `run_test`
|
|
78
|
-
|
|
79
|
-
- Playwright 配置位于 [`playwright.config.ts`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/playwright.config.ts)
|
|
80
|
-
- 测试契约位于 [`hono-app/.imagicma/testing-manifest.json`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/.imagicma/testing-manifest.json)
|
|
81
|
-
- 本地回归命令:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
pnpm test:e2e
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
- `run_test` 驱动 Playwright 时会注入:
|
|
88
|
-
- `IMAGICMA_RUN_ID`
|
|
89
|
-
- `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
90
|
-
- `IMAGICMA_RUN_TEST_SKIP_WEBSERVER`
|
|
91
|
-
- `BASE_URL`
|
|
92
|
-
|
|
93
|
-
fixtures 约定:
|
|
94
|
-
- `tests/e2e/fixtures/imagicma.ts` 必须把浏览器 warning/error、page errors、失败网络请求与 current URL 写入 `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
95
|
-
- `testing-manifest.json` 负责声明稳定页面、selectors、fixtures 与 auth profile,供 `run_test` 编译阶段使用
|
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>hono-app</title>
|
|
7
7
|
<script src="/imagicma-picker-bridge.js"></script>
|
|
8
|
+
<script src="/imagicma-preview-feedback.js"></script>
|
|
8
9
|
</head>
|
|
9
10
|
<body class="antialiased">
|
|
10
11
|
<div id="root"></div>
|
|
11
|
-
<script type="module"
|
|
12
|
+
<script type="module">
|
|
13
|
+
import("/src/main.tsx").catch((error) => {
|
|
14
|
+
window.__IMAGICMA_PREVIEW_FEEDBACK__?.reportModuleBootstrapError(error);
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
12
17
|
</body>
|
|
13
18
|
</html>
|