@coze-arch/cli 0.0.1-alpha.49a2d9 → 0.0.1-alpha.4c5c53

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 (56) 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 +65 -84
  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 +45 -0
  7. package/lib/__templates__/expo/README.md +24 -14
  8. package/lib/__templates__/expo/client/app/_layout.tsx +14 -14
  9. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  10. package/lib/__templates__/expo/client/app.config.ts +65 -60
  11. package/lib/__templates__/expo/client/constants/theme.ts +22 -18
  12. package/lib/__templates__/expo/client/declarations.d.ts +5 -0
  13. package/lib/__templates__/expo/client/eslint.config.mjs +13 -10
  14. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -1
  15. package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
  16. package/lib/__templates__/expo/client/package.json +1 -0
  17. package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
  18. package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
  19. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +1 -0
  20. package/lib/__templates__/expo/client/utils/index.ts +22 -0
  21. package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
  22. package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +2486 -0
  23. package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +155 -0
  24. package/lib/__templates__/expo/pnpm-lock.yaml +57 -5
  25. package/lib/__templates__/expo/server/build.js +21 -0
  26. package/lib/__templates__/expo/server/package.json +5 -3
  27. package/lib/__templates__/expo/server/src/index.ts +9 -2
  28. package/lib/__templates__/expo/template.config.js +1 -0
  29. package/lib/__templates__/nextjs/.coze +1 -0
  30. package/lib/__templates__/nextjs/_npmrc +1 -0
  31. package/lib/__templates__/nextjs/next.config.ts +11 -0
  32. package/lib/__templates__/nextjs/package.json +3 -2
  33. package/lib/__templates__/nextjs/pnpm-lock.yaml +13 -5
  34. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  35. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  36. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -12
  37. package/lib/__templates__/nextjs/src/app/page.tsx +35 -23
  38. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  39. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  40. package/lib/__templates__/nextjs/template.config.js +30 -0
  41. package/lib/__templates__/templates.json +61 -43
  42. package/lib/__templates__/vite/.coze +1 -0
  43. package/lib/__templates__/vite/_npmrc +1 -0
  44. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  45. package/lib/__templates__/vite/package.json +5 -1
  46. package/lib/__templates__/vite/pnpm-lock.yaml +3481 -14
  47. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  48. package/lib/__templates__/vite/src/main.ts +1 -2
  49. package/lib/__templates__/vite/template.config.js +28 -4
  50. package/lib/cli.js +58 -27
  51. package/package.json +1 -1
  52. package/lib/__templates__/expo/client/app/index.ts +0 -1
  53. package/lib/__templates__/expo/client/screens/home/index.tsx +0 -50
  54. package/lib/__templates__/expo/client/screens/home/styles.ts +0 -60
  55. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  56. package/lib/__templates__/vite/.vscode/settings.json +0 -7
