@coze-arch/cli 0.0.1-alpha.035e0e

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 (156) hide show
  1. package/README.md +142 -0
  2. package/bin/main +2 -0
  3. package/lib/__templates__/expo/.coze +12 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +220 -0
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
  7. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
  8. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +45 -0
  9. package/lib/__templates__/expo/README.md +72 -0
  10. package/lib/__templates__/expo/_gitignore +11 -0
  11. package/lib/__templates__/expo/_npmrc +20 -0
  12. package/lib/__templates__/expo/client/app/_layout.tsx +33 -0
  13. package/lib/__templates__/expo/client/app/demo.tsx +1 -0
  14. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  15. package/lib/__templates__/expo/client/app.config.ts +75 -0
  16. package/lib/__templates__/expo/client/assets/fonts/SpaceMono-Regular.ttf +0 -0
  17. package/lib/__templates__/expo/client/assets/images/adaptive-icon.png +0 -0
  18. package/lib/__templates__/expo/client/assets/images/default-avatar.png +0 -0
  19. package/lib/__templates__/expo/client/assets/images/favicon.png +0 -0
  20. package/lib/__templates__/expo/client/assets/images/icon.png +0 -0
  21. package/lib/__templates__/expo/client/assets/images/partial-react-logo.png +0 -0
  22. package/lib/__templates__/expo/client/assets/images/react-logo.png +0 -0
  23. package/lib/__templates__/expo/client/assets/images/react-logo@2x.png +0 -0
  24. package/lib/__templates__/expo/client/assets/images/react-logo@3x.png +0 -0
  25. package/lib/__templates__/expo/client/assets/images/splash-icon.png +0 -0
  26. package/lib/__templates__/expo/client/components/Screen.tsx +330 -0
  27. package/lib/__templates__/expo/client/components/SmartDateInput.tsx +238 -0
  28. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  29. package/lib/__templates__/expo/client/components/ThemedView.tsx +38 -0
  30. package/lib/__templates__/expo/client/constants/theme.ts +854 -0
  31. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +49 -0
  32. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  33. package/lib/__templates__/expo/client/eslint-formatter-simple.mjs +49 -0
  34. package/lib/__templates__/expo/client/eslint.config.mjs +98 -0
  35. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -0
  36. package/lib/__templates__/expo/client/hooks/useTheme.ts +13 -0
  37. package/lib/__templates__/expo/client/metro.config.js +121 -0
  38. package/lib/__templates__/expo/client/package.json +93 -0
  39. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  40. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  41. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +104 -0
  42. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  43. package/lib/__templates__/expo/client/utils/index.ts +54 -0
  44. package/lib/__templates__/expo/package.json +22 -0
  45. package/lib/__templates__/expo/pnpm-lock.yaml +13975 -0
  46. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  47. package/lib/__templates__/expo/server/package.json +32 -0
  48. package/lib/__templates__/expo/server/src/index.ts +18 -0
  49. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  50. package/lib/__templates__/expo/template.config.js +50 -0
  51. package/lib/__templates__/expo/tsconfig.json +1 -0
  52. package/lib/__templates__/nextjs/.coze +12 -0
  53. package/lib/__templates__/nextjs/README.md +358 -0
  54. package/lib/__templates__/nextjs/_gitignore +99 -0
  55. package/lib/__templates__/nextjs/_npmrc +23 -0
  56. package/lib/__templates__/nextjs/components.json +21 -0
  57. package/lib/__templates__/nextjs/eslint.config.mjs +18 -0
  58. package/lib/__templates__/nextjs/next-env.d.ts +6 -0
  59. package/lib/__templates__/nextjs/next.config.ts +19 -0
  60. package/lib/__templates__/nextjs/package.json +86 -0
  61. package/lib/__templates__/nextjs/pnpm-lock.yaml +10493 -0
  62. package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
  63. package/lib/__templates__/nextjs/public/file.svg +1 -0
  64. package/lib/__templates__/nextjs/public/globe.svg +1 -0
  65. package/lib/__templates__/nextjs/public/next.svg +1 -0
  66. package/lib/__templates__/nextjs/public/vercel.svg +1 -0
  67. package/lib/__templates__/nextjs/public/window.svg +1 -0
  68. package/lib/__templates__/nextjs/scripts/build.sh +14 -0
  69. package/lib/__templates__/nextjs/scripts/dev.sh +33 -0
  70. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  71. package/lib/__templates__/nextjs/scripts/start.sh +15 -0
  72. package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
  73. package/lib/__templates__/nextjs/src/app/globals.css +137 -0
  74. package/lib/__templates__/nextjs/src/app/layout.tsx +72 -0
  75. package/lib/__templates__/nextjs/src/app/page.tsx +78 -0
  76. package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
  77. package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
  78. package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
  79. package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
  80. package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
  81. package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
  82. package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
  83. package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
  84. package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
  85. package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
  86. package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
  87. package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
  88. package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
  89. package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
  90. package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
  91. package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
  92. package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
  93. package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
  94. package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
  95. package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
  96. package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
  97. package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
  98. package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
  99. package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
  100. package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
  101. package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
  102. package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
  103. package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
  104. package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
  105. package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
  106. package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
  107. package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
  108. package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
  109. package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
  110. package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
  111. package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
  112. package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
  113. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
  114. package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
  115. package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
  116. package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
  117. package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
  118. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
  119. package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
  120. package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
  121. package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
  122. package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
  123. package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
  124. package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
  125. package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
  126. package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
  127. package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
  128. package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
  129. package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
  130. package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
  131. package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
  132. package/lib/__templates__/nextjs/template.config.js +85 -0
  133. package/lib/__templates__/nextjs/tsconfig.json +34 -0
  134. package/lib/__templates__/templates.json +87 -0
  135. package/lib/__templates__/vite/.coze +12 -0
  136. package/lib/__templates__/vite/README.md +239 -0
  137. package/lib/__templates__/vite/_gitignore +66 -0
  138. package/lib/__templates__/vite/_npmrc +23 -0
  139. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  140. package/lib/__templates__/vite/index.html +13 -0
  141. package/lib/__templates__/vite/package.json +28 -0
  142. package/lib/__templates__/vite/pnpm-lock.yaml +4716 -0
  143. package/lib/__templates__/vite/postcss.config.js +6 -0
  144. package/lib/__templates__/vite/scripts/build.sh +14 -0
  145. package/lib/__templates__/vite/scripts/dev.sh +32 -0
  146. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  147. package/lib/__templates__/vite/scripts/start.sh +15 -0
  148. package/lib/__templates__/vite/src/index.css +21 -0
  149. package/lib/__templates__/vite/src/index.ts +5 -0
  150. package/lib/__templates__/vite/src/main.ts +64 -0
  151. package/lib/__templates__/vite/tailwind.config.js +9 -0
  152. package/lib/__templates__/vite/template.config.js +90 -0
  153. package/lib/__templates__/vite/tsconfig.json +16 -0
  154. package/lib/__templates__/vite/vite.config.ts +15 -0
  155. package/lib/cli.js +1916 -0
  156. package/package.json +77 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "react-jsx",
