@coze-arch/cli 0.0.1-alpha.1fb1dc → 0.0.1-alpha.209402

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 (240) hide show
  1. package/README.md +1 -0
  2. package/lib/__templates__/expo/.coze +7 -2
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
  6. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
  7. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  8. package/lib/__templates__/expo/README.md +68 -7
  9. package/lib/__templates__/expo/_gitignore +1 -1
  10. package/lib/__templates__/expo/_npmrc +3 -4
  11. package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
  12. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  13. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  14. package/lib/__templates__/expo/client/app.config.ts +76 -0
  15. package/lib/__templates__/expo/client/components/Screen.tsx +3 -19
  16. package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
  17. package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
  18. package/lib/__templates__/expo/client/constants/theme.ts +117 -58
  19. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  20. package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
  21. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  22. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  23. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  24. package/lib/__templates__/expo/client/metro.config.js +124 -0
  25. package/lib/__templates__/expo/client/package.json +95 -0
  26. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  27. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  28. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +11 -10
  29. package/lib/__templates__/expo/client/tsconfig.json +24 -0
  30. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  31. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  32. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  33. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  34. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  35. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  36. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  37. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  38. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  39. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  40. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  41. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  42. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  43. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  44. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  45. package/lib/__templates__/expo/package.json +16 -103
  46. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  47. package/lib/__templates__/expo/pnpm-lock.yaml +1437 -3171
  48. package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
  49. package/lib/__templates__/expo/server/build.js +21 -0
  50. package/lib/__templates__/expo/server/package.json +34 -0
  51. package/lib/__templates__/expo/server/src/index.ts +20 -0
  52. package/lib/__templates__/expo/server/tsconfig.json +24 -0
  53. package/lib/__templates__/expo/template.config.js +57 -0
  54. package/lib/__templates__/expo/tsconfig.json +1 -24
  55. package/lib/__templates__/native-static/.coze +11 -0
  56. package/lib/__templates__/native-static/index.html +33 -0
  57. package/lib/__templates__/native-static/styles/main.css +136 -0
  58. package/lib/__templates__/native-static/template.config.js +22 -0
  59. package/lib/__templates__/nextjs/.babelrc +15 -0
  60. package/lib/__templates__/nextjs/.coze +1 -0
  61. package/lib/__templates__/nextjs/AGENTS.md +54 -0
  62. package/lib/__templates__/nextjs/README.md +5 -0
  63. package/lib/__templates__/nextjs/_npmrc +1 -0
  64. package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
  65. package/lib/__templates__/nextjs/next.config.ts +11 -0
  66. package/lib/__templates__/nextjs/package.json +10 -2
  67. package/lib/__templates__/nextjs/pnpm-lock.yaml +3488 -1569
  68. package/lib/__templates__/nextjs/scripts/build.sh +4 -1
  69. package/lib/__templates__/nextjs/scripts/dev.sh +15 -28
  70. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  71. package/lib/__templates__/nextjs/scripts/start.sh +7 -1
  72. package/lib/__templates__/nextjs/src/app/globals.css +109 -89
  73. package/lib/__templates__/nextjs/src/app/layout.tsx +23 -32
  74. package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
  75. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  76. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  77. package/lib/__templates__/nextjs/src/server.ts +35 -0
  78. package/lib/__templates__/nextjs/template.config.js +67 -2
  79. package/lib/__templates__/nextjs/tsconfig.json +1 -1
  80. package/lib/__templates__/nuxt-vue/.coze +12 -0
  81. package/lib/__templates__/nuxt-vue/AGENTS.md +42 -0
  82. package/lib/__templates__/nuxt-vue/README.md +73 -0
  83. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  84. package/lib/__templates__/nuxt-vue/_npmrc +23 -0
  85. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  86. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  87. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  88. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  89. package/lib/__templates__/nuxt-vue/package.json +35 -0
  90. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  91. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  92. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  93. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  94. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  95. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  96. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  97. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  98. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  99. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  100. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  101. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  102. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  103. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  104. package/lib/__templates__/taro/.coze +14 -0
  105. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  106. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  107. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  108. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  109. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  110. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  111. package/lib/__templates__/taro/README.md +763 -0
  112. package/lib/__templates__/taro/_gitignore +40 -0
  113. package/lib/__templates__/taro/_npmrc +18 -0
  114. package/lib/__templates__/taro/babel.config.js +12 -0
  115. package/lib/__templates__/taro/config/dev.ts +9 -0
  116. package/lib/__templates__/taro/config/index.ts +238 -0
  117. package/lib/__templates__/taro/config/prod.ts +34 -0
  118. package/lib/__templates__/taro/eslint.config.mjs +135 -0
  119. package/lib/__templates__/taro/key/private.appid.key +0 -0
  120. package/lib/__templates__/taro/package.json +112 -0
  121. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  122. package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
  123. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  124. package/lib/__templates__/taro/project.config.json +15 -0
  125. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  126. package/lib/__templates__/taro/server/package.json +40 -0
  127. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  128. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  129. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  130. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  131. package/lib/__templates__/taro/server/src/main.ts +49 -0
  132. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  133. package/lib/__templates__/taro/src/app.config.ts +11 -0
  134. package/lib/__templates__/taro/src/app.css +156 -0
  135. package/lib/__templates__/taro/src/app.tsx +9 -0
  136. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  137. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  138. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  139. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  140. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  141. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  142. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  143. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  144. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  145. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  146. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  147. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  148. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  149. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  150. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  151. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  152. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  153. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  154. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  155. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  156. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  157. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  158. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  159. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  160. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  161. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  162. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  163. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
  164. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  165. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  166. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  167. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  168. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  169. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  170. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  171. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  172. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  173. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  174. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  175. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  176. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  177. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  178. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  179. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  180. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  181. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  182. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  183. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  184. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  185. package/lib/__templates__/taro/src/index.html +39 -0
  186. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  187. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  188. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  189. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  190. package/lib/__templates__/taro/src/network.ts +39 -0
  191. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  192. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  193. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  194. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  195. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  196. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
  197. package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
  198. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  199. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  200. package/lib/__templates__/taro/template.config.js +68 -0
  201. package/lib/__templates__/taro/tsconfig.json +29 -0
  202. package/lib/__templates__/taro/types/global.d.ts +32 -0
  203. package/lib/__templates__/templates.json +136 -36
  204. package/lib/__templates__/vite/.coze +1 -0
  205. package/lib/__templates__/vite/AGENTS.md +41 -0
  206. package/lib/__templates__/vite/README.md +190 -11
  207. package/lib/__templates__/vite/_gitignore +1 -0
  208. package/lib/__templates__/vite/_npmrc +1 -0
  209. package/lib/__templates__/vite/eslint.config.mjs +14 -0
  210. package/lib/__templates__/vite/package.json +23 -3
  211. package/lib/__templates__/vite/pnpm-lock.yaml +2509 -293
  212. package/lib/__templates__/vite/scripts/build.sh +4 -1
  213. package/lib/__templates__/vite/scripts/dev.sh +16 -28
  214. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  215. package/lib/__templates__/vite/scripts/start.sh +9 -3
  216. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  217. package/lib/__templates__/vite/server/server.ts +65 -0
  218. package/lib/__templates__/vite/server/vite.ts +67 -0
  219. package/lib/__templates__/vite/src/main.ts +17 -48
  220. package/lib/__templates__/vite/template.config.js +78 -8
  221. package/lib/__templates__/vite/tsconfig.json +4 -3
  222. package/lib/__templates__/vite/vite.config.ts +8 -3
  223. package/lib/cli.js +1711 -298
  224. package/package.json +17 -5
  225. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -116
  226. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -239
  227. package/lib/__templates__/expo/app.json +0 -63
  228. package/lib/__templates__/expo/babel.config.js +0 -9
  229. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
  230. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
  231. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
  232. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  233. package/lib/__templates__/expo/client/index.js +0 -12
  234. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -51
  235. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  236. package/lib/__templates__/expo/metro.config.js +0 -53
  237. package/lib/__templates__/expo/src/index.ts +0 -12
  238. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  239. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  240. /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
