@coze-arch/cli 0.0.1-alpha.7ccf88 → 0.0.1-alpha.89faa2

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.
@@ -37,9 +37,9 @@ fi
37
37
  pnpm install --registry=https://registry.npmmirror.com || echo "Expo 项目依赖安装失败(pnpm 执行出错)"
38
38
 
39
39
  echo "检查根目录 post_install.py"
40
- if [ -f "$ROOT_DIR/post_install.py" ]; then
41
- echo "执行:python $ROOT_DIR/post_install.py"
42
- python "$ROOT_DIR/post_install.py" || echo "post_install.py 执行失败"
40
+ if [ -f "$PREVIEW_DIR/post_install.py" ]; then
41
+ echo "执行:python $PREVIEW_DIR/post_install.py"
42
+ python "$PREVIEW_DIR/post_install.py" || echo "post_install.py 执行失败"
43
43
  fi
44
44
 
45
45
  echo "==================== 依赖安装完成!====================\n"
@@ -2,13 +2,11 @@ import { Platform, StyleSheet } from "react-native";
2
2
 
3
3
  export const Colors = {
4
4
  light: {
5
- text: "#1C1917",
6
5
  textPrimary: "#1C1917",
7
6
  textSecondary: "#374151",
8
7
  textMuted: "#9CA3AF",
9
8
  textDisabled: "#D1D5DB",
10
9
  placeholder: "#9CA3AF",
11
- buttonText: "#FFFFFF",
12
10
  tabIconDefault: "#9CA3AF",
13
11
  tabIconSelected: "#1C1917",
14
12
  primary: "#1C1917",
@@ -27,15 +25,17 @@ export const Colors = {
27
25
  divider: "#F3F4F6",
28
26
  overlay: "rgba(0, 0, 0, 0.4)",
29
27
  chartBackground: "rgba(249, 250, 251, 0.5)",
28
+ buttonPrimaryBackground: "#1C1917",
29
+ buttonPrimaryText: "#FFFFFF",
30
+ buttonSecondaryBackground: "#F3F4F6",
31
+ buttonSecondaryText: "#1C1917",
30
32
  },
31
33
  dark: {
32
- text: "#FAFAF9",
33
34
  textPrimary: "#FAFAF9",
34
35
  textSecondary: "#9BA1A6",
35
36
  textMuted: "#6F767E",
36
37
  textDisabled: "#4A4D50",
37
38
  placeholder: "#6F767E",
38
- buttonText: "#FFFFFF",
39
39
  tabIconDefault: "#6F767E",
40
40
  tabIconSelected: "#FAFAF9",
41
41
  primary: "#FAFAF9",
@@ -54,6 +54,10 @@ export const Colors = {
54
54
  divider: "#2C2C2E",
55
55
  overlay: "rgba(0, 0, 0, 0.6)",
56
56
  chartBackground: "rgba(28, 28, 30, 0.5)",
57
+ buttonPrimaryBackground: "#FAFAF9",
58
+ buttonPrimaryText: "#1C1917",
59
+ buttonSecondaryBackground: "#2C2C2E",
60
+ buttonSecondaryText: "#FAFAF9",
57
61
  },
58
62
  };
59
63
 
@@ -509,7 +513,7 @@ export const createThemedStyles = (theme: Theme) => {
509
513
  ...CommonStyles.scrollContent,
510
514
  },
511
515
  text: {
512
- color: theme.text,
516
+ color: theme.textPrimary,
513
517
  },
514
518
  textPrimary: {
515
519
  color: theme.textPrimary,
@@ -533,7 +537,7 @@ export const createThemedStyles = (theme: Theme) => {
533
537
  color: theme.info,
534
538
  },
535
539
  textButton: {
536
- color: theme.buttonText,
540
+ color: theme.buttonPrimaryText,
537
541
  },
538
542
  avatar: {
539
543
  ...CommonStyles.avatar,
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { ColorSchemeName, useColorScheme as useReactNativeColorScheme } from 'react-native';
2
+ import { ColorSchemeName, useColorScheme as useReactNativeColorScheme, Platform } from 'react-native';
3
3
 
4
4
  export function useColorScheme() {
5
5
  const systemColorScheme = useReactNativeColorScheme();
@@ -19,12 +19,12 @@ export function useColorScheme() {
19
19
  }
20
20
  }
21
21
 
22
- if (window && typeof window === 'object') {
22
+ if (Platform.OS === 'web') {
23
23
  window.addEventListener('message', handleMessage, false);
24
24
  }
25
25
 
26
26
  return () => {
27
- if (window && typeof window === 'object') {
27
+ if (Platform.OS === 'web') {
28
28
  window.removeEventListener('message', handleMessage, false);
29
29
  }
30
30
  }
@@ -14,7 +14,7 @@ export default function HomeScreen() {
14
14
  style={styles.container}
15
15
  >
16
16
  <Image style={styles.logo} source={require('@/assets/images/coze-logo.png')}></Image>
17
- <Text style={{...styles.text, color: theme.text}}>即将完成开发,请稍后...</Text>
17
+ <Text style={{...styles.text, color: theme.textPrimary}}>即将完成开发,请稍后...</Text>
18
18
  </View>
19
19
  </Screen>
20
20
  );
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.22.1",
13
+ "cors": "^2.8.5",
13
14
  "coze-coding-dev-sdk": "^0.5.5",
14
15
  "dayjs": "^1.11.19",
15
16
  "drizzle-orm": "^0.45.1",
@@ -1,12 +1,18 @@
1
1
  import express from "express";
2
+ import cors from "cors";
2
3
 
3
4
  const app = express();
4
5
  const port = process.env.PORT || 9091;
5
6
 
6
- app.get('/api/v1/ping', (req, res) => {
7
- res.status(200).json({ message: 'connected' });
7
+ // Middleware
8
+ app.use(cors());
9
+ app.use(express.json());
10
+
11
+ app.get('/api/v1/health', (req, res) => {
12
+ res.status(200).json({ status: 'ok' });
8
13
  });
9
14
 
15
+
10
16
  app.listen(port, () => {
11
17
  console.log(`Server listening at http://localhost:${port}/`);
12
18
  });
@@ -29,6 +29,7 @@ export const paramsSchema = {
29
29
  };
30
30
 
31
31
  const config = {
32
+ description: 'Expo template for React Native applications',
32
33
  paramsSchema,
33
34
  defaultParams: {
34
35
  port: 9090,
@@ -6,8 +6,6 @@
6
6
  @theme inline {
7
7
  --color-background: var(--background);
8
8
  --color-foreground: var(--foreground);
9
- --font-sans: var(--font-geist-sans);
10
- --font-mono: var(--font-geist-mono);
11
9
  --color-sidebar-ring: var(--sidebar-ring);
12
10
  --color-sidebar-border: var(--sidebar-border);
13
11
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
@@ -44,6 +42,16 @@
44
42
  --radius-2xl: calc(var(--radius) + 8px);
45
43
  --radius-3xl: calc(var(--radius) + 12px);
46
44
  --radius-4xl: calc(var(--radius) + 16px);
45
+ --font-sans:
46
+ 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', ui-sans-serif,
47
+ system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
48
+ 'Helvetica Neue', Arial, sans-serif;
49
+ --font-mono:
50
+ ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
51
+ 'Courier New', monospace;
52
+ --font-serif:
53
+ 'Noto Serif SC', 'Songti SC', 'SimSun', ui-serif, Georgia, Cambria,
54
+ 'Times New Roman', Times, serif;
47
55
  }
48
56
 
49
57
  :root {
@@ -1,17 +1,6 @@
1
1
  import type { Metadata } from 'next';
2
- import { Geist, Geist_Mono } from 'next/font/google';
3
2
  import './globals.css';
4
3
 
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
4
  export const metadata: Metadata = {
16
5
  title: {
17
6
  default: '新应用 | 扣子编程',
@@ -74,7 +63,7 @@ export default function RootLayout({
74
63
  return (
75
64
  <html lang="en">
76
65
  <body
77
- className={`${geistSans.variable} ${geistMono.variable} antialiased`}
66
+ className={`antialiased`}
78
67
  >
79
68
  {children}
80
69
  </body>
@@ -1,5 +1,6 @@
1
1
  import type { Metadata } from 'next';
2
2
  import Image from 'next/image';
3
+ import { Button } from '@/components/ui/button';
3
4
 
4
5
  export const metadata: Metadata = {
5
6
  title: '扣子编程 - AI 开发伙伴',
@@ -8,7 +9,7 @@ export const metadata: Metadata = {
8
9
 
9
10
  export default function Home() {
10
11
  return (
11
- <div className="flex min-h-screen items-center justify-center bg-white text-black transition-colors duration-300 dark:bg-black dark:text-white">
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">
12
13
  {/* 主容器 */}
13
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">
14
15
  {/* 头部:Logo 和 产品名称 */}
@@ -20,17 +21,17 @@ export default function Home() {
20
21
  width={40}
21
22
  height={40}
22
23
  />
23
- <span className="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
24
+ <span className="text-xl font-bold tracking-tight text-foreground dark:text-foreground">
24
25
  扣子编程
25
26
  </span>
26
27
  </div>
27
28
 
28
29
  {/* 中间内容区:主标题和副标题 */}
29
30
  <div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
30
- <h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-black dark:text-zinc-50">
31
+ <h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
31
32
  扣子编程,你的 AI 开发伙伴已就位
32
33
  </h1>
33
- <p className="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
34
+ <p className="max-w-2xl text-lg leading-8 text-muted-foreground dark:text-muted-foreground">
34
35
  当前是空白入口文件,项目正在开发中,请稍候...
35
36
  <br />
36
37
  开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
@@ -40,24 +41,36 @@ export default function Home() {
40
41
  {/* 底部按钮区 */}
41
42
  <div className="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
42
43
  {/* 按钮 1:前往首页 */}
43
- <a
44
- 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"
45
- href="https://code.coze.cn/"
46
- target="_blank"
47
- rel="noopener noreferrer"
44
+ <Button
45
+ asChild
46
+ variant="default"
47
+ size="lg"
48
+ className="h-12 min-w-[160px] rounded-full px-8"
48
49
  >
49
- 前往首页
50
- </a>
50
+ <a
51
+ href="https://code.coze.cn/"
52
+ target="_blank"
53
+ rel="noopener noreferrer"
54
+ >
55
+ 前往首页
56
+ </a>
57
+ </Button>
51
58
 
52
59
  {/* 按钮 2:查看文档 */}
53
- <a
54
- 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"
55
- href="https://docs.coze.cn/"
56
- target="_blank"
57
- rel="noopener noreferrer"
60
+ <Button
61
+ asChild
62
+ variant="outline"
63
+ size="lg"
64
+ className="h-12 min-w-[160px] rounded-full px-8"
58
65
  >
59
- 查看文档
60
- </a>
66
+ <a
67
+ href="https://docs.coze.cn/"
68
+ target="_blank"
69
+ rel="noopener noreferrer"
70
+ >
71
+ 查看文档
72
+ </a>
73
+ </Button>
61
74
  </div>
62
75
  </main>
63
76
  </div>
@@ -1,11 +1,20 @@
1
1
 
2
2
 
3
+ import { execSync } from 'child_process';
4
+ import { resolve } from 'path';
3
5
 
4
6
 
5
7
 
6
8
 
7
9
 
8
10
 
11
+ const description = `Next.js(复杂项目):\`coze init \${COZE_WORKSPACE_PATH} --template nextjs\`
12
+ - 适用:全栈应用、复杂多页面等复杂项目
13
+ - 使用默认nextjs项目规范
14
+ - **目录规范**: 默认开启src目录(打开--src-dir选项):项目文件(如 app 目录、pages 目录、components 等)初始化到 src/ 目录下。
15
+ - **项目理解加速**:初始可以依赖项目下 \`package.json\` 文件理解项目类型,如果没有或无法理解退化成阅读其他文件。
16
+ - **UI设计与组件规范**:Next.js项目**必须默认**采用 shadcn/ui 风格和规范,\`shadcn/ui\`组件默认完整的预装在\`src/components/ui/\`目录下`;
17
+
9
18
  export const paramsSchema = {
10
19
  type: 'object',
11
20
  properties: {
@@ -29,6 +38,7 @@ export const paramsSchema = {
29
38
  };
30
39
 
31
40
  const config = {
41
+ description: description,
32
42
  paramsSchema,
33
43
 
34
44
  // 显式定义默认参数,确保在渲染时可用
@@ -49,6 +59,20 @@ const config = {
49
59
  console.log(' - TypeScript: enabled');
50
60
  console.log(' - App Router: enabled');
51
61
  console.log(` - Port: ${context.port}`);
62
+
63
+ // Update coze-coding-dev-sdk to ^0.5.2
64
+ console.log('\nUpdating coze-coding-dev-sdk to ^0.5.2...');
65
+ try {
66
+ const projectRoot = resolve(outputPath);
67
+ execSync('pnpm add coze-coding-dev-sdk@^0.5.2', {
68
+ cwd: projectRoot,
69
+ stdio: 'inherit',
70
+ });
71
+ console.log('✓ coze-coding-dev-sdk updated successfully');
72
+ } catch (error) {
73
+ console.error('✗ Failed to update coze-coding-dev-sdk:', error);
74
+ throw error;
75
+ }
52
76
  },
53
77
  };
54
78
 
@@ -3,66 +3,84 @@
3
3
  "templates": [
4
4
  {
5
5
  "name": "expo",
6
- "description": "expo template",
6
+ "description": "Expo template for React Native applications",
7
7
  "location": "./expo",
8
8
  "paramsSchema": {
9
- "appName": {
10
- "type": "string",
11
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
12
- "pattern": "^[a-z0-9-]+$"
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
+ }
13
24
  },
14
- "port": {
15
- "type": "number",
16
- "description": "Metro bundler port",
17
- "default": 8081,
18
- "minimum": 1024,
19
- "maximum": 65535
20
- }
25
+ "required": [],
26
+ "additionalProperties": false
21
27
  }
22
28
  },
23
29
  {
24
30
  "name": "nextjs",
25
- "description": "nextjs template",
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/`目录下",
26
32
  "location": "./nextjs",
27
33
  "paramsSchema": {
28
- "appName": {
29
- "type": "string",
30
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
31
- "pattern": "^[a-z0-9-]+$"
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
+ }
32
49
  },
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
- }
50
+ "required": [],
51
+ "additionalProperties": false
40
52
  }
41
53
  },
42
54
  {
43
55
  "name": "vite",
44
- "description": "vite template",
56
+ "description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
45
57
  "location": "./vite",
46
58
  "paramsSchema": {
47
- "appName": {
48
- "type": "string",
49
- "description": "Application name (lowercase, alphanumeric and hyphens only)",
50
- "pattern": "^[a-z0-9-]+$"
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
+ }
51
81
  },
52
- "port": {
53
- "type": "number",
54
- "description": "Development server port",
55
- "default": 5000,
56
- "minimum": 1024,
57
- "maximum": 65535
58
- },
59
- "hmrPort": {
60
- "type": "number",
61
- "description": "Development HMR server port",
62
- "default": 6000,
63
- "minimum": 1024,
64
- "maximum": 65535
65
- }
82
+ "required": [],
83
+ "additionalProperties": false
66
84
  }
67
85
  }
68
86
  ]
@@ -37,7 +37,11 @@ export const paramsSchema = {
37
37
  additionalProperties: false,
38
38
  };
39
39
 
40
+ const description = `Vite(简单项目):\`coze init \${COZE_WORKSPACE_PATH} --template vite\`
41
+ - 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。`;
42
+
40
43
  const config = {
44
+ description: description,
41
45
  paramsSchema,
42
46
 
43
47
  defaultParams: {
package/lib/cli.js CHANGED
@@ -1854,7 +1854,7 @@ const registerCommand = program => {
1854
1854
  });
1855
1855
  };
1856
1856
 
1857
- var version = "0.0.1-alpha.7ccf88";
1857
+ var version = "0.0.1-alpha.89faa2";
1858
1858
  var packageJson = {
1859
1859
  version: version};
1860
1860
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.0.1-alpha.7ccf88",
3
+ "version": "0.0.1-alpha.89faa2",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",