@coze-arch/cli 0.0.1-alpha.e772d9 → 0.0.1-alpha.e89608

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 (124) hide show
  1. package/README.md +1 -0
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +8 -5
  3. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +6 -5
  4. package/lib/__templates__/expo/client/components/Screen.tsx +2 -2
  5. package/lib/__templates__/expo/client/eslint.config.mjs +8 -1
  6. package/lib/__templates__/expo/client/metro.config.js +3 -0
  7. package/lib/__templates__/expo/client/package.json +35 -35
  8. package/lib/__templates__/expo/client/screens/demo/index.tsx +3 -3
  9. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +10 -10
  10. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  11. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  12. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  13. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  14. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  15. package/lib/__templates__/expo/package.json +1 -1
  16. package/lib/__templates__/expo/patches/{expo@54.0.32.patch → expo@54.0.33.patch} +3 -2
  17. package/lib/__templates__/expo/pnpm-lock.yaml +340 -1736
  18. package/lib/__templates__/expo/server/package.json +9 -7
  19. package/lib/__templates__/expo/server/src/index.ts +1 -0
  20. package/lib/__templates__/expo/template.config.js +56 -0
  21. package/lib/__templates__/native-static/.coze +11 -0
  22. package/lib/__templates__/native-static/index.html +33 -0
  23. package/lib/__templates__/native-static/styles/main.css +136 -0
  24. package/lib/__templates__/native-static/template.config.js +22 -0
  25. package/lib/__templates__/nextjs/README.md +5 -0
  26. package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
  27. package/lib/__templates__/nextjs/next.config.ts +1 -2
  28. package/lib/__templates__/nextjs/package.json +15 -6
  29. package/lib/__templates__/nextjs/pnpm-lock.yaml +1859 -736
  30. package/lib/__templates__/nextjs/scripts/build.sh +4 -1
  31. package/lib/__templates__/nextjs/scripts/dev.sh +1 -2
  32. package/lib/__templates__/nextjs/scripts/start.sh +1 -1
  33. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -1
  34. package/lib/__templates__/nextjs/src/app/page.tsx +18 -60
  35. package/lib/__templates__/nextjs/src/server.ts +35 -0
  36. package/lib/__templates__/nextjs/template.config.js +49 -14
  37. package/lib/__templates__/nextjs/tsconfig.json +1 -1
  38. package/lib/__templates__/nuxt-vue/.coze +12 -0
  39. package/lib/__templates__/nuxt-vue/README.md +73 -0
  40. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  41. package/lib/__templates__/nuxt-vue/_npmrc +23 -0
  42. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  43. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  44. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  45. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  46. package/lib/__templates__/nuxt-vue/package.json +35 -0
  47. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  48. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  49. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  50. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  51. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  52. package/lib/__templates__/nuxt-vue/scripts/dev.sh +31 -0
  53. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  54. package/lib/__templates__/nuxt-vue/scripts/start.sh +15 -0
  55. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  56. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  57. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  58. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  59. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  60. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  61. package/lib/__templates__/taro/.coze +14 -0
  62. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  63. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  64. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  65. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  66. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  67. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
  68. package/lib/__templates__/taro/README.md +751 -0
  69. package/lib/__templates__/taro/_gitignore +40 -0
  70. package/lib/__templates__/taro/_npmrc +18 -0
  71. package/lib/__templates__/taro/babel.config.js +12 -0
  72. package/lib/__templates__/taro/config/dev.ts +9 -0
  73. package/lib/__templates__/taro/config/index.ts +223 -0
  74. package/lib/__templates__/taro/config/prod.ts +34 -0
  75. package/lib/__templates__/taro/eslint.config.mjs +80 -0
  76. package/lib/__templates__/taro/key/private.appid.key +0 -0
  77. package/lib/__templates__/taro/package.json +107 -0
  78. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  79. package/lib/__templates__/taro/pnpm-lock.yaml +23100 -0
  80. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  81. package/lib/__templates__/taro/project.config.json +15 -0
  82. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  83. package/lib/__templates__/taro/server/package.json +40 -0
  84. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  85. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  86. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  87. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  88. package/lib/__templates__/taro/server/src/main.ts +49 -0
  89. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  90. package/lib/__templates__/taro/src/app.config.ts +11 -0
  91. package/lib/__templates__/taro/src/app.css +52 -0
  92. package/lib/__templates__/taro/src/app.tsx +9 -0
  93. package/lib/__templates__/taro/src/index.html +39 -0
  94. package/lib/__templates__/taro/src/network.ts +39 -0
  95. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  96. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  97. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  98. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  99. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  100. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +201 -0
  101. package/lib/__templates__/taro/src/presets/h5-styles.ts +142 -0
  102. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  103. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  104. package/lib/__templates__/taro/template.config.js +68 -0
  105. package/lib/__templates__/taro/tsconfig.json +29 -0
  106. package/lib/__templates__/taro/types/global.d.ts +32 -0
  107. package/lib/__templates__/templates.json +75 -0
  108. package/lib/__templates__/vite/README.md +189 -11
  109. package/lib/__templates__/vite/_gitignore +1 -0
  110. package/lib/__templates__/vite/eslint.config.mjs +6 -1
  111. package/lib/__templates__/vite/package.json +20 -3
  112. package/lib/__templates__/vite/pnpm-lock.yaml +944 -1551
  113. package/lib/__templates__/vite/scripts/build.sh +4 -1
  114. package/lib/__templates__/vite/scripts/dev.sh +2 -2
  115. package/lib/__templates__/vite/scripts/start.sh +3 -3
  116. package/lib/__templates__/vite/server/index.ts +57 -0
  117. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  118. package/lib/__templates__/vite/server/vite.ts +79 -0
  119. package/lib/__templates__/vite/src/main.ts +17 -47
  120. package/lib/__templates__/vite/template.config.js +49 -14
  121. package/lib/__templates__/vite/tsconfig.json +4 -3
  122. package/lib/__templates__/vite/vite.config.ts +1 -0
  123. package/lib/cli.js +471 -173
  124. package/package.json +7 -3
