@coze-arch/cli 0.0.1-alpha.ecba20 → 0.0.1-alpha.ecccee

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 (114) hide show
  1. package/lib/__templates__/expo/.coze +1 -1
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +78 -88
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +2 -2
  5. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +2 -2
  6. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
  7. package/lib/__templates__/expo/README.md +26 -16
  8. package/lib/__templates__/expo/client/app/+not-found.tsx +30 -0
  9. package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
  10. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  11. package/lib/__templates__/expo/client/app.config.ts +65 -60
  12. package/lib/__templates__/expo/client/components/Screen.tsx +1 -17
  13. package/lib/__templates__/expo/client/components/ThemedView.tsx +1 -2
  14. package/lib/__templates__/expo/client/constants/theme.ts +25 -698
  15. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  16. package/lib/__templates__/expo/client/eslint.config.mjs +33 -10
  17. package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
  18. package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
  19. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  20. package/lib/__templates__/expo/client/package.json +36 -33
  21. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  22. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  23. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  24. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  25. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  26. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
  27. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
  28. package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
  29. package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
  30. package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
  31. package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
  32. package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
  33. package/lib/__templates__/expo/package.json +3 -0
  34. package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
  35. package/lib/__templates__/expo/pnpm-lock.yaml +1346 -2612
  36. package/lib/__templates__/expo/server/build.js +21 -0
  37. package/lib/__templates__/expo/server/package.json +11 -7
  38. package/lib/__templates__/expo/server/src/index.ts +10 -2
  39. package/lib/__templates__/expo/template.config.js +57 -0
  40. package/lib/__templates__/nextjs/.coze +1 -0
  41. package/lib/__templates__/nextjs/_npmrc +1 -0
  42. package/lib/__templates__/nextjs/next.config.ts +11 -0
  43. package/lib/__templates__/nextjs/package.json +10 -2
  44. package/lib/__templates__/nextjs/pnpm-lock.yaml +1686 -1810
  45. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  46. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  47. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  48. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -14
  49. package/lib/__templates__/nextjs/src/app/page.tsx +18 -48
  50. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  51. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  52. package/lib/__templates__/nextjs/template.config.js +67 -2
  53. package/lib/__templates__/taro/.coze +14 -0
  54. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
  55. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
  56. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
  57. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
  58. package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
  59. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +1 -0
  60. package/lib/__templates__/taro/README.md +749 -0
  61. package/lib/__templates__/taro/_gitignore +40 -0
  62. package/lib/__templates__/taro/_npmrc +18 -0
  63. package/lib/__templates__/taro/babel.config.js +12 -0
  64. package/lib/__templates__/taro/config/dev.ts +9 -0
  65. package/lib/__templates__/taro/config/index.ts +173 -0
  66. package/lib/__templates__/taro/config/prod.ts +35 -0
  67. package/lib/__templates__/taro/eslint.config.mjs +57 -0
  68. package/lib/__templates__/taro/key/private.appid.key +0 -0
  69. package/lib/__templates__/taro/package.json +97 -0
  70. package/lib/__templates__/taro/pnpm-lock.yaml +22708 -0
  71. package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
  72. package/lib/__templates__/taro/project.config.json +15 -0
  73. package/lib/__templates__/taro/server/nest-cli.json +10 -0
  74. package/lib/__templates__/taro/server/package.json +41 -0
  75. package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
  76. package/lib/__templates__/taro/server/src/app.module.ts +10 -0
  77. package/lib/__templates__/taro/server/src/app.service.ts +8 -0
  78. package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
  79. package/lib/__templates__/taro/server/src/main.ts +49 -0
  80. package/lib/__templates__/taro/server/tsconfig.json +24 -0
  81. package/lib/__templates__/taro/src/app.config.ts +11 -0
  82. package/lib/__templates__/taro/src/app.css +52 -0
  83. package/lib/__templates__/taro/src/app.tsx +9 -0
  84. package/lib/__templates__/taro/src/index.html +39 -0
  85. package/lib/__templates__/taro/src/network.ts +39 -0
  86. package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
  87. package/lib/__templates__/taro/src/pages/index/index.css +1 -0
  88. package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
  89. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +171 -0
  90. package/lib/__templates__/taro/src/presets/h5-styles.ts +33 -0
  91. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  92. package/lib/__templates__/taro/src/presets/wx-debug.ts +23 -0
  93. package/lib/__templates__/taro/stylelint.config.mjs +4 -0
  94. package/lib/__templates__/taro/template.config.js +68 -0
  95. package/lib/__templates__/taro/tsconfig.json +29 -0
  96. package/lib/__templates__/taro/types/global.d.ts +32 -0
  97. package/lib/__templates__/templates.json +88 -65
  98. package/lib/__templates__/vite/.coze +1 -0
  99. package/lib/__templates__/vite/_npmrc +1 -0
  100. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  101. package/lib/__templates__/vite/package.json +14 -1
  102. package/lib/__templates__/vite/pnpm-lock.yaml +1581 -105
  103. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  104. package/lib/__templates__/vite/src/main.ts +17 -48
  105. package/lib/__templates__/vite/template.config.js +67 -6
  106. package/lib/cli.js +864 -139
  107. package/package.json +1 -1
  108. package/lib/__templates__/expo/client/app/index.ts +0 -1
  109. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
  110. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -50
  111. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  112. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  113. package/lib/__templates__/nextjs/server.mjs +0 -50
  114. package/lib/__templates__/vite/.vscode/settings.json +0 -7
