@coze-arch/cli 0.0.1-alpha.0aea6c

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 (92) hide show
  1. package/README.md +142 -0
  2. package/bin/main +2 -0
  3. package/lib/__templates__/expo/.coze +7 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +109 -0
  5. package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +257 -0
  6. package/lib/__templates__/expo/README.md +13 -0
  7. package/lib/__templates__/expo/_gitignore +11 -0
  8. package/lib/__templates__/expo/_npmrc +22 -0
  9. package/lib/__templates__/expo/app.json +63 -0
  10. package/lib/__templates__/expo/babel.config.js +9 -0
  11. package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +43 -0
  12. package/lib/__templates__/expo/client/app/(tabs)/home.tsx +1 -0
  13. package/lib/__templates__/expo/client/app/(tabs)/index.tsx +7 -0
  14. package/lib/__templates__/expo/client/app/+not-found.tsx +79 -0
  15. package/lib/__templates__/expo/client/app/_layout.tsx +33 -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/constants/theme.ts +118 -0
  29. package/lib/__templates__/expo/client/contexts/AuthContext.tsx +142 -0
  30. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +1 -0
  31. package/lib/__templates__/expo/client/hooks/useTheme.ts +13 -0
  32. package/lib/__templates__/expo/client/index.js +12 -0
  33. package/lib/__templates__/expo/client/screens/home/index.tsx +54 -0
  34. package/lib/__templates__/expo/client/screens/home/styles.ts +332 -0
  35. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +104 -0
  36. package/lib/__templates__/expo/client/utils/index.ts +55 -0
  37. package/lib/__templates__/expo/eslint-formatter-simple.mjs +49 -0
  38. package/lib/__templates__/expo/eslint.config.mjs +98 -0
  39. package/lib/__templates__/expo/metro.config.js +53 -0
  40. package/lib/__templates__/expo/package.json +110 -0
  41. package/lib/__templates__/expo/pnpm-lock.yaml +14309 -0
  42. package/lib/__templates__/expo/src/index.ts +12 -0
  43. package/lib/__templates__/expo/template.config.js +49 -0
  44. package/lib/__templates__/expo/tsconfig.json +24 -0
  45. package/lib/__templates__/nextjs/.coze +11 -0
  46. package/lib/__templates__/nextjs/.vscode/settings.json +121 -0
  47. package/lib/__templates__/nextjs/README.md +36 -0
  48. package/lib/__templates__/nextjs/_gitignore +99 -0
  49. package/lib/__templates__/nextjs/_npmrc +22 -0
  50. package/lib/__templates__/nextjs/eslint.config.mjs +18 -0
  51. package/lib/__templates__/nextjs/next-env.d.ts +6 -0
  52. package/lib/__templates__/nextjs/next.config.ts +7 -0
  53. package/lib/__templates__/nextjs/package.json +32 -0
  54. package/lib/__templates__/nextjs/pnpm-lock.yaml +4061 -0
  55. package/lib/__templates__/nextjs/postcss.config.mjs +7 -0
  56. package/lib/__templates__/nextjs/public/file.svg +1 -0
  57. package/lib/__templates__/nextjs/public/globe.svg +1 -0
  58. package/lib/__templates__/nextjs/public/next.svg +1 -0
  59. package/lib/__templates__/nextjs/public/vercel.svg +1 -0
  60. package/lib/__templates__/nextjs/public/window.svg +1 -0
  61. package/lib/__templates__/nextjs/scripts/build.sh +14 -0
  62. package/lib/__templates__/nextjs/scripts/dev.sh +51 -0
  63. package/lib/__templates__/nextjs/scripts/start.sh +15 -0
  64. package/lib/__templates__/nextjs/src/app/favicon.ico +0 -0
  65. package/lib/__templates__/nextjs/src/app/globals.css +26 -0
  66. package/lib/__templates__/nextjs/src/app/layout.tsx +83 -0
  67. package/lib/__templates__/nextjs/src/app/page.tsx +66 -0
  68. package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
  69. package/lib/__templates__/nextjs/template.config.js +55 -0
  70. package/lib/__templates__/nextjs/tsconfig.json +34 -0
  71. package/lib/__templates__/templates.json +62 -0
  72. package/lib/__templates__/vite/.coze +11 -0
  73. package/lib/__templates__/vite/.vscode/settings.json +7 -0
  74. package/lib/__templates__/vite/README.md +61 -0
  75. package/lib/__templates__/vite/_gitignore +66 -0
  76. package/lib/__templates__/vite/_npmrc +22 -0
  77. package/lib/__templates__/vite/index.html +13 -0
  78. package/lib/__templates__/vite/package.json +24 -0
  79. package/lib/__templates__/vite/pnpm-lock.yaml +1249 -0
  80. package/lib/__templates__/vite/postcss.config.js +6 -0
  81. package/lib/__templates__/vite/scripts/build.sh +14 -0
  82. package/lib/__templates__/vite/scripts/dev.sh +51 -0
  83. package/lib/__templates__/vite/scripts/start.sh +15 -0
  84. package/lib/__templates__/vite/src/index.css +21 -0
  85. package/lib/__templates__/vite/src/index.ts +5 -0
  86. package/lib/__templates__/vite/src/main.ts +65 -0
  87. package/lib/__templates__/vite/tailwind.config.js +9 -0
  88. package/lib/__templates__/vite/template.config.js +57 -0
  89. package/lib/__templates__/vite/tsconfig.json +16 -0
  90. package/lib/__templates__/vite/vite.config.ts +15 -0
  91. package/lib/cli.js +1608 -0
  92. package/package.json +70 -0