@@ -8,7 +8,10 @@ cd "${COZE_WORKSPACE_PATH}"
8
8
  echo "Installing dependencies..."
9
9
  pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
10
 
11
- echo "Building the project..."
11
+ echo "Building the Next.js project..."
12
12
  npx next build
13
13
 
14
+ echo "Bundling server with tsup..."
15
+ npx tsup src/server.ts --format cjs --platform node --target node20 --outDir dist --no-splitting --no-minify
16
+
14
17
  echo "Build completed successfully!"
@@ -3,7 +3,6 @@ set -Eeuo pipefail
3
3
 
4
4
  PORT=<%= port %>
5
5
  COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
- NODE_ENV=development
7
6
  DEPLOY_RUN_PORT=<%= port %>
8
7
 
9
8
  cd "${COZE_WORKSPACE_PATH}"
@@ -30,4 +29,4 @@ echo "Clearing port ${PORT} before start."
30
29
  kill_port_if_listening
31
30
  echo "Starting HTTP service on port ${PORT} for dev..."
32
31
 
33
- npx next dev --webpack --port $PORT
32
+ PORT=$PORT npx tsx watch src/server.ts
@@ -8,7 +8,7 @@ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-$PORT}"
8
8
  start_service() {
9
9
  cd "${COZE_WORKSPACE_PATH}"
10
10
  echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
11
- npx next start --port ${DEPLOY_RUN_PORT}
11
+ PORT=${DEPLOY_RUN_PORT} node dist/server.js
12
12
  }
13
13
 
14
14
  echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