@@ -0,0 +1,35 @@
1
+ import { createServer } from 'http';
2
+ import { parse } from 'url';
3
+ import next from 'next';
4
+
5
+ const dev = process.env.COZE_PROJECT_ENV !== 'PROD';
6
+ const hostname = process.env.HOSTNAME || 'localhost';
7
+ const port = parseInt(process.env.PORT || '<%= port %>', 10);
8
+
9
+ // Create Next.js app
10
+ const app = next({ dev, hostname, port });
11
+ const handle = app.getRequestHandler();
12
+
13
+ app.prepare().then(() => {
14
+ const server = createServer(async (req, res) => {
15
+ try {
16
+ const parsedUrl = parse(req.url!, true);
17
+ await handle(req, res, parsedUrl);
18
+ } catch (err) {
19
+ console.error('Error occurred handling', req.url, err);
20
+ res.statusCode = 500;
21
+ res.end('Internal server error');
22
+ }
23
+ });
24
+ server.once('error', err => {
25
+ console.error(err);
26
+ process.exit(1);
27
+ });
28
+ server.listen(port, () => {
29
+ console.log(
30
+ `> Server listening at http://${hostname}:${port} as ${
31
+ dev ? 'development' : process.env.COZE_PROJECT_ENV
32
+ }`,
33
+ );
34
+ });
35
+ });
@@ -1,11 +1,21 @@
1
1
 