@@ -0,0 +1,7 @@
1
+ const config = {
2
+ plugins: {
3
+ '@tailwindcss/postcss': {},
4
+ },
5
+ };
6
+
7
+ export default config;
@@ -0,0 +1 @@
1
+ <svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
@@ -0,0 +1 @@
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
5
+
6
+ cd "${COZE_WORKSPACE_PATH}"
7
+
8
+ echo "Installing dependencies..."
9
+ pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
10
+
11
+ echo "Building the project..."
12
+ npx next build
13
+
14
+ echo "Build completed successfully!"
@@ -0,0 +1,51 @@
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ PORT=<%= port %>
5
+ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
6
+
7
+ cd "${COZE_WORKSPACE_PATH}"
8
+
9
+ kill_port_if_listening() {
10
+ local pids
11
+
12
+ # Check if lsof is available (macOS/BSD) or ss (Linux)
13
+ if command -v lsof >/dev/null 2>&1; then
14
+ # macOS/BSD using lsof
15
+ pids=$(lsof -ti:${PORT} 2>/dev/null || true)
16
+ elif command -v ss >/dev/null 2>&1; then
17
+ # Linux using ss
18
+ pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
19
+ else
20
+ echo "Warning: neither lsof nor ss found, cannot check port ${PORT}"
21
+ return
22
+ fi
23
+
24
+ if [[ -z "${pids}" ]]; then
25
+ echo "Port ${PORT} is free."
26
+ return
27
+ fi
28
+
29
+ echo "Port ${PORT} in use by PIDs: ${pids} (SIGKILL)"
30
+ echo "${pids}" | xargs -I {} kill -9 {}
31
+ sleep 1
32
+
33
+ # Verify port is cleared
34
+ if command -v lsof >/dev/null 2>&1; then
35
+ pids=$(lsof -ti:${PORT} 2>/dev/null || true)
36
+ elif command -v ss >/dev/null 2>&1; then
37
+ pids=$(ss -H -lntp 2>/dev/null | awk -v port="${PORT}" '$4 ~ ":"port"$"' | grep -o 'pid=[0-9]*' | cut -d= -f2 | paste -sd' ' - || true)
38
+ fi
39
+
40
+ if [[ -n "${pids}" ]]; then
41
+ echo "Warning: port ${PORT} still busy after SIGKILL, PIDs: ${pids}"
42
+ else
43
+ echo "Port ${PORT} cleared."
44
+ fi
45
+ }
46
+
47
+ echo "Clearing port ${PORT} before start."
48
+ kill_port_if_listening
49
+ echo "Starting HTTP service on port ${PORT} for dev..."
50
+
51
+ npx next dev -p $PORT
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ set -Eeuo pipefail
3
+
4
+ COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
5
+ PORT=<%= port %>
6
+ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-$PORT}"
7
+
8
+ start_service() {
9
+ cd "${COZE_WORKSPACE_PATH}"
10
+ echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
11
+ npx next start --port ${DEPLOY_RUN_PORT}
12
+ }
13
+
14
+ echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for deploy..."
15
+ start_service
@@ -0,0 +1,26 @@
1
+ @import 'tailwindcss';
2
+
3
+ :root {
4
+ --background: #ffffff;
5
+ --foreground: #171717;
6
+ }
7
+
8
+ @theme inline {
9
+ --color-background: var(--background);
10
+ --color-foreground: var(--foreground);
11
+ --font-sans: var(--font-geist-sans);
12
+ --font-mono: var(--font-geist-mono);
13
+ }
14
+
15
+ @media (prefers-color-scheme: dark) {
16
+ :root {
17
+ --background: #0a0a0a;
18
+ --foreground: #ededed;
19
+ }
20
+ }
21
+
22
+ body {
23
+ background: var(--background);
24
+ color: var(--foreground);
25
+ font-family: Arial, Helvetica, sans-serif;
26
+ }
@@ -0,0 +1,83 @@
1
+ import type { Metadata } from 'next';
2
+ import { Geist, Geist_Mono } from 'next/font/google';
3
+ import './globals.css';
4
+
5
+ const geistSans = Geist({
6
+ variable: '--font-geist-sans',
7
+ subsets: ['latin'],
8
+ });
9
+
10
+ const geistMono = Geist_Mono({
11
+ variable: '--font-geist-mono',
12
+ subsets: ['latin'],
13
+ });
14
+
15
+ export const metadata: Metadata = {
16
+ title: {
17
+ default: '新应用 | 扣子编程',
18
+ template: '%s | 扣子编程',
19
+ },
20
+ description:
21
+ '扣子编程是一款一站式云端 Vibe Coding 开发平台。通过对话轻松构建智能体、工作流和网站,实现从创意到上线的无缝衔接。',
22
+ keywords: [
23
+ '扣子编程',
24
+ 'Coze Code',
25
+ 'Vibe Coding',
26
+ 'AI 编程',
27
+ '智能体搭建',
28
+ '工作流搭建',
29
+ '网站搭建',
30
+ '网站部署',
31
+ '全栈开发',
32
+ 'AI 工程师',
33
+ ],
34
+ authors: [{ name: 'Coze Code Team', url: 'https://code.coze.cn' }],
35
+ generator: 'Coze Code',
36
+ icons: {
37
+ icon: '',
38
+ },
39
+ openGraph: {
40
+ title: '扣子编程 | 你的 AI 工程师已就位',
41
+ description:
42
+ '我正在使用扣子编程 Vibe Coding,让创意瞬间上线。告别拖拽,拥抱心流。',
43
+ url: 'https://code.coze.cn',
44
+ siteName: '扣子编程',
45
+ locale: 'zh_CN',
46
+ type: 'website',
47
+ images: [
48
+ {
49
+ url: '',
50
+ width: 1200,
51
+ height: 630,
52
+ alt: '扣子编程 - 你的 AI 工程师',
53
+ },
54
+ ],
55
+ },
56
+ twitter: {
57
+ card: 'summary_large_image',
58
+ title: 'Coze Code | Your AI Engineer is Here',
59
+ description:
60
+ 'Build and deploy full-stack applications through AI conversation. No env setup, just flow.',
61
+ images: [''],
62
+ },
63
+ robots: {
64
+ index: true,
65
+ follow: true,
66
+ },
67
+ };
68
+
69
+ export default function RootLayout({
70
+ children,
71
+ }: Readonly<{
72
+ children: React.ReactNode;
73
+ }>) {
74
+ return (
75
+ <html lang="en">
76
+ <body
77
+ className={`${geistSans.variable} ${geistMono.variable} antialiased`}
78
+ >
79
+ {children}
80
+ </body>
81
+ </html>
82
+ );
83
+ }
@@ -0,0 +1,66 @@
1
+ import type { Metadata } from 'next';
2
+
3
+ export const metadata: Metadata = {
4
+ title: '扣子编程 - AI 开发伙伴',
5
+ description: '扣子编程,你的 AI 开发伙伴已就位',
6
+ };
7
+
8
+ export default function Home() {
9
+ return (
10
+ <div className="flex min-h-screen items-center justify-center bg-white text-black transition-colors duration-300 dark:bg-black dark:text-white">
11
+ {/* 主容器 */}
12
+ <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between px-16 py-32 sm:items-start">
13
+ {/* 头部:Logo 和 产品名称 */}
14
+ <div className="flex items-center gap-3">
15
+ {/* 注意:生产环境建议使用 next/image 并配置 remotePatterns */}
16
+ <img
17
+ className="dark:invert"
18
+ src="https://lf3-static.bytednsdoc.com/obj/eden-cn/hkpzboz/coze_logo.png"
19
+ alt="扣子编程 Logo"
20
+ width={40}
21
+ height={40}
22
+ style={{ width: '40px', height: '40px', objectFit: 'contain' }}
23
+ />
24
+ <span className="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
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-black dark:text-zinc-50">
32
+ 扣子编程,你的 AI 开发伙伴已就位
33
+ </h1>
34
+ <p className="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
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
+ <a
45
+ className="flex h-12 w-full min-w-[160px] items-center justify-center gap-2 rounded-full bg-black px-8 text-white transition-colors hover:bg-zinc-800 dark:bg-white dark:text-black dark:hover:bg-zinc-200 md:w-auto"
46
+ href="https://code.coze.cn/"
47
+ target="_blank"
48
+ rel="noopener noreferrer"
49
+ >
50
+ 前往首页
51
+ </a>
52
+
53
+ {/* 按钮 2:查看文档 */}
54
+ <a
55
+ className="flex h-12 w-full min-w-[160px] items-center justify-center rounded-full border border-solid border-black/[.08] px-8 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-auto"
56
+ href="https://docs.coze.cn/"
57
+ target="_blank"
58
+ rel="noopener noreferrer"
59
+ >
60
+ 查看文档
61
+ </a>
62
+ </div>
63
+ </main>
64
+ </div>
65
+ );
66
+ }
@@ -0,0 +1,11 @@
1
+ import { MetadataRoute } from 'next';
2
+
3
+ export default function robots(): MetadataRoute.Robots {
4
+ return {
5
+ rules: {
6
+ userAgent: '*',
7
+ allow: '/',
8
+ disallow: ['/api/', '/_next/', '/static/'],
9
+ },
10
+ };
11
+ }
@@ -0,0 +1,55 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+ export const paramsSchema = {
10
+ type: 'object',
11
+ properties: {
12
+ appName: {
13
+ type: 'string',
14
+ minLength: 1,
15
+ pattern: '^[a-z0-9-]+$',
16
+ description:
17
+ 'Application name (lowercase, alphanumeric and hyphens only)',
18
+ },
19
+ port: {
20
+ type: 'number',
21
+ default: 5000,
22
+ minimum: 1024,
23
+ maximum: 65535,
24
+ description: 'Development server port (for Next.js dev server)',
25
+ },
26
+ },
27
+ required: [],
28
+ additionalProperties: false,
29
+ };
30
+
31
+ const config = {
32
+ paramsSchema,
33
+
34
+ // 显式定义默认参数,确保在渲染时可用
35
+ defaultParams: {
36
+ port: 5000,
37
+ appName: 'my-nextjs-app',
38
+ },
39
+
40
+ onBeforeRender: async context => {
41
+ console.log(`Creating Next.js project: ${context.appName}`);
42
+ return context;
43
+ },
44
+
45
+ onAfterRender: async (context, outputPath) => {
46
+ console.log(`\nProject created at: ${outputPath}`);
47
+ console.log('\nConfiguration:');
48
+ console.log(' - Framework: Next.js');
49
+ console.log(' - TypeScript: enabled');
50
+ console.log(' - App Router: enabled');
51
+ console.log(` - Port: ${context.port}`);
52
+ },
53
+ };
54
+
55
+ export default config;
@@ -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,62 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema",
3
+ "templates": [
4
+ {
5
+ "name": "expo",
6
+ "description": "expo template",
7
+ "location": "./expo",
8
+ "paramsSchema": {
9
+ "appName": {
10
+ "type": "string",
11
+ "description": "Application name (lowercase, alphanumeric and hyphens only)",
12
+ "pattern": "^[a-z0-9-]+$"
13
+ },
14
+ "port": {
15
+ "type": "number",
16
+ "description": "Metro bundler port",
17
+ "default": 8081,
18
+ "minimum": 1024,
19
+ "maximum": 65535
20
+ }
21
+ }
22
+ },
23
+ {
24
+ "name": "nextjs",
25
+ "description": "nextjs template",
26
+ "location": "./nextjs",
27
+ "paramsSchema": {
28
+ "appName": {
29
+ "type": "string",
30
+ "description": "Application name (lowercase, alphanumeric and hyphens only)",
31
+ "pattern": "^[a-z0-9-]+$"
32
+ },
33
+ "port": {
34
+ "type": "number",
35
+ "description": "Development server port (for Next.js dev server)",
36
+ "default": 5000,
37
+ "minimum": 1024,
38
+ "maximum": 65535
39
+ }
40
+ }
41
+ },
42
+ {
43
+ "name": "vite",
44
+ "description": "vite template",
45
+ "location": "./vite",
46
+ "paramsSchema": {
47
+ "appName": {
48
+ "type": "string",
49
+ "description": "Application name (lowercase, alphanumeric and hyphens only)",
50
+ "pattern": "^[a-z0-9-]+$"
51
+ },
52
+ "port": {
53
+ "type": "number",
54
+ "description": "Development server port",
55
+ "default": 5000,
56
+ "minimum": 1024,
57
+ "maximum": 65535
58
+ }
59
+ }
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,11 @@
1
+ [project]
2
+ requires = ["nodejs-24"]
3
+
4
+ [dev]
5
+ run = ["npm", "run", "dev"]
6
+ deps = ["git"] # -> apt install git
7
+
8
+ [deploy]
9
+ build = ["npm", "run", "build"]
10
+ run = ["npm", "run", "start"]
11
+ deps = ["git"] # -> apt install git
@@ -0,0 +1,7 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.eslint": "explicit"
5
+ },
6
+ "typescript.tsdk": "node_modules/typescript/lib"
7
+ }
@@ -0,0 +1,61 @@
1
+ # <%= appName %>
2
+
3
+ Vanilla TypeScript application built with Vite.
4
+
5
+ ## Getting Started
6
+
7
+ Install dependencies:
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ Start development server:
14
+
15
+ ```bash
16
+ npm run dev
17
+ ```
18
+
19
+ Or use coze-coding CLI:
20
+
21
+ ```bash
22
+ coze-coding dev
23
+ ```
24
+
25
+ ## Build
26
+
27
+ Build for production:
28
+
29
+ ```bash
30
+ npm run build
31
+ ```
32
+
33
+ Or:
34
+
35
+ ```bash
36
+ coze-coding build
37
+ ```
38
+
39
+ ## Preview
40
+
41
+ Preview production build:
42
+
43
+ ```bash
44
+ npm run preview
45
+ ```
46
+
47
+ Or:
48
+
49
+ ```bash
50
+ coze-coding start
51
+ ```
52
+
53
+ ## Configuration
54
+
55
+ - Dev Server Port: <%= port %>
56
+
57
+ ## Tech Stack
58
+
59
+ - TypeScript
60
+ - Vite
61
+ - HTML + CSS
@@ -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,22 @@
1
+ registry=https://registry.npmjs.org
2
+
3
+ strictStorePkgContentCheck=false
4
+ verifyStoreIntegrity=false
5
+
6
+ # 网络优化
7
+ network-concurrency=16
8
+ fetch-retries=3
9
+ fetch-timeout=60000
10
+
11
+ # 严格使用 peer dependencies
12
+ strict-peer-dependencies=false
13
+
14
+ # 自动生成 lockfile
15
+ auto-install-peers=true
16
+
17
+ # lockfile 配置
18
+ lockfile=true
19
+ prefer-frozen-lockfile=true
20
+
21
+ # 如果 lockfile 存在但过期,更新而不是失败
22
+ resolution-mode=highest
@@ -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,24 @@
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
+ },
12
+ "devDependencies": {
13
+ "autoprefixer": "^10.4.20",
14
+ "only-allow": "^1.2.2",
15
+ "postcss": "^8.4.49",
16
+ "tailwindcss": "^3.4.17",
17
+ "typescript": "^5.6.0",
18
+ "vite": "^6.0.0"
19
+ },
20
+ "packageManager": "pnpm@9.0.0",
21
+ "engines": {
22
+ "pnpm": ">=9.0.0"
23
+ }
24
+ }