@@ -61,7 +61,7 @@ export default function RootLayout({
61
61
  }: Readonly<{
62
62
  children: React.ReactNode;
63
63
  }>) {
64
- const isDev = process.env.NODE_ENV === 'development';
64
+ const isDev = process.env.COZE_PROJECT_ENV === 'DEV';
65
65
 
66
66
  return (
67
67
  <html lang="en">
@@ -1,6 +1,5 @@
1
1
  import type { Metadata } from 'next';
2
2
  import Image from 'next/image';
3
- import { Button } from '@/components/ui/button';
4
3
 
5
4
  export const metadata: Metadata = {
6
5
  title: '扣子编程 - AI 开发伙伴',
@@ -9,68 +8,27 @@ export const metadata: Metadata = {
9
8
 
10
9
  export default function Home() {
11
10
  return (
12
- <div className="flex min-h-screen items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground">
11
+ <div className="flex h-full items-center justify-center bg-background text-foreground transition-colors duration-300 dark:bg-background dark:text-foreground overflow-hidden min-h-screen">
13
12
  {/* 主容器 */}
14
- <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
15
- {/* 头部:Logo 产品名称 */}
16
- <div className="flex items-center gap-3">
17
- <Image
18
- src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/favicon.svg"
13
+ <main className="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
14
+ <div className="flex flex-col items-center justify-between gap-4">
15
+ <Image
16
+ className="dark:invert"
17
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
19
18
  alt="扣子编程 Logo"
20
- width={40}
21
- height={40}
22
- unoptimized
19
+ width={156}
20
+ height={130}
23
21
  />
24
- <span className="text-xl font-bold tracking-tight text-foreground dark:text-foreground">
25
- 扣子编程
26
- </span>
27
- </div>
28
-
29
- {/* 中间内容区:主标题和副标题 */}
30
- <div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
31
- <h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
32
- 扣子编程,你的 AI 开发伙伴已就位
33
- </h1>
34
- <p className="max-w-2xl text-lg leading-8 text-muted-foreground dark:text-muted-foreground">
35
- 当前是空白入口文件,项目正在开发中,请稍候...
36
- <br />
37
- 开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
38
- </p>
39
- </div>
40
-
41
- {/* 底部按钮区 */}
42
- <div className="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
43
- {/* 按钮 1:前往首页 */}
44
- <Button
45
- asChild
46
- variant="default"
47
- size="lg"
48
- className="h-12 min-w-[160px] rounded-full px-8"
49
- >
50
- <a
51
- href="https://code.coze.cn/"
52
- target="_blank"
53
- rel="noopener noreferrer"
54
- >
55
- 前往首页
56
- </a>
57
- </Button>
58
-
59
- {/* 按钮 2:查看文档 */}
60
- <Button
61
- asChild
62
- variant="outline"
63
- size="lg"
64
- className="h-12 min-w-[160px] rounded-full px-8"
65
- >
66
- <a
67
- href="https://docs.coze.cn/"
68
- target="_blank"
69
- rel="noopener noreferrer"
70
- >
71
- 查看文档
72
- </a>
73
- </Button>
22
+ <div>
23
+ <div className="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
24
+ <h1 className="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
25
+ 应用开发中
26
+ </h1>
27
+ <p className="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
28
+ 请稍后,页面即将呈现
29
+ </p>
30
+ </div>
31
+ </div>
74
32
  </div>
75
33
  </main>
76
34
  </div>
@@ -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,7 +1,8 @@
1
1
 
2
2
 
3
-
4
- import { resolve } from 'path';
3
+ import { spawn } from 'child_process';
4
+ import { resolve, join, basename } from 'path';
5
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
5
6
 
6
7
 
7
8
 
@@ -52,32 +53,66 @@ const config = {
52
53
  return context;
53
54
  },
54
55
 
55
- onAfterRender: async (context, outputPath) => {
56
+ onAfterRender: async (_context, outputPath) => {
56
57
  console.log(`\nProject created at: ${outputPath}`);
57
58
  console.log('\nConfiguration:');
58
59
  console.log(' - Framework: Next.js');
59
60
  console.log(' - TypeScript: enabled');
60
61
  console.log(' - App Router: enabled');
61
- console.log(` - Port: ${context.port}`);
62
+ console.log(` - Port: ${_context.port}`);
63
+ },
62
64
 
63
- // Skip pnpm add in test environment to avoid monorepo workspace issues
65
+ onComplete: async (_context, outputPath) => {
66
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
64
67
  if (process.env.NODE_ENV === 'test') {
65
68
  console.log('⊘ Skipping dependency update in test environment');
66
69
  return;
67
70
  }
68
71
 
69
- const cmd = `pnpm add coze-coding-dev-sdk@"^0.7.0"`;
70
- console.log(`${cmd}`);
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
+
71
78
  try {
72
79
  const projectRoot = resolve(outputPath);
73
- // execSync(cmd, {
74
- // cwd: projectRoot,
75
- // stdio: 'inherit',
76
- // });
77
- console.log('✓ coze-coding-dev-sdk updated successfully');
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}`);
78
113
  } catch (error) {
79
- console.error('✗ Failed to update coze-coding-dev-sdk:', error);
80
- throw 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');
81
116
  }
82
117
  },
83
118
  };
@@ -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,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
+ }