@@ -0,0 +1,9 @@
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
@@ -7,57 +7,26 @@ export function initApp(): void {
7
7
  }
8
8
 
9
9
  app.innerHTML = `
10
- <div class="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 class="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 class="flex items-center gap-3">
10
+ <div class="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">
11
+ <main class="flex w-full h-full max-w-3xl flex-col items-center justify-center px-16 py-32 sm:items-center">
12
+ <div class="flex flex-col items-center justify-between gap-4">
15
13
  <img
16
- class="dark:invert"
17
- src="https://lf3-static.bytednsdoc.com/obj/eden-cn/hkpzboz/coze_logo.png"
14
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/coze-coding/icon/coze-coding.gif"
18
15
  alt="扣子编程 Logo"
19
- width="40"
20
- height="40"
21
- style="width: 40px; height: 40px; object-fit: contain;"
16
+ width={156}
17
+ height={130}
18
+ style="width: 156px; height: 130px; object-fit: contain;"
22
19
  />
23
- <span class="text-xl font-bold tracking-tight text-black dark:text-zinc-50">
24
- 扣子编程
25
- </span>
26
- </div>
27
-
28
- <!-- 中间内容区:主标题和副标题 -->
29
- <div class="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
30
- <h1 class="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-black dark:text-zinc-50">
31
- 扣子编程,你的 AI 开发伙伴已就位
32
- </h1>
33
- <p class="max-w-2xl text-lg leading-8 text-zinc-600 dark:text-zinc-400">
34
- 当前是空白入口文件,项目正在开发中,请稍候...
35
- <br />
36
- 开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
37
- </p>
38
- </div>
39
-
40
- <!-- 底部按钮区 -->
41
- <div class="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
42
- <!-- 按钮 1:前往首页 -->
43
- <a
44
- class="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"
48
- >
49
- 前往首页
50
- </a>
51
-
52
- <!-- 按钮 2:查看文档 -->
53
- <a
54
- class="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"
58
- >
59
- 查看文档
60
- </a>
20
+ <div>
21
+ <div class="flex flex-col items-center gap-2 text-center sm:items-center sm:text-center">
22
+ <h1 class="max-w-xl text-base font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
23
+ 应用开发中
24
+ </h1>
25
+ <p class="max-w-2xl text-sm-14 leading-8 text-muted-foreground dark:text-muted-foreground">
26
+ 请稍后,页面即将呈现
27
+ </p>
28
+ </div>
29
+ </div>
61
30
  </div>
62
31
  </main>
63
32
  </div>
@@ -1,4 +1,7 @@
1
1
 
2
+ import { spawn } from 'child_process';
3
+ import { resolve, join, basename } from 'path';
4
+ import { appendFileSync, openSync, closeSync, mkdirSync } from 'fs';
2
5
 
3
6
 
4
7
 
@@ -37,7 +40,11 @@ export const paramsSchema = {
37
40
  additionalProperties: false,
38
41
  };
39
42
 
43
+ const description = `Vite(简单项目):\`coze init \${COZE_WORKSPACE_PATH} --template vite\`
44
+ - 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。`;
45
+
40
46
  const config = {
47
+ description: description,
41
48
  paramsSchema,
42
49
 
43
50
  defaultParams: {
@@ -53,13 +60,67 @@ const config = {
53
60
  return context;
54
61
  },
55
62
 
56
- onAfterRender: async (context, outputPath) => {
63
+ onAfterRender: async (_context, outputPath) => {
57
64
  console.log(`\nProject created at: ${outputPath}`);
58
- console.log(`\nConfiguration:`);
59
- console.log(` - TypeScript: enabled`);
60
- console.log(` - Framework: None (Vanilla JS/TS)`);
61
- console.log(` - Build Tool: Vite`);
62
- console.log(` - Port: ${context.port}`);
65
+ console.log('\nConfiguration:');
66
+ console.log(' - Framework: vite');
67
+ console.log(' - TypeScript: enabled');
68
+ console.log(' - App Router: enabled');
69
+ console.log(` - Port: ${_context.port}`);
70
+ },
71
+
72
+ onComplete: async (_context, outputPath) => {
73
+ // Skip pnpm update in test environment to avoid monorepo workspace issues
74
+ if (process.env.NODE_ENV === 'test') {
75
+ console.log('⊘ Skipping dependency update in test environment');
76
+ return;
77
+ }
78
+
79
+ const cmd = 'pnpm';
80
+ const args = ['update', 'coze-coding-dev-sdk@^0.7.0'];
81
+ console.log(
82
+ `\nTriggering: ${cmd} ${args.join(' ')} (running in background)`,
83
+ );
84
+
85
+ try {
86
+ const projectRoot = resolve(outputPath);
87
+
88
+ // Determine log directory
89
+ const logDir = process.env.COZE_LOG_DIR || resolve(__dirname, '../.log');
90
+ mkdirSync(logDir, { recursive: true });
91
+
92
+ // Use project name in log file to avoid conflicts
93
+ const projectName = basename(projectRoot);
94
+ const logFile = join(logDir, `${projectName}-init.log`);
95
+
96
+ // Write log header
97
+ const timestamp = new Date().toISOString();
98
+ appendFileSync(
99
+ logFile,
100
+ `\n=== [${timestamp}] ${cmd} ${args.join(' ')} ===\n`,
101
+ );
102
+
103
+ // Open log file for appending
104
+ const logFd = openSync(logFile, 'a');
105
+
106
+ // Spawn in detached mode
107
+ const child = spawn(cmd, args, {
108
+ cwd: projectRoot,
109
+ detached: true,
110
+ stdio: ['ignore', logFd, logFd],
111
+ });
112
+
113
+ child.unref();
114
+ closeSync(logFd);
115
+
116
+ console.log(
117
+ '✓ coze-coding-dev-sdk update triggered (running in background)',
118
+ );
119
+ console.log(` Log file: ${logFile}`);
120
+ } catch (error) {
121
+ console.error('✗ Failed to trigger coze-coding-dev-sdk update:', error);
122
+ console.log(' You can manually run: pnpm update coze-coding-dev-sdk');
123
+ }
63
124
  },
64
125
  };
65
126