@@ -0,0 +1,155 @@
1
+ const names = require('./names')
2
+
3
+ const DEFAULTS = {
4
+ whitelist: names,
5
+ componentName: 'FontAwesome6',
6
+ attributeName: 'name',
7
+ };
8
+
9
+ function getJSXAttribute(openingElement, attrName) {
10
+ return openingElement.attributes.find(
11
+ (attr) =>
12
+ attr &&
13
+ attr.type === 'JSXAttribute' &&
14
+ attr.name &&
15
+ attr.name.name === attrName
16
+ );
17
+ }
18
+
19
+ function getStringLiteralValue(attribute) {
20
+ if (!attribute || !attribute.value) return null;
21
+
22
+ const val = attribute.value;
23
+
24
+ // <Comp name="hello" />
25
+ if (val.type === 'Literal' && typeof val.value === 'string') {
26
+ return val.value;
27
+ }
28
+
29
+ // <Comp name={'hello'} />
30
+ if (
31
+ val.type === 'JSXExpressionContainer' &&
32
+ val.expression &&
33
+ val.expression.type === 'Literal' &&
34
+ typeof val.expression.value === 'string'
35
+ ) {
36
+ return val.expression.value;
37
+ }
38
+
39
+ // <Comp name={`hello`} /> template literal without expressions
40
+ if (
41
+ val.type === 'JSXExpressionContainer' &&
42
+ val.expression &&
43
+ val.expression.type === 'TemplateLiteral' &&
44
+ val.expression.expressions.length === 0
45
+ ) {
46
+ return val.expression.quasis[0]?.value?.cooked ?? null;
47
+ }
48
+
49
+ return null;
50
+ }
51
+
52
+ module.exports = {
53
+ meta: {
54
+ type: 'problem',
55
+ docs: {
56
+ description:
57
+ 'Ensure FontAwesome6 name prop is a string literal in whitelist',
58
+ recommended: false,
59
+ },
60
+ schema: [
61
+ {
62
+ type: 'object',
63
+ additionalProperties: false,
64
+ properties: {
65
+ whitelist: {
66
+ type: 'array',
67
+ items: { type: 'string' },
68
+ default: DEFAULTS.whitelist,
69
+ },
70
+ componentName: {
71
+ type: 'string',
72
+ default: DEFAULTS.componentName,
73
+ },
74
+ attributeName: {
75
+ type: 'string',
76
+ default: DEFAULTS.attributeName,
77
+ },
78
+ caseSensitive: {
79
+ type: 'boolean',
80
+ default: true
81
+ }
82
+ },
83
+ },
84
+ ],
85
+ messages: {
86
+ invalidName:
87
+ '{{componentName}} 中不存在图标 {{name}},请更换为其他图标',
88
+ },
89
+ },
90
+
91
+ create(context) {
92
+ const options = context.options && context.options[0] ? context.options[0] : {};
93
+ const componentName = options.componentName || DEFAULTS.componentName;
94
+ const attributeName = options.attributeName || DEFAULTS.attributeName;
95
+ const caseSensitive = options.caseSensitive ?? true;
96
+
97
+ const whitelistRaw = Array.isArray(options.whitelist)
98
+ ? options.whitelist
99
+ : DEFAULTS.whitelist;
100
+
101
+ const normalize = (s) =>
102
+ caseSensitive ? String(s) : String(s).toLowerCase();
103
+
104
+ const whitelist = new Set(whitelistRaw.map(normalize));
105
+
106
+ function isTargetComponent(node) {
107
+ // Supports: <FontAwesome6 />, <NS.FontAwesome6 />
108
+ const nameNode = node.name;
109
+ if (!nameNode) return false;
110
+
111
+ if (nameNode.type === 'JSXIdentifier') {
112
+ return nameNode.name === componentName;
113
+ }
114
+
115
+ if (nameNode.type === 'JSXMemberExpression') {
116
+ // e.g., UI.FontAwesome6
117
+ let base = nameNode;
118
+ while (base.type === 'JSXMemberExpression') {
119
+ if (base.property && base.property.name === componentName) {
120
+ return true;
121
+ }
122
+ base = base.object;
123
+ }
124
+ }
125
+
126
+ return false;
127
+ }
128
+
129
+ return {
130
+ JSXOpeningElement(opening) {
131
+ if (!isTargetComponent(opening)) return;
132
+
133
+ const attrNode = getJSXAttribute(opening, attributeName);
134
+ if (!attrNode) return;
135
+
136
+ const literal = getStringLiteralValue(attrNode);
137
+
138
+ // Only lint when it's a string literal
139
+ if (literal == null) return;
140
+
141
+ const normalized = normalize(literal);
142
+ if (!whitelist.has(normalized)) {
143
+ context.report({
144
+ node: attrNode.value || attrNode,
145
+ messageId: 'invalidName',
146
+ data: {
147
+ componentName,
148
+ name: literal,
149
+ },
150
+ });
151
+ }
152
+ },
153
+ };
154
+ },
155
+ };
@@ -70,6 +70,9 @@ importers:
70
70
  expo-haptics:
71
71
  specifier: ~15.0.6
