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.
Files changed (94) hide show
  1. package/README.md +0 -2
  2. package/package.json +1 -1
  3. package/template-hono/AGENTS.md +53 -95
  4. package/template-hono/README.md +3 -31
  5. package/template-hono/client/index.html +6 -1
  6. package/template-hono/client/public/imagicma-preview-feedback.js +734 -0
  7. package/template-hono/client/src/lib/imagicma-preview-picker.ts +282 -22
  8. package/template/.env.example +0 -10
  9. package/template/AGENTS.md +0 -225
  10. package/template/README.md +0 -34
  11. package/template/app/_components/DevPreviewShield.tsx +0 -638
  12. package/template/app/api/greeting/route.ts +0 -27
  13. package/template/app/error.tsx +0 -93
  14. package/template/app/favicon.ico +0 -0
  15. package/template/app/globals.css +0 -767
  16. package/template/app/hello/_components/HelloClient.tsx +0 -94
  17. package/template/app/hello/page.tsx +0 -23
  18. package/template/app/layout.tsx +0 -32
  19. package/template/app/page.tsx +0 -27
  20. package/template/app/providers.tsx +0 -25
  21. package/template/components/ui/accordion.tsx +0 -58
  22. package/template/components/ui/alert-dialog.tsx +0 -141
  23. package/template/components/ui/alert.tsx +0 -61
  24. package/template/components/ui/aspect-ratio.tsx +0 -7
  25. package/template/components/ui/avatar.tsx +0 -51
  26. package/template/components/ui/badge.tsx +0 -40
  27. package/template/components/ui/breadcrumb.tsx +0 -117
  28. package/template/components/ui/button.tsx +0 -64
  29. package/template/components/ui/calendar.tsx +0 -72
  30. package/template/components/ui/card.tsx +0 -87
  31. package/template/components/ui/carousel.tsx +0 -262
  32. package/template/components/ui/chart.tsx +0 -365
  33. package/template/components/ui/checkbox.tsx +0 -30
  34. package/template/components/ui/collapsible.tsx +0 -11
  35. package/template/components/ui/command.tsx +0 -153
  36. package/template/components/ui/context-menu.tsx +0 -200
  37. package/template/components/ui/dialog.tsx +0 -122
  38. package/template/components/ui/drawer.tsx +0 -118
  39. package/template/components/ui/dropdown-menu.tsx +0 -200
  40. package/template/components/ui/form.tsx +0 -178
  41. package/template/components/ui/hover-card.tsx +0 -29
  42. package/template/components/ui/input-otp.tsx +0 -71
  43. package/template/components/ui/input.tsx +0 -25
  44. package/template/components/ui/label.tsx +0 -26
  45. package/template/components/ui/menubar.tsx +0 -256
  46. package/template/components/ui/navigation-menu.tsx +0 -130
  47. package/template/components/ui/pagination.tsx +0 -119
  48. package/template/components/ui/popover.tsx +0 -31
  49. package/template/components/ui/progress.tsx +0 -28
  50. package/template/components/ui/radio-group.tsx +0 -44
  51. package/template/components/ui/resizable.tsx +0 -45
  52. package/template/components/ui/scroll-area.tsx +0 -48
  53. package/template/components/ui/select.tsx +0 -160
  54. package/template/components/ui/separator.tsx +0 -31
  55. package/template/components/ui/sheet.tsx +0 -140
  56. package/template/components/ui/sidebar.tsx +0 -732
  57. package/template/components/ui/skeleton.tsx +0 -17
  58. package/template/components/ui/slider.tsx +0 -28
  59. package/template/components/ui/switch.tsx +0 -29
  60. package/template/components/ui/table.tsx +0 -119
  61. package/template/components/ui/tabs.tsx +0 -55
  62. package/template/components/ui/textarea.tsx +0 -24
  63. package/template/components/ui/toast.tsx +0 -129
  64. package/template/components/ui/toaster.tsx +0 -35
  65. package/template/components/ui/toggle-group.tsx +0 -61
  66. package/template/components/ui/toggle.tsx +0 -45
  67. package/template/components/ui/tooltip.tsx +0 -30
  68. package/template/drizzle.config.ts +0 -50
  69. package/template/eslint.config.mjs +0 -18
  70. package/template/gitignore +0 -46
  71. package/template/hooks/use-greeting.ts +0 -15
  72. package/template/hooks/use-mobile.ts +0 -21
  73. package/template/hooks/use-toast.ts +0 -194
  74. package/template/lib/queryClient.ts +0 -59
  75. package/template/lib/theme/default-theme.ts +0 -11
  76. package/template/lib/utils.ts +0 -6
  77. package/template/next.config.ts +0 -8
  78. package/template/package.json +0 -76
  79. package/template/pnpm-lock.yaml +0 -6937
  80. package/template/postcss.config.mjs +0 -7
  81. package/template/process-compose.yaml +0 -13
  82. package/template/public/file.svg +0 -1
  83. package/template/public/globe.svg +0 -1
  84. package/template/public/imagicma-picker-bridge.js +0 -374
  85. package/template/public/next.svg +0 -1
  86. package/template/public/vercel.svg +0 -1
  87. package/template/public/window.svg +0 -1
  88. package/template/server/db.ts +0 -24
  89. package/template/server/storage.ts +0 -41
  90. package/template/shared/routes.ts +0 -13
  91. package/template/shared/schema.ts +0 -17
  92. package/template/tailwind.config.mjs +0 -96
  93. package/template/tsconfig.json +0 -35
  94. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-next-imagicma",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-next-imagicma": "./bin/create-next-imagicma.mjs"