15
+ "incremental": true,
16
+ "plugins": [
17
+ {
18
+ "name": "next"
19
+ }
20
+ ],
21
+ "paths": {
22
+ "@/*": ["./src/*"]
23
+ }
24
+ },
25
+ "include": [
26
+ "next-env.d.ts",
27
+ "**/*.ts",
28
+ "**/*.tsx",
29
+ ".next/types/**/*.ts",
30
+ ".next/dev/types/**/*.ts",
31
+ "**/*.mts"
32
+ ],
33
+ "exclude": ["node_modules"]
34
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema",
3
+ "templates": [
4
+ {
5
+ "name": "expo",
6
+ "description": "Expo template for React Native applications",
7
+ "location": "./expo",
8
+ "paramsSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "appName": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "pattern": "^[a-z0-9-]+$",
15
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
16
+ },
17
+ "port": {
18
+ "type": "number",
19
+ "default": 8081,
20
+ "minimum": 1024,
21
+ "maximum": 65535,
22
+ "description": "Metro bundler port"
23
+ }
24
+ },
25
+ "required": [],
26
+ "additionalProperties": false
27
+ }
28
+ },
29
+ {
30
+ "name": "nextjs",
31
+ "description": "Next.js(复杂项目):`coze init ${COZE_WORKSPACE_PATH} --template nextjs`\n- 适用:全栈应用、复杂多页面等复杂项目\n- 使用默认nextjs项目规范\n - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。\n - **项目理解加速**:初始可以依赖项目下 `package.json` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。\n - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,`shadcn/ui`组件默认完整的预装在`src/components/ui/`目录下",
32
+ "location": "./nextjs",
33
+ "paramsSchema": {
34
+ "type": "object",
35
+ "properties": {
36
+ "appName": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "pattern": "^[a-z0-9-]+$",
40
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
41
+ },
42
+ "port": {
43
+ "type": "number",
44
+ "default": 5000,
45
+ "minimum": 1024,
46
+ "maximum": 65535,
47
+ "description": "Development server port (for Next.js dev server)"
48
+ }
49
+ },
50
+ "required": [],
51
+ "additionalProperties": false
52
+ }
53
+ },
54
+ {
55
+ "name": "vite",
56
+ "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
57
+ "location": "./vite",
58
+ "paramsSchema": {
59
+ "type": "object",
60
+ "properties": {
61
+ "appName": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "pattern": "^[a-z0-9-]+$",
65
+ "description": "Application name (lowercase, alphanumeric and hyphens only)"
66
+ },
67
+ "port": {
68
+ "type": "number",
69
+ "default": 5000,
70
+ "minimum": 1024,
71
+ "maximum": 65535,
72
+ "description": "Development server port"
73
+ },
74
+ "hmrPort": {
75
+ "type": "number",
76
+ "default": 6000,
77
+ "minimum": 1024,
78
+ "maximum": 65535,
79
+ "description": "Development HMR server port"
80
+ }
81
+ },
82
+ "required": [],
83
+ "additionalProperties": false
84
+ }
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1,12 @@
1
+ [project]
2
+ requires = ["nodejs-24"]
3
+
4
+ [dev]
5
+ build = ["bash", "./scripts/prepare.sh"]
6
+ run = ["bash", "./scripts/dev.sh"]
7
+ deps = ["git"] # -> apt install git
8
+
9
+ [deploy]
10
+ build = ["bash","./scripts/build.sh"]
11
+ run = ["bash","./scripts/start.sh"]
12
+ deps = ["git"] # -> apt install git
@@ -0,0 +1,239 @@
1
+ # <%= appName %>
2
+
3
+ 这是一个基于 TypeScript + Vite + Tailwind CSS 的轻量级 Web 应用项目,由扣子编程 CLI 创建。
4
+
5
+ ## 快速开始
6
+
7
+ ### 启动开发服务器
8
+
9
+ ```bash
10
+ coze dev
11
+ ```
12
+
13
+ 启动后,在浏览器中打开 [http://localhost:<%= port %>](http://localhost:<%= port %>) 查看应用。
14
+
15
+ 开发服务器支持热更新(HMR),修改代码后页面会自动刷新。
16
+
17
+ ### 构建生产版本
18
+
19
+ ```bash
20
+ coze build
21
+ ```
22
+
23
+ 构建产物位于 `dist/` 目录,可直接部署到静态托管服务。
24
+
25
+ ### 预览生产版本
26
+
27
+ ```bash
28
+ coze start
29
+ ```
30
+
31
+ 在本地启动一个静态服务器,预览生产构建的效果。
32
+
33
+ ## 项目结构
34
+
35
+ ```
36
+ ├── index.html # HTML 入口文件
37
+ ├── src/
38
+ │ ├── index.ts # 应用入口(初始化)
39
+ │ ├── main.ts # 主逻辑文件
40
+ │ └── index.css # 全局样式(包含 Tailwind 指令)
41
+ ├── vite.config.ts # Vite 配置
42
+ ├── tailwind.config.ts # Tailwind CSS 配置
43
+ └── tsconfig.json # TypeScript 配置
44
+ ```
45
+
46
+ ## 核心开发规范
47
+
48
+ ### 1. 样式开发
49
+
50
+ **使用 Tailwind CSS**
51
+
52
+ 本项目使用 Tailwind CSS 进行样式开发,支持亮色/暗色模式自动切换。
53
+
54
+ ```typescript
55
+ // 使用 Tailwind 工具类
56
+ app.innerHTML = `
57
+ <div class="flex items-center justify-center min-h-screen bg-white dark:bg-black">
58
+ <h1 class="text-4xl font-bold text-black dark:text-white">
59
+ Hello World
60
+ </h1>
61
+ </div>
62
+ `;
63
+ ```
64
+
65
+ **主题变量**
66
+
67
+ 主题变量定义在 `src/index.css` 中,支持自动适配系统主题:
68
+
69
+ ```css
70
+ :root {
71
+ --background: #ffffff;
72
+ --foreground: #171717;
73
+ }
74
+
75
+ @media (prefers-color-scheme: dark) {
76
+ :root {
77
+ --background: #0a0a0a;
78
+ --foreground: #ededed;
79
+ }
80
+ }
81
+ ```
82
+
83
+ **常用 Tailwind 类名**
84
+
85
+ - 布局:`flex`, `grid`, `container`, `mx-auto`
86
+ - 间距:`p-4`, `m-4`, `gap-4`, `space-x-4`
87
+ - 颜色:`bg-white`, `text-black`, `dark:bg-black`, `dark:text-white`
88
+ - 排版:`text-lg`, `font-bold`, `leading-8`, `tracking-tight`
89
+ - 响应式:`sm:`, `md:`, `lg:`, `xl:`
90
+
91
+ ### 2. 依赖管理
92
+
93
+ **必须使用 pnpm 管理依赖**
94
+
95
+ ```bash
96
+ # ✅ 安装依赖
97
+ pnpm install
98
+
99
+ # ✅ 添加新依赖
100
+ pnpm add package-name
101
+
102
+ # ✅ 添加开发依赖
103
+ pnpm add -D package-name
104
+
105
+ # ❌ 禁止使用 npm 或 yarn
106
+ # npm install # 错误!
107
+ # yarn add # 错误!
108
+ ```
109
+
110
+ 项目已配置 `preinstall` 脚本,使用其他包管理器会报错。
111
+
112
+ ### 3. TypeScript 开发
113
+
114
+ **类型安全**
115
+
116
+ 充分利用 TypeScript 的类型系统,确保代码质量:
117
+
118
+ ```typescript
119
+ // 定义接口
120
+ interface User {
121
+ id: number;
122
+ name: string;
123
+ email: string;
124
+ }
125
+
126
+ // 使用类型
127
+ function createUser(data: User): void {
128
+ console.log(`Creating user: ${data.name}`);
129
+ }
130
+
131
+ // DOM 操作类型推断
132
+ const button = document.querySelector<HTMLButtonElement>('#my-button');
133
+ if (button) {
134
+ button.addEventListener('click', () => {
135
+ console.log('Button clicked');
136
+ });
137
+ }
138
+ ```
139
+
140
+ **避免 any 类型**
141
+
142
+ 尽量避免使用 `any`,使用 `unknown` 或具体类型:
143
+
144
+ ```typescript
145
+ // ❌ 不推荐
146
+ function process(data: any) { }
147
+
148
+ // ✅ 推荐
149
+ function process(data: unknown) {
150
+ if (typeof data === 'string') {
151
+ console.log(data.toUpperCase());
152
+ }
153
+ }
154
+ ```
155
+
156
+ ## 常见开发场景
157
+
158
+ ### 添加新页面
159
+
160
+ 本项目是单页应用(SPA),如需多页面:
161
+
162
+ 1. 在 `src/` 下创建新的 `.ts` 文件
163
+ 2. 在 `vite.config.ts` 中配置多入口
164
+ 3. 创建对应的 `.html` 文件
165
+
166
+ ### DOM 操作
167
+
168
+ ```typescript
169
+ // 获取元素
170
+ const app = document.getElementById('app');
171
+ const button = document.querySelector<HTMLButtonElement>('.my-button');
172
+
173
+ // 动态创建元素
174
+ const div = document.createElement('div');
175
+ div.className = 'flex items-center gap-4';
176
+ div.textContent = 'Hello World';
177
+ app?.appendChild(div);
178
+
179
+ // 事件监听
180
+ button?.addEventListener('click', (e) => {
181
+ console.log('Clicked', e);
182
+ });
183
+ ```
184
+
185
+ ### 数据获取
186
+
187
+ ```typescript
188
+ // Fetch API
189
+ async function fetchData() {
190
+ try {
191
+ const response = await fetch('https://api.example.com/data');
192
+ const data = await response.json();
193
+ return data;
194
+ } catch (error) {
195
+ console.error('Failed to fetch data:', error);
196
+ }
197
+ }
198
+
199
+ // 使用数据
200
+ fetchData().then(data => {
201
+ console.log(data);
202
+ });
203
+ ```
204
+
205
+ ### 环境变量
206
+
207
+ 在 `.env` 文件中定义环境变量(需以 `VITE_` 开头):
208
+
209
+ ```bash
210
+ VITE_API_URL=https://api.example.com
211
+ ```
212
+
213
+ 在代码中使用:
214
+
215
+ ```typescript
216
+ const apiUrl = import.meta.env.VITE_API_URL;
217
+ console.log(apiUrl); // https://api.example.com
218
+ ```
219
+
220
+ ## 技术栈
221
+
222
+ - **构建工具**: Vite 6.x
223
+ - **语言**: TypeScript 5.x
224
+ - **样式**: Tailwind CSS 3.x
225
+ - **包管理器**: pnpm 9+
226
+
227
+ ## 参考文档
228
+
229
+ - [Vite 官方文档](https://cn.vitejs.dev/)
230
+ - [TypeScript 官方文档](https://www.typescriptlang.org/zh/docs/)
231
+ - [Tailwind CSS 文档](https://tailwindcss.com/docs)
232
+
233
+ ## 重要提示
234
+
235
+ 1. **必须使用 pnpm** 作为包管理器
236
+ 2. **使用 TypeScript** 进行类型安全开发,避免使用 `any`
237
+ 3. **使用 Tailwind CSS** 进行样式开发,支持响应式和暗色模式
238
+ 4. **环境变量必须以 `VITE_` 开头** 才能在客户端代码中访问
239
+ 5. **开发时使用 `coze dev`**,支持热更新和快速刷新
@@ -0,0 +1,66 @@
1
+ # Dependencies
2
+ node_modules/
3
+ .pnp
4
+ .pnp.js
5
+
6
+ # Production build
7
+ dist/
8
+ build/
9
+ out/
10
+
11
+ # Testing
12
+ coverage/
13
+ *.lcov
14
+ .nyc_output
15
+
16
+ # Environment variables
17
+ .env
18
+ .env.local
19
+ .env.development.local
20
+ .env.test.local
21
+ .env.production.local
22
+
23
+ # Logs
24
+ logs/
25
+ *.log
26
+ npm-debug.log*
27
+ yarn-debug.log*
28
+ yarn-error.log*
29
+ pnpm-debug.log*
30
+ lerna-debug.log*
31
+
32
+ # Runtime data
33
+ pids
34
+ *.pid
35
+ *.seed
36
+ *.pid.lock
37
+
38
+ # Cache
39
+ .cache/
40
+ .eslintcache
41
+ .stylelintcache
42
+
43
+ # Editor directories and files
44
+ .vscode/*
45
+ !.vscode/extensions.json
46
+ !.vscode/settings.json
47
+ .idea/
48
+ *.suo
49
+ *.ntvs*
50
+ *.njsproj
51
+ *.sln
52
+ *.sw?
53
+
54
+ # OS files
55
+ .DS_Store
56
+ .DS_Store?
57
+ ._*
58
+ Thumbs.db
59
+
60
+ # TypeScript
61
+ *.tsbuildinfo
62
+
63
+ # Vite
64
+ .vite/
65
+
66
+ .coze-logs
@@ -0,0 +1,23 @@
1
+ loglevel=error
2
+ registry=https://registry.npmmirror.com
3
+
4
+ strictStorePkgContentCheck=false
5
+ verifyStoreIntegrity=false
6
+
7
+ # 网络优化
8
+ network-concurrency=16
9
+ fetch-retries=3
10
+ fetch-timeout=60000
11
+
12
+ # 严格使用 peer dependencies
13
+ strict-peer-dependencies=false
14
+
15
+ # 自动生成 lockfile
16
+ auto-install-peers=true
17
+
18
+ # lockfile 配置
19
+ lockfile=true
20
+ prefer-frozen-lockfile=true
21
+
22
+ # 如果 lockfile 存在但过期,更新而不是失败
23
+ resolution-mode=highest
@@ -0,0 +1,9 @@
1
+ import eslint from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ import { defineConfig, globalIgnores } from 'eslint/config';
4
+
5
+ export default defineConfig([
6
+ eslint.configs.recommended,
7
+ ...tseslint.configs.recommended,
8
+ globalIgnores(['dist/**', 'node_modules/**']),
9
+ ]);
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="description" content="扣子编程,你的 AI 开发伙伴已就位" />
7
+ <title>扣子编程 - AI 开发伙伴</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/index.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "<%= appName %>",
3
+ "version": "1.0.0",
4
+ "description": "Vanilla TypeScript application with Vite (HTML + CSS + TS)",
5
+ "scripts": {
6
+ "build": "bash ./scripts/build.sh",
7
+ "dev": "bash ./scripts/dev.sh",
8
+ "preinstall": "npx only-allow pnpm",
9
+ "lint": "eslint",
10
+ "start": "bash ./scripts/start.sh",
11
+ "ts-check": "tsc -p tsconfig.json"
12
+ },
13
+ "devDependencies": {
14
+ "autoprefixer": "^10.4.20",
15
+ "coze-coding-dev-sdk": "^0.7.0",
16
+ "eslint": "^9",
17
+ "only-allow": "^1.2.2",
18
+ "postcss": "^8.4.49",
19
+ "tailwindcss": "^3.4.17",
20
+ "typescript": "^5.6.0",
21
+ "typescript-eslint": "^8",
22
+ "vite": "^7.2.4"
23
+ },
24
+ "packageManager": "pnpm@9.0.0",
25
+ "engines": {
26
+ "pnpm": ">=9.0.0"
27
+ }
28
+ }