72
72
  version: 15.0.8(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))
73
+ expo-image:
74
+ specifier: ^3.0.11
75
+ version: 3.0.11(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-web@0.21.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
73
76
  expo-image-picker:
74
77
  specifier: ~17.0.7
75
78
  version: 17.0.10(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))
@@ -230,9 +233,12 @@ importers:
230
233
 
231
234
  server:
232
235
  dependencies:
236
+ cors:
237
+ specifier: ^2.8.5
238
+ version: 2.8.5
233
239
  coze-coding-dev-sdk:
234
- specifier: ^0.5.5
235
- version: 0.5.6(@types/pg@8.16.0)(openai@6.15.0(ws@8.18.3)(zod@4.3.2))(ws@8.18.3)
240
+ specifier: ^0.7.2
241
+ version: 0.7.2(@types/pg@8.16.0)(openai@6.15.0(ws@8.18.3)(zod@4.3.2))(ws@8.18.3)
236
242
  dayjs:
237
243
  specifier: ^1.11.19
238
244
  version: 1.11.19
@@ -255,6 +261,9 @@ importers:
255
261
  specifier: ^4.2.1
256
262
  version: 4.3.2
257
263
  devDependencies:
264
+ '@types/cors':
265
+ specifier: ^2.8.19
266
+ version: 2.8.19
258
267
  '@types/express':
259
268
  specifier: ^5.0.6
260
269
  version: 5.0.6
@@ -2064,6 +2073,9 @@ packages:
2064
2073
  '@types/connect@3.4.38':
2065
2074
  resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
2066
2075
 
2076
+ '@types/cors@2.8.19':
2077
+ resolution: {integrity: sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==}
2078
+
2067
2079
  '@types/estree@1.0.8':
2068
2080
  resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
2069
2081
 
@@ -2855,12 +2867,16 @@ packages:
2855
2867
  core-js-compat@3.47.0:
2856
2868
  resolution: {integrity: sha512-IGfuznZ/n7Kp9+nypamBhvwdwLsW6KC8IOaURw2doAK5e98AG3acVLdh0woOnEqCfUtS+Vu882JE4k/DAm3ItQ==}
2857
2869
 
2870
+ cors@2.8.5:
2871
+ resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
2872
+ engines: {node: '>= 0.10'}
2873
+
2858
2874
  cosmiconfig@7.1.0:
2859
2875
  resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
2860
2876
  engines: {node: '>=10'}
2861
2877
 
2862
- coze-coding-dev-sdk@0.5.6:
2863
- resolution: {integrity: sha512-YYWiwRCZf1mN2VEjeAznGSCrGpfDCq+TjneM4cuqzSgcrnzkI8yAD6lZrwKKiu7LnGycOMYMFc6/0cCPzXL0Ig==}
2878
+ coze-coding-dev-sdk@0.7.2:
2879
+ resolution: {integrity: sha512-IAAbI8W6MHL95BV/OmiacM2aMzkruyBwUMsvzJk/9jBT9vra2xiUC5ggS5xFi7V7MrL5VqfLv9ZlWSjcOAVRpw==}
2864
2880
  engines: {node: '>=18.0.0'}
2865
2881
  hasBin: true
2866
2882
 
@@ -3528,6 +3544,17 @@ packages:
3528
3544
  peerDependencies:
3529
3545
  expo: '*'
3530
3546
 
3547
+ expo-image@3.0.11:
3548
+ resolution: {integrity: sha512-4TudfUCLgYgENv+f48omnU8tjS2S0Pd9EaON5/s1ZUBRwZ7K8acEr4NfvLPSaeXvxW24iLAiyQ7sV7BXQH3RoA==}
3549
+ peerDependencies:
3550
+ expo: '*'
3551
+ react: '*'
3552
+ react-native: '*'
3553
+ react-native-web: '*'
3554
+ peerDependenciesMeta:
3555
+ react-native-web:
3556
+ optional: true
3557
+
3531
3558
  expo-keep-awake@15.0.8:
3532
3559
  resolution: {integrity: sha512-YK9M1VrnoH1vLJiQzChZgzDvVimVoriibiDIFLbQMpjYBnvyfUeHJcin/Gx1a+XgupNXy92EQJLgI/9ZuXajYQ==}
3533
3560
  peerDependencies:
@@ -5947,6 +5974,11 @@ packages:
5947
5974
  resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==}
5948
5975
  engines: {node: '>=12'}
5949
5976
 
5977
+ transliteration@2.6.0:
5978
+ resolution: {integrity: sha512-T6frfMj7N5xNK0l+duIzIWKxkc9ewG72uv7NeOs4dIoysqTnYpwxeVEE5qYdKKmy7hby55ah0wNUoMaLsB2Zjw==}
5979
+ engines: {node: '>=20.0.0'}
5980
+ hasBin: true
5981
+
5950
5982
  ts-api-utils@2.3.0:
5951
5983
  resolution: {integrity: sha512-6eg3Y9SF7SsAvGzRHQvvc1skDAhwI4YQ32ui1scxD1Ccr0G5qIIbUBT3pFTKX8kmWIQClHobtUdNuaBgwdfdWg==}
5952
5984
  engines: {node: '>=18.12'}
@@ -8965,6 +8997,10 @@ snapshots:
8965
8997
  dependencies:
8966
8998
  '@types/node': 25.0.3
8967
8999
 
9000
+ '@types/cors@2.8.19':
9001
+ dependencies:
9002
+ '@types/node': 25.0.3
9003
+
8968
9004
  '@types/estree@1.0.8': {}
8969
9005
 
8970
9006
  '@types/express-serve-static-core@5.1.0':
@@ -9871,6 +9907,11 @@ snapshots:
9871
9907
  dependencies:
9872
9908
  browserslist: 4.28.1
9873
9909
 
9910
+ cors@2.8.5:
9911
+ dependencies:
9912
+ object-assign: 4.1.1
9913
+ vary: 1.1.2
9914
+
9874
9915
  cosmiconfig@7.1.0:
9875
9916
  dependencies:
9876
9917
  '@types/parse-json': 4.0.2
@@ -9879,7 +9920,7 @@ snapshots:
9879
9920
  path-type: 4.0.0
9880
9921
  yaml: 1.10.2
9881
9922
 
9882
- coze-coding-dev-sdk@0.5.6(@types/pg@8.16.0)(openai@6.15.0(ws@8.18.3)(zod@4.3.2))(ws@8.18.3):
9923
+ coze-coding-dev-sdk@0.7.2(@types/pg@8.16.0)(openai@6.15.0(ws@8.18.3)(zod@4.3.2))(ws@8.18.3):
9883
9924
  dependencies:
9884
9925
  '@aws-sdk/client-s3': 3.965.0
9885
9926
  '@aws-sdk/lib-storage': 3.965.0(@aws-sdk/client-s3@3.965.0)
@@ -9892,6 +9933,7 @@ snapshots:
9892
9933
  drizzle-orm: 0.45.1(@types/pg@8.16.0)(pg@8.16.3)
9893
9934
  ora: 9.0.0
9894
9935
  pg: 8.16.3
9936
+ transliteration: 2.6.0
9895
9937
  transitivePeerDependencies:
9896
9938
  - '@aws-sdk/client-rds-data'
9897
9939
  - '@cloudflare/workers-types'
@@ -10656,6 +10698,14 @@ snapshots:
10656
10698
  expo: 54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
10657
10699
  expo-image-loader: 6.0.0(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))
10658
10700
 
10701
+ expo-image@3.0.11(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-web@0.21.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
10702
+ dependencies:
10703
+ expo: 54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
10704
+ react: 19.1.0
10705
+ react-native: 0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0)
10706
+ optionalDependencies:
10707
+ react-native-web: 0.21.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
10708
+
10659
10709
  expo-keep-awake@15.0.8(expo@54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react@19.1.0):
10660
10710
  dependencies:
10661
10711
  expo: 54.0.30(@babel/core@7.28.5)(@expo/metro-runtime@6.1.2)(expo-router@6.0.21)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
@@ -13532,6 +13582,8 @@ snapshots:
13532
13582
  dependencies:
13533
13583
  punycode: 2.3.1
13534
13584
 
13585
+ transliteration@2.6.0: {}
13586
+
13535
13587
  ts-api-utils@2.3.0(typescript@5.9.3):
13536
13588
  dependencies:
13537
13589
  typescript: 5.9.3
@@ -0,0 +1,21 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { createRequire } from 'module';
3
+
4
+ const require = createRequire(import.meta.url);
5
+ const pkg = require('./package.json');
6
+ const dependencies = pkg.dependencies || {};
7
+ const externalList = Object.keys(dependencies).filter(dep => dep !== 'dayjs');
8
+ try {
9
+ await esbuild.build({
10
+ entryPoints: ['src/index.ts'],
11
+ bundle: true,
12
+ platform: 'node',
13
+ format: 'esm',
14
+ outdir: 'dist',
15
+ external: externalList,
16
+ });
17
+ console.log('⚡ Build complete!');
18
+ } catch (e) {
19
+ console.error(e);
20
+ process.exit(1);
21
+ }
@@ -4,13 +4,14 @@
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "preinstall": "npx only-allow pnpm",
7
- "dev": "NODE_ENV=development tsx ./src/index.ts",
8
- "build": "pnpm exec esbuild src/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist",
7
+ "dev": "bash ../.cozeproj/scripts/server_dev_run.sh",
8
+ "build": "node build.js",
9
9
  "start": "NODE_ENV=production PORT=${PORT:-5000} node dist/index.js"
10
10
  },
11
11
  "dependencies": {
12
12
  "express": "^4.22.1",
13
- "coze-coding-dev-sdk": "^0.5.5",
13
+ "cors": "^2.8.5",
14
+ "coze-coding-dev-sdk": "^0.7.2",
14
15
  "dayjs": "^1.11.19",
15
16
  "drizzle-orm": "^0.45.1",
16
17
  "drizzle-zod": "^0.8.3",
@@ -19,6 +20,7 @@
19
20
  "zod": "^4.2.1"
20
21
  },
21
22
  "devDependencies": {
23
+ "@types/cors": "^2.8.19",
22
24
  "@types/express": "^5.0.6",
23
25
  "tsx": "^4.21.0",
24
26
  "@types/multer": "^2.0.0",
@@ -1,12 +1,19 @@
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({ limit: '50mb' }));
10
+ app.use(express.urlencoded({ limit: '50mb', extended: true }));
11
+
12
+ app.get('/api/v1/health', (req, res) => {
13
+ res.status(200).json({ status: 'ok' });
8
14
  });
9
15
 
16
+
10
17
  app.listen(port, () => {
11
18
  console.log(`Server listening at http://localhost:${port}/`);
12
19
  });
@@ -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,
@@ -2,6 +2,7 @@
2
2
  requires = ["nodejs-24"]
3
3
 
4
4
  [dev]
5
+ build = ["bash", "./scripts/prepare.sh"]
5
6
  run = ["bash", "./scripts/dev.sh"]
6
7
  deps = ["git"] # -> apt install git
7
8
 
@@ -1,3 +1,4 @@
1
+ loglevel=error
1
2
  registry=https://registry.npmmirror.com
2
3
 
3
4
  strictStorePkgContentCheck=false
@@ -1,8 +1,19 @@
1
1
  import type { NextConfig } from 'next';
2
+ import path from 'path';
2
3
 
3
4
  const nextConfig: NextConfig = {
5
+ // outputFileTracingRoot: path.resolve(__dirname, '../../'),
4
6
  /* config options here */
5
7
  allowedDevOrigins: ['*.dev.coze.site'],
8
+ images: {
9
+ remotePatterns: [
10
+ {
11
+ protocol: 'https',
12
+ hostname: 'lf-coze-web-cdn.coze.cn',
13
+ pathname: '/**',
14
+ },
15
+ ],
16
+ },
6
17
  };