@@ -1,95 +1,53 @@
1
- # 项目 Agent 指南(Hono + Vite + React + Drizzle)
2
-
3
- 默认使用中文沟通与输出(除非用户明确要求其他语言)。
4
-
5
- ## 目标
6
-
7
- 你需要一次性交付可运行、可预览、可验证、可演示的完整应用,而不是半成品。
8
-
9
- ## 技术栈与约束
10
-
11
- - 框架:Hono(Node runtime)+ Vite(单进程开发)
12
- - 前端:React 19 + React Router + Tailwind v4 + shadcn/ui
13
- - 请求层:React Query + fetch
14
- - 契约:Zod(`shared/routes.ts`)
15
- - 数据库:SQLite + Drizzle(默认 `./.data/app.db`,无需 `DATABASE_URL`;可用 `DATABASE_FILE` 覆盖)
16
-
17
- ## 目录约定
18
-
19
- - `client/index.html`:Vite 前端入口 HTML
20
- - `client/public/`:前端静态资源
21
- - `client/src/`:前端应用入口、页面、Provider、错误边界
22
- - `client/src/components/ui/`:shadcn/ui 组件
23
- - `client/src/hooks/`:客户端 hooks
24
- - `client/src/lib/`:通用工具
25
- - `server/`:Hono 入口、路由、存储、DB
26
- - `shared/`:前后端共享 schema/契约
27
-
28
- ## 常用命令
29
-
30
- - `pnpm dev`:单进程开发(Vite + Hono dev middleware)
31
- - `pnpm build`:构建前端并编译 server
32
- - `pnpm start`:生产启动
33
- - `pnpm check`:类型检查
34
- - `pnpm lint`:ESLint
35
- - `pnpm db:push`:同步数据库结构
36
-
37
- ## 执行硬规则
38
-
39
- - 不阻塞就不要问用户,直接推进到完成。
40
- - 不要要求用户发送“继续执行/不要停在总结”之类控制语句,把持续推进作为默认行为。
41
- - 进度反馈用自然里程碑播报,不使用突兀命令式话术。
42
- - 仅在真实阻塞时才提问,并附已尝试步骤与日志证据。
43
- - 未达到完成标准前,不得用“文档总结/状态总结”代替执行。
44
- - 不得只做前端占位,必须打通真实 API 与数据读写链路。
45
- - 每次代码改动后必须重启服务并验证页面/接口。
46
- - 关键改动后必须跑端到端验证(如 `run_test`)并检查日志。
47
- - 禁止递归调用测试代理或无限循环调用同一工具。
48
- - 如果 `run_test` 结果不是 `[run_test] ok`,必须视为未通过,继续修复。
49
- - `run_test` 卡住或无进展时要快速失败并给出证据,禁止长时间空转重试。
50
- - 不允许“口头完成”。完成声明必须有工具证据支撑。
51
- - SQLite 路径必须保持单一 schema 真相源,禁止手写临时 SQL 与 ORM schema 并行漂移。
52
- - 禁止修改 `scripts/` 下的受保护启动文件:`imagicma-common.mjs`、`imagicma-guard.mjs`、`imagicma-dev.mjs`、`imagicma-start.mjs`、`imagicma-runtime-logs.mjs`。
53
- - 禁止修改 `package.json` `scripts.dev` `scripts.start`(以及对应 `predev`、`prestart`)命令。
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.
@@ -1,6 +1,6 @@
1
1
  # hono-app
2
2
 
3
- 基于 **Hono + Vite + React** 的全栈模板,目标是保留原 `nextjs-app` 的前端体验,同时降低服务端运行开销。
3
+ 基于 **Hono + Vite + React** 的全栈应用。
4
4
 
5
5
  ## 技术栈
6
6
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  ```bash
25
25
  pnpm install
26
- pnpm dev
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` 启动,必须使用 `pnpm dev`。
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" src="/src/main.tsx"></script>
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>