2
2
 
3
+ import { spawn } from 'child_process';
4
+ import { resolve, join, basename } from 'path';
5
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
3
6
 
4
7
 
5
8
 
6
9
 
7
10
 
8
11
 
12
+ const description = `Next.js(复杂项目):\`coze init \${COZE_WORKSPACE_PATH} --template nextjs\`
13
+ - 适用:全栈应用、复杂多页面等复杂项目
14
+ - 使用默认nextjs项目规范
15
+ - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
16
+ - **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
17
+ - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
18
+
9
19
  export const paramsSchema = {
10
20
  type: 'object',
11
21
  properties: {
@@ -29,6 +39,7 @@ export const paramsSchema = {
29
39
  };
30
40
 
31
41
  const config = {
42
+ description: description,
32
43
  paramsSchema,
33
44
 
34
45
  // 显式定义默认参数,确保在渲染时可用
@@ -42,13 +53,67 @@ const config = {
42
53
  return context;
43
54
  },
44
55
 
45
- onAfterRender: async (context, outputPath) => {
56
+ onAfterRender: async (_context, outputPath) => {
46
57
  console.log(`\nProject created at: ${outputPath}`);
47
58
  console.log('\nConfiguration:');
48
59
  console.log(' - Framework: Next.js');
49
60
  console.log(' - TypeScript: enabled');
50
61
  console.log(' - App Router: enabled');
51
- console.log(` - Port: ${context.port}`);
62
+ console.log(` - Port: ${_context.port}`);
63
+ },
64
+
65
+ onComplete: async (_context, outputPath) => {
66
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
67
+ if (process.env.NODE_ENV === 'test') {
68
+ console.log('⊘ Skipping dependency update in test environment');
69
+ return;
70
+ }
71
+
72
+ const cmd = 'pnpm';
73
+ const args = ['update', 'coze-coding-dev-sdk@^0.7.0'];
74
+ console.log(
75
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
76
+ );
77
+
78
+ try {
79
+ const projectRoot = resolve(outputPath);
80
+
81
+ // Determine log directory
82
+ const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
83
+ mkdirSync(logDir, { recursive: true });
84
+
85
+ // Use project name in log file to avoid conflicts
86
+ const projectName = basename(projectRoot);
87
+ const logFile = join(logDir, `${projectName}-init.log`);
88
+
89
+ // Write log header
90
+ const timestamp = new Date().toISOString();
91
+ appendFileSync(
92
+ logFile,
93
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
94
+ );
95
+
96
+ // Open log file for appending
97
+ const logFd = openSync(logFile, 'a');
98
+
99
+ // Spawn in detached mode
100
+ const child = spawn(cmd, args, {
101
+ cwd: projectRoot,
102
+ detached: true,
103
+ stdio: ['ignore', logFd, logFd],
104
+ });
105
+
106
+ child.unref();
107
+ closeSync(logFd);
108
+
109
+ console.log(
110
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
111
+ );
112
+ console.log(` Log file: ${logFile}`);
113
+ } catch (error) {
114
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
115
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
116
+ }
52
117
  },
53
118
  };
54
119
 
@@ -30,5 +30,5 @@
30
30
  ".next/dev/types/**/*.ts",
31
31
  "**/*.mts"
32
32
  ],
33
- "exclude": ["node_modules"]
33
+ "exclude": ["node_modules", "dist"]
34
34
  }
@@ -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,42 @@
1
+ # 项目上下文
2
+
3
+ ## 技术栈
4
+
5
+ - **核心**: Nuxt 4, Vue 3, TypeScript
6
+ - **UI**: Tailwind CSS
7
+
8
+ ## 目录结构
9
+
10
+ ```
11
+ ├── app/ # 页面路由与布局
12
+ │ ├── pages/ # 页面组件
13
+ │ └── app.vue # 根组件
14
+ ├── assets/ # 静态资源
15
+ │ └── css/ # 全局样式
16
+ ├── public/ # 公共静态资源
17
+ ├── scripts/ # 构建与启动脚本
18
+ │ ├── build.sh # 构建脚本
19
+ │ ├── dev.sh # 开发环境启动脚本
20
+ │ ├── prepare.sh # 预处理脚本
21
+ │ └── start.sh # 生产环境启动脚本
22
+ ├── server/ # 服务端逻辑
23
+ │ ├── api/ # API 路由
24
+ │ ├── middleware/ # 中间件
25
+ │ └── routes/ # 服务端路由
26
+ ├── nuxt.config.ts # Nuxt 配置
27
+ ├── package.json # 项目依赖管理
28
+ └── tsconfig.json # TypeScript 配置
29
+ ```
30
+
31
+ ## 包管理规范
32
+
33
+ **仅允许使用 pnpm** 作为包管理器,**严禁使用 npm 或 yarn**。
34
+ **常用命令**:
35
+ - 安装依赖:`pnpm add <package>`
36
+ - 安装开发依赖:`pnpm add -D <package>`
37
+ - 安装所有依赖:`pnpm install`
38
+ - 移除依赖:`pnpm remove <package>`
39
+
40
+ ## 开发规范
41
+
42
+ - 使用 Tailwind CSS 进行样式开发
@@ -0,0 +1,73 @@
1
+ # <%= appName %>
2
+
3
+ Nuxt.js full-stack application with server-side API capabilities, Vue 3, and Vite.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Nuxt 4**: Latest Nuxt.js framework
8
+ - ⚡️ **Vite**: Lightning-fast development and build
9
+ - 🎨 **Vue 3**: Composition API and modern Vue features
10
+ - 🔥 **Server API**: Built-in server routes for backend logic
11
+ - 📁 **File-based Routing**: Automatic routing from file structure
12
+ - 🔧 **TypeScript**: Full TypeScript support
13
+ - 🛠️ **DevTools**: Nuxt DevTools enabled
14
+
15
+ ## Setup
16
+
17
+ This project uses pnpm as the package manager. Make sure to install dependencies:
18
+
19
+ ```bash
20
+ pnpm install
21
+ ```
22
+
23
+ ## Development
24
+
25
+ Start the development server on `http://localhost:<%= port %>`:
26
+
27
+ ```bash
28
+ pnpm dev
29
+ ```
30
+
31
+ The server will automatically restart when you make changes to your code.
32
+
33
+ ## Production
34
+
35
+ Build the application for production:
36
+
37
+ ```bash
38
+ pnpm build
39
+ ```
40
+
41
+ Start the production server:
42
+
43
+ ```bash
44
+ pnpm start
45
+ ```
46
+
47
+ ## Project Structure
48
+
49
+ ```
50
+ <%= appName %>/
51
+ ├── app/ # Application source code
52
+ │ ├── app.vue # Root component
53
+ │ ├── components/ # Vue components
54
+ │ └── layouts/ # Layout components
55
+ ├── server/ # Server-side code (optional)
56
+ │ ├── api/ # API endpoints
57
+ │ └── middleware/ # Server middleware
58
+ ├── public/ # Static assets
59
+ ├── assets/ # CSS and other assets
60
+ ├── nuxt.config.ts # Nuxt configuration
61
+ └── package.json # Project dependencies
62
+ ```
63
+
64
+ ## Server API (Optional)
65
+
66
+ You can add server API by creating files in `server/api/` directory. See [server/README.md](./server/README.md) for more details.
67
+
68
+ ## Learn More
69
+
70
+ - [Nuxt Documentation](https://nuxt.com/docs)
71
+ - [Vue 3 Documentation](https://vuejs.org/)
72
+ - [Vite Documentation](https://vitejs.dev/)
73
+ - [Deployment Guide](https://nuxt.com/docs/getting-started/deployment)
@@ -0,0 +1,24 @@
1
+ # Nuxt dev/build outputs
2
+ .output
3
+ .data
4
+ .nuxt
5
+ .nitro
6
+ .cache
7
+ dist
8
+
9
+ # Node dependencies
10
+ node_modules
11
+
12
+ # Logs
13
+ logs
14
+ *.log
15
+
16
+ # Misc
17
+ .DS_Store
18
+ .fleet
19
+ .idea
20
+
21
+ # Local env files
22
+ .env
23
+ .env.*
24
+ !.env.example
@@ -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,6 @@
1
+ <template>
2
+ <div>
3
+ <NuxtRouteAnnouncer />
4
+ <NuxtPage />
5
+ </div>
6
+ </template>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="flex min-h-screen items-center justify-center">
3
+ <main class="flex w-full max-w-3xl flex-col items-center justify-center px-16 py-32">
4
+ <div class="flex flex-col items-center gap-4">
5
+ <img
6
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
7
+ alt="扣子编程 Logo"
8
+ width="156"
9
+ height="130"
10
+ style="width: 156px; height: 130px; object-fit: contain"
11
+ />
12
+ <div class="flex flex-col items-center gap-2 text-center">
13
+ <h1 class="max-w-xl text-base font-semibold leading-tight tracking-tight">
14
+ 应用开发中
15
+ </h1>
16
+ <p class="max-w-2xl text-sm leading-8 opacity-70">
17
+ 请稍后,页面即将呈现
18
+ </p>
19
+ </div>
20
+ </div>
21
+ </main>
22
+ </div>
23
+ </template>
@@ -0,0 +1,24 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ :root {
6
+ --background: #ffffff;
7
+ --foreground: #000000;
8
+ --muted-foreground: #6b7280;
9
+ }
10
+
11
+ @media (prefers-color-scheme: dark) {
12
+ :root {
13
+ --background: #000000;
14
+ --foreground: #ffffff;
15
+ --muted-foreground: #9ca3af;
16
+ }
17
+ }
18
+
19
+ body {
20
+ margin: 0;
21
+ padding: 0;
22
+ background: var(--background);
23
+ color: var(--foreground);
24
+ }
@@ -0,0 +1,116 @@
1
+ // https://nuxt.com/docs/api/configuration/nuxt-config
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, resolve } from 'path';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
7
+
8
+ export default defineNuxtConfig({
9
+ compatibilityDate: '2025-07-15',
10
+ devtools: { enabled: true },
11
+ telemetry: false,
12
+
13
+ // App head configuration
14
+ app: {
15
+ head: {
16
+ title: '新应用 | 扣子编程',
17
+ titleTemplate: '%s | 扣子编程',
18
+ meta: [
19
+ { charset: 'utf-8' },
20
+ { name: 'viewport', content: 'width=device-width, initial-scale=1' },
21
+ {
22
+ name: 'description',
23
+ content:
24
+ '扣子编程是一款一站式云端 Vibe Coding 开发平台。通过对话轻松构建智能体、工作流和网站,实现从创意到上线的无缝衔接。',
25
+ },
26
+ {
27
+ name: 'keywords',
28
+ content:
29
+ '扣子编程,Coze Code,Vibe Coding,AI 编程,智能体搭建,工作流搭建,网站搭建,网站部署,全栈开发,AI 工程师',
30
+ },
31
+ { name: 'author', content: 'Coze Code Team' },
32
+ { name: 'generator', content: 'Coze Code' },
33
+ // Open Graph
34
+ { property: 'og:title', content: '扣子编程 | 你的 AI 工程师已就位' },
35
+ {
36
+ property: 'og:description',
37
+ content:
38
+ '我正在使用扣子编程 Vibe Coding,让创意瞬间上线。告别拖拽,拥抱心流。',
39
+ },
40
+ { property: 'og:url', content: 'https://code.coze.cn' },
41
+ { property: 'og:site_name', content: '扣子编程' },
42
+ { property: 'og:locale', content: 'zh_CN' },
43
+ { property: 'og:type', content: 'website' },
44
+ // Robots
45
+ { name: 'robots', content: 'index, follow' },
46
+ ],
47
+ link: [{ rel: 'canonical', href: 'https://code.coze.cn' }],
48
+ htmlAttrs: {
49
+ lang: 'zh-CN',
50
+ },
51
+ },
52
+ },
53
+
54
+ // Nuxt modules
55
+ modules: ['@nuxt/image', '@nuxtjs/tailwindcss'],
56
+
57
+ // Global CSS
58
+ css: [resolve(__dirname, 'assets/css/main.css')],
59
+
60
+ // Development server configuration
61
+ devServer: {
62
+ port: parseInt(process.env.PORT || '<%= port %>', 10),
63
+ host: process.env.HOSTNAME || 'localhost',
64
+ },
65
+
66
+ // TypeScript configuration
67
+ typescript: {
68
+ strict: false,
69
+ typeCheck: false,
70
+ },
71
+
72
+ // Vite configuration (similar to Next.js allowedDevOrigins)
73
+ vite: {
74
+ server: {
75
+ host: '0.0.0.0',
76
+ cors: {
77
+ origin: ['*.dev.coze.site'],
78
+ credentials: true,
79
+ },
80
+ hmr: {
81
+ overlay: true,
82
+ path: '/hot/vite-hmr',
83
+ port: parseInt(process.env.HMR_PORT || '<%= hmrPort %>', 10),
84
+ clientPort: 443,
85
+ timeout: 30000,
86
+ },
87
+ },
88
+ },
89
+
90
+ // Image optimization (similar to Next.js images config)
91
+ // Using @nuxt/image module for image optimization
92
+ // https://image.nuxt.com/
93
+ image: {
94
+ domains: ['lf-coze-web-cdn.coze.cn'],
95
+ // Remote patterns configuration
96
+ remotePatterns: [
97
+ {
98
+ protocol: 'https',
99
+ hostname: 'lf-coze-web-cdn.coze.cn',
100
+ pathname: '/**',
101
+ },
102
+ ],
103
+ },
104
+
105
+ // Security headers (Content Security Policy)
106
+ nitro: {
107
+ routeRules: {
108
+ '/**': {
109
+ headers: {
110
+ 'Content-Security-Policy':
111
+ "img-src 'self' data: https://lf-coze-web-cdn.coze.cn;",
112
+ },
113
+ },
114
+ },
115
+ },
116
+ });
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "<%= appName %>",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "bash ./scripts/build.sh",
8
+ "dev": "bash ./scripts/dev.sh",
9
+ "generate": "nuxt generate",
10
+ "preinstall": "npx only-allow pnpm",
11
+ "preview": "nuxt preview",
12
+ "start": "bash ./scripts/start.sh"
13
+ },
14
+ "dependencies": {
15
+ "@nuxt/image": "^1.8.1",
16
+ "nuxt": "^4.3.1",
17
+ "tailwind-merge": "^2.6.0",
18
+ "vue": "^3.5.30",
19
+ "vue-router": "^4.6.4"
20
+ },
21
+ "devDependencies": {
22
+ "@nuxtjs/tailwindcss": "^6.14.0",
23
+ "@types/node": "^20",
24
+ "autoprefixer": "^10.4.20",
25
+ "coze-coding-dev-sdk": "^0.7.16",
26
+ "only-allow": "^1.2.2",
27
+ "postcss": "^8.4.49",
28
+ "tailwindcss": "^3.4.17",
29
+ "typescript": "^5"
30
+ },
31
+ "packageManager": "pnpm@9.0.0",
32
+ "engines": {
33
+ "pnpm": ">=9.0.0"
34
+ }
35
+ }