7
18
 
8
19
  export default nextConfig;
@@ -7,7 +7,8 @@
7
7
  "dev": "bash ./scripts/dev.sh",
8
8
  "preinstall": "npx only-allow pnpm",
9
9
  "lint": "eslint",
10
- "start": "bash ./scripts/start.sh"
10
+ "start": "bash ./scripts/start.sh",
11
+ "ts-check": "tsc -p tsconfig.json"
11
12
  },
12
13
  "dependencies": {
13
14
  "@aws-sdk/client-s3": "^3.958.0",
@@ -42,7 +43,7 @@
42
43
  "class-variance-authority": "^0.7.1",
43
44
  "clsx": "^2.1.1",
44
45
  "cmdk": "^1.1.1",
45
- "coze-coding-dev-sdk": "^0.5.2",
46
+ "coze-coding-dev-sdk": "^0.7.0",
46
47
  "date-fns": "^4.1.0",
47
48
  "drizzle-kit": "^0.31.8",
48
49
  "drizzle-orm": "^0.45.1",
@@ -105,8 +105,8 @@ importers:
105
105
  specifier: ^1.1.1
106
106
  version: 1.1.1(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
107
107
  coze-coding-dev-sdk:
108
- specifier: ^0.5.2
109
- version: 0.5.4(@types/pg@8.16.0)(openai@6.15.0(zod@4.3.5))
108
+ specifier: ^0.7.0
109
+ version: 0.7.2(@types/pg@8.16.0)(openai@6.15.0(zod@4.3.5))
110
110
  date-fns:
111
111
  specifier: ^4.1.0
112
112
  version: 4.1.0
@@ -2747,8 +2747,8 @@ packages:
2747
2747
  typescript:
2748
2748
  optional: true
2749
2749
 
2750
- coze-coding-dev-sdk@0.5.4:
2751
- resolution: {integrity: sha512-nIH2hMFlO2PSnqdslFzOITK+2FhR64caoYFuzy2ma+ceu0o2Spe7tLYLIsyUc42Prr5gXqk4MZESQqpXD34ZwQ==}
2750
+ coze-coding-dev-sdk@0.7.2:
2751
+ resolution: {integrity: sha512-IAAbI8W6MHL95BV/OmiacM2aMzkruyBwUMsvzJk/9jBT9vra2xiUC5ggS5xFi7V7MrL5VqfLv9ZlWSjcOAVRpw==}
2752
2752
  engines: {node: '>=18.0.0'}
2753
2753
  hasBin: true
2754
2754
 
@@ -4820,6 +4820,11 @@ packages:
4820
4820
  resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==}
4821
4821
  engines: {node: '>=16'}
4822
4822
 
4823
+ transliteration@2.6.0:
4824
+ resolution: {integrity: sha512-T6frfMj7N5xNK0l+duIzIWKxkc9ewG72uv7NeOs4dIoysqTnYpwxeVEE5qYdKKmy7hby55ah0wNUoMaLsB2Zjw==}
4825
+ engines: {node: '>=20.0.0'}
4826
+ hasBin: true
4827
+
4823
4828
  ts-api-utils@2.3.0:
4824
4829
  resolution: {integrity: sha512-6eg3Y9SF7SsAvGzRHQvvc1skDAhwI4YQ32ui1scxD1Ccr0G5qIIbUBT3pFTKX8kmWIQClHobtUdNuaBgwdfdWg==}
4825
4830
  engines: {node: '>=18.12'}
@@ -7931,7 +7936,7 @@ snapshots:
7931
7936
  optionalDependencies:
7932
7937
  typescript: 5.9.3
7933
7938
 
7934
- coze-coding-dev-sdk@0.5.4(@types/pg@8.16.0)(openai@6.15.0(zod@4.3.5)):
7939
+ coze-coding-dev-sdk@0.7.2(@types/pg@8.16.0)(openai@6.15.0(zod@4.3.5)):
7935
7940
  dependencies:
7936
7941
  '@aws-sdk/client-s3': 3.962.0
7937
7942
  '@aws-sdk/lib-storage': 3.962.0(@aws-sdk/client-s3@3.962.0)
@@ -7944,6 +7949,7 @@ snapshots:
7944
7949
  drizzle-orm: 0.45.1(@types/pg@8.16.0)(pg@8.16.3)
7945
7950
  ora: 9.0.0
7946
7951
  pg: 8.16.3
7952
+ transliteration: 2.6.0
7947
7953
  transitivePeerDependencies:
7948
7954
  - '@aws-sdk/client-rds-data'
7949
7955
  - '@cloudflare/workers-types'
@@ -10186,6 +10192,8 @@ snapshots:
10186
10192
  dependencies:
10187
10193
  tldts: 7.0.19
10188
10194
 
10195
+ transliteration@2.6.0: {}
10196
+
10189
10197
  ts-api-utils@2.3.0(typescript@5.9.3):
10190
10198
  dependencies:
10191
10199
  typescript: 5.9.3
@@ -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
@@ -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,4 +1,6 @@
1
1
  import type { Metadata } from 'next';
2
+ import Image from 'next/image';
3
+ import { Button } from '@/components/ui/button';
2
4
 
3
5
  export const metadata: Metadata = {
4
6
  title: '扣子编程 - AI 开发伙伴',
@@ -7,31 +9,29 @@ export const metadata: Metadata = {
7
9
 
8
10
  export default function Home() {
9
11
  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">
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
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">
13
15
  {/* 头部:Logo 和 产品名称 */}
14
16
  <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"
17
+ <Image
18
+ src="https://lf-coze-web-cdn.coze.cn/obj/eden-cn/lm-lgvj/ljhwZthlaukjlkulzlp/favicon.svg"
19
19
  alt="扣子编程 Logo"
20
20
  width={40}
21
21
  height={40}
22
- style={{ width: '40px', height: '40px', objectFit: 'contain' }}
22
+ unoptimized
23
23
  />
24
- <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">
25
25
  扣子编程
26
26
  </span>
27
27
  </div>
28
28
 
29
29
  {/* 中间内容区:主标题和副标题 */}
30
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">
31
+ <h1 className="max-w-xl text-4xl font-semibold leading-tight tracking-tight text-foreground dark:text-foreground">
32
32
  扣子编程,你的 AI 开发伙伴已就位
33
33
  </h1>
34
- <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">
35
35
  当前是空白入口文件,项目正在开发中,请稍候...
36
36
  <br />
37
37
  开发完成后界面将自动更新。如未自动更新成功,可以手动点击右上角刷新或重启按钮查看效果。
@@ -41,24 +41,36 @@ export default function Home() {
41
41
  {/* 底部按钮区 */}
42
42
  <div className="flex w-full flex-col gap-4 text-base font-medium sm:w-auto sm:flex-row">
43
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"
44
+ <Button
45
+ asChild
46
+ variant="default"
47
+ size="lg"
48
+ className="h-12 min-w-[160px] rounded-full px-8"
49
49
  >
50
- 前往首页
51
- </a>
50
+ <a
51
+ href="https://code.coze.cn/"
52
+ target="_blank"
53
+ rel="noopener noreferrer"
54
+ >
55
+ 前往首页
56
+ </a>
57
+ </Button>
52
58
 
53
59
  {/* 按钮 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"
60
+ <Button
61
+ asChild
62
+ variant="outline"
63
+ size="lg"
64
+ className="h-12 min-w-[160px] rounded-full px-8"
59
65
  >
60
- 查看文档
61
- </a>
66
+ <a
67
+ href="https://docs.coze.cn/"
68
+ target="_blank"
69
+ rel="noopener noreferrer"
70
+ >
71
+ 查看文档
72
+ </a>
73
+ </Button>
62
74
  </div>
63
75
  </main>
64
76
  </div>