@coze-arch/cli 0.0.21 → 0.0.23-alpha.65c1bd

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 (43) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +2 -2
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +1 -1
  3. package/lib/__templates__/expo/_gitignore +1 -0
  4. package/lib/__templates__/expo/client/components/Screen.tsx +5 -5
  5. package/lib/__templates__/expo/client/heroui/components/scroll-shadow/scroll-shadow.types.ts +6 -6
  6. package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +2 -2
  7. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-augmented-ref.ts +2 -2
  8. package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +1 -1
  9. package/lib/__templates__/expo/client/package.json +1 -1
  10. package/lib/__templates__/expo/pnpm-lock.yaml +7 -7
  11. package/lib/__templates__/expo/server/package.json +1 -1
  12. package/lib/__templates__/native-static/.coze +2 -2
  13. package/lib/__templates__/native-static/_gitignore +1 -0
  14. package/lib/__templates__/nextjs/_gitignore +1 -0
  15. package/lib/__templates__/nextjs/eslint.config.mjs +1 -0
  16. package/lib/__templates__/nextjs/scripts/dev.sh +4 -4
  17. package/lib/__templates__/nuxt-vue/_gitignore +8 -2
  18. package/lib/__templates__/nuxt-vue/eslint.config.mjs +33 -0
  19. package/lib/__templates__/nuxt-vue/package.json +1 -0
  20. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +1015 -11
  21. package/lib/__templates__/nuxt-vue/scripts/dev.sh +4 -4
  22. package/lib/__templates__/pi-agent/_gitignore +2 -1
  23. package/lib/__templates__/pi-agent/package.json +1 -1
  24. package/lib/__templates__/pi-agent/pnpm-lock.yaml +1 -1
  25. package/lib/__templates__/pi-agent/tests/web-search.test.ts +2 -2
  26. package/lib/__templates__/taro/_gitignore +1 -0
  27. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +2 -2
  28. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +10 -10
  29. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +3 -2
  30. package/lib/__templates__/taro/src/components/ui/slider.tsx +4 -4
  31. package/lib/__templates__/taro/src/components/ui/tabs.tsx +2 -1
  32. package/lib/__templates__/taro/src/components/ui/toast.tsx +1 -1
  33. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +10 -10
  34. package/lib/__templates__/taro/src/lib/measure.ts +1 -1
  35. package/lib/__templates__/templates.json +24 -24
  36. package/lib/__templates__/vite/_gitignore +1 -0
  37. package/lib/__templates__/vite/eslint.config.mjs +17 -0
  38. package/lib/__templates__/vite/package.json +1 -0
  39. package/lib/__templates__/vite/pnpm-lock.yaml +1007 -0
  40. package/lib/__templates__/vite/scripts/dev.sh +4 -4
  41. package/lib/__templates__/vite/server/server.ts +1 -2
  42. package/lib/cli.js +73 -62
  43. package/package.json +12 -13
@@ -2,7 +2,7 @@
2
2
  if [ -z "${BASH_VERSION:-}" ]; then exec /usr/bin/env bash "$0" "$@"; fi
3
3
  set -euo pipefail
4
4
  ROOT_DIR="$(pwd)"
5
- PREVIEW_DIR="${COZE_PREVIEW_DIR:-/source/preview}"
5
+ PREVIEW_DIR="/source/preview"
6
6
 
7
7
  # ==================== 配置项 ====================
8
8
  SERVER_DIR="app"
@@ -43,4 +43,4 @@ if [ -f "$PREVIEW_DIR/post_install.py" ]; then
43
43
  fi
44
44
 
45
45
  echo "==================== 依赖安装完成!====================\n"
46
- echo "下一步:执行 ./deploy_run.sh 启动服务"
46
+ echo "下一步:执行 ./dev_run.sh 启动服务"
@@ -1,5 +1,5 @@
1
1
  ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
2
- PREVIEW_DIR="${COZE_PREVIEW_DIR:-/source/preview}"
2
+ PREVIEW_DIR="/source/preview"
3
3
  LOG_DIR="${COZE_LOG_DIR:-$ROOT_DIR/logs}"
4
4
  LOG_CLIENT_FILE="$LOG_DIR/client.log"
5
5
  mkdir -p "$LOG_DIR"
@@ -10,3 +10,4 @@ expo-env.d.ts
10
10
  logs/
11
11
  *.tsbuildinfo
12
12
  node-compile-cache/
13
+ .preview
@@ -92,7 +92,7 @@ const KeyboardAwareScrollable = ({
92
92
  contentInsetBehaviorIOS,
93
93
  }: KeyboardAwareProps) => {
94
94
  // 获取原始组件的 props
95
- const childAttrs: any = (element as any).props || {};
95
+ const childAttrs = ((element as React.ReactElement).props ?? {}) as Record<string, unknown>;
96
96
  const originStyle = childAttrs['contentContainerStyle'];
97
97
  const styleArray = Array.isArray(originStyle) ? originStyle : originStyle ? [originStyle] : [];
98
98
  const merged = Object.assign({}, ...styleArray);
@@ -117,7 +117,7 @@ const KeyboardAwareScrollable = ({
117
117
  : {}),
118
118
  };
119
119
 
120
- const t = (element as any).type;
120
+ const t = (element as React.ReactElement).type;
121
121
 
122
122
  // 根据组件类型返回对应的 KeyboardAware 版本
123
123
  // 注意:不再使用 KeyboardAvoidingView,直接替换为增强版 ScrollView
@@ -171,7 +171,7 @@ const RawScreen = ({
171
171
  const props = element.props as Record<string, unknown> | undefined;
172
172
  // 仅识别“垂直”滚动容器;横向滚动不视为页面已处理垂直滚动
173
173
  // eslint-disable-next-line react/prop-types
174
- const isHorizontal = !!(props && (props as any).horizontal === true);
174
+ const isHorizontal = !!(props && props.horizontal === true);
175
175
  if ((t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal) return true;
176
176
  const c: React.ReactNode | undefined = props && 'children' in props
177
177
  ? (props.children as React.ReactNode)
@@ -238,8 +238,8 @@ const RawScreen = ({
238
238
  const wrapScrollableWithKeyboardAvoid = (nodes: React.ReactNode): React.ReactNode => {
239
239
  const isVerticalScrollable = (el: React.ReactElement<any, any>): boolean => {
240
240
  const t = el.type;
241
- const elementProps = (el as any).props || {};
242
- const isHorizontal = !!(elementProps as any).horizontal;
241
+ const elementProps = ((el as React.ReactElement).props ?? {}) as Record<string, unknown>;
242
+ const isHorizontal = !!elementProps.horizontal;
243
243
  return (t === ScrollView || t === FlatList || t === SectionList) && !isHorizontal;
244
244
  };
245
245
 
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { ViewProps } from 'react-native';
2
+ import type { ViewProps, StyleProp, ViewStyle } from 'react-native';
3
3
  import type {
4
4
  AnimationRoot,
5
5
  AnimationValue,
@@ -32,11 +32,11 @@ export type ScrollShadowVisibility =
32
32
  | 'none';
33
33
 
34
34
  export interface LinearGradientProps {
35
- colors: any;
36
- locations?: any;
37
- start?: any;
38
- end?: any;
39
- style?: any;
35
+ colors: readonly string[];
36
+ locations?: readonly number[];
37
+ start?: { x: number; y: number };
38
+ end?: { x: number; y: number };
39
+ style?: StyleProp<ViewStyle>;
40
40
  }
41
41
 
42
42
  export type LinearGradientComponent = ComponentType<LinearGradientProps>;
@@ -1,4 +1,4 @@
1
- import { forwardRef, useMemo } from 'react';
1
+ import React, { forwardRef, useMemo } from 'react';
2
2
  import { View, Text as RNText } from 'react-native';
3
3
  import { GestureDetector } from 'react-native-gesture-handler';
4
4
  import Animated from 'react-native-reanimated';
@@ -339,7 +339,7 @@ const ToastClose = forwardRef<View, ToastCloseProps>((props, ref) => {
339
339
  * If hide and id are available from context, use them to hide the toast
340
340
  * Otherwise, use the provided onPress handler
341
341
  */
342
- const handlePress = (event: any) => {
342
+ const handlePress = (event: Parameters<NonNullable<React.ComponentProps<typeof Button>['onPress']>>[0]) => {
343
343
  if (hide && id) {
344
344
  hide(id);
345
345
  }
@@ -3,8 +3,8 @@ import { useImperativeHandle, useRef } from 'react';
3
3
 
4
4
  interface AugmentRefProps<T> {
5
5
  ref: React.Ref<T>;
6
- methods?: Record<string, (...args: any[]) => any>;
7
- deps?: any[];
6
+ methods?: Record<string, (...args: unknown[]) => unknown>;
7
+ deps?: unknown[];
8
8
  }
9
9
 
10
10
  export function useAugmentedRef<T>({
@@ -108,7 +108,7 @@ function useUncontrolledState<T>({
108
108
  * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
109
109
  * prop or avoid re-executing effects when passed as a dependency
110
110
  */
111
- function useCallbackRef<T extends (...args: any[]) => any>(
111
+ function useCallbackRef<T extends (...args: unknown[]) => unknown>(
112
112
  callback: T | undefined
113
113
  ): T {
114
114
  const callbackRef = useRef(callback);
@@ -24,7 +24,7 @@
24
24
  "@react-native-picker/picker": "2.11.1",
25
25
  "@react-navigation/bottom-tabs": "^7.2.0",
26
26
  "@react-navigation/native": "^7.0.14",
27
- "dayjs": "^1.11.19",
27
+ "dayjs": "^1.11.20",
28
28
  "expo": "54.0.33",
29
29
  "expo-auth-session": "~7.0.10",
30
30
  "expo-av": "~16.0.8",
@@ -49,8 +49,8 @@ importers:
49
49
  specifier: ^7.0.14
50
50
  version: 7.1.28(react-native@0.81.5(@babel/core@7.28.6)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
51
51
  dayjs:
52
- specifier: ^1.11.19
53
- version: 1.11.19
52
+ specifier: ^1.11.20
53
+ version: 1.11.20
54
54
  expo:
55
55
  specifier: 54.0.33
56
56
  version: 54.0.33(patch_hash=oibatoworxrl4npxv627d5aa3e)(@babel/core@7.28.6)(@expo/metro-runtime@6.1.2)(expo-router@6.0.23)(react-native-webview@13.15.0(react-native@0.81.5(@babel/core@7.28.6)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(@babel/core@7.28.6)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
@@ -272,8 +272,8 @@ importers:
272
272
  specifier: ^0.7.16
273
273
  version: 0.7.16(openai@6.16.0(ws@8.19.0)(zod@4.3.6))(ws@8.19.0)
274
274
  dayjs:
275
- specifier: ^1.11.19
276
- version: 1.11.19
275
+ specifier: ^1.11.20
276
+ version: 1.11.20
277
277
  dotenv:
278
278
  specifier: ^17.2.3
279
279
  version: 17.2.4
@@ -2711,8 +2711,8 @@ packages:
2711
2711
  resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
2712
2712
  engines: {node: '>= 0.4'}
2713
2713
 
2714
- dayjs@1.11.19:
2715
- resolution: {integrity: sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==}
2714
+ dayjs@1.11.20:
2715
+ resolution: {integrity: sha512-YbwwqR/uYpeoP4pu043q+LTDLFBLApUP6VxRihdfNTqu4ubqMlGDLd6ErXhEgsyvY0K6nCs7nggYumAN+9uEuQ==}
2716
2716
 
2717
2717
  debug@2.6.9:
2718
2718
  resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
@@ -9190,7 +9190,7 @@ snapshots:
9190
9190
  es-errors: 1.3.0
9191
9191
  is-data-view: 1.0.2
9192
9192
 
9193
- dayjs@1.11.19: {}
9193
+ dayjs@1.11.20: {}
9194
9194
 
9195
9195
  debug@2.6.9:
9196
9196
  dependencies:
@@ -13,7 +13,7 @@
13
13
  "@supabase/supabase-js": "2.95.3",
14
14
  "cors": "^2.8.5",
15
15
  "coze-coding-dev-sdk": "^0.7.16",
16
- "dayjs": "^1.11.19",
16
+ "dayjs": "^1.11.20",
17
17
  "dotenv": "^17.2.3",
18
18
  "drizzle-orm": "^0.45.1",
19
19
  "drizzle-zod": "^0.8.3",
@@ -4,8 +4,8 @@ requires = ["python-3.12"]
4
4
 
5
5
  [dev]
6
6
  build = []
7
- run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
7
+ run = [ "sh", "-c", "python -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
8
8
 
9
9
  [deploy]
10
10
  build = []
11
- run = ["python", "-m", "http.server", "5000", "--bind", "0.0.0.0"]
11
+ run = [ "sh", "-c", "python -m http.server ${DEPLOY_RUN_PORT} --bind 0.0.0.0" ]
@@ -0,0 +1 @@
1
+ .preview
@@ -98,3 +98,4 @@ Desktop.ini
98
98
  .turbo
99
99
 
100
100
  .coze-logs
101
+ .preview
@@ -24,6 +24,7 @@ const eslintConfig = defineConfig([
24
24
  ...nextTs,
25
25
  {
26
26
  rules: {
27
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
27
28
  'react-hooks/set-state-in-effect': 'off',
28
29
  'no-restricted-syntax': ['error', ...syntaxRules],
29
30
  },
@@ -9,7 +9,7 @@ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
9
9
  <% } else { %>
10
10
  PORT=<%= port %>
11
11
  COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-$(pwd)}"
12
- DEPLOY_RUN_PORT=<%= port %>
12
+ DEPLOY_RUN_PORT="${DEPLOY_RUN_PORT:-${PORT}}"
13
13
  <% } %>
14
14
 
15
15
  cd "${COZE_WORKSPACE_PATH}"
@@ -32,8 +32,8 @@ kill_port_if_listening() {
32
32
  fi
33
33
  }
34
34
 
35
- echo "Clearing port ${PORT} before start."
35
+ echo "Clearing port ${DEPLOY_RUN_PORT} before start."
36
36
  kill_port_if_listening
37
- echo "Starting HTTP service on port ${PORT} for dev..."
37
+ echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
38
38
 
39
- PORT=$PORT pnpm tsx watch src/server.ts
39
+ PORT=${DEPLOY_RUN_PORT} pnpm tsx watch src/server.ts
@@ -1,4 +1,5 @@
1
1
  # Nuxt dev/build outputs
2
+
2
3
  .output
3
4
  .data
4
5
  .nuxt
@@ -8,18 +9,23 @@ dist
8
9
  node-compile-cache
9
10
 
10
11
  # Node dependencies
12
+
11
13
  node_modules
12
14
 
13
15
  # Logs
16
+
14
17
  logs
15
- *.log
18
+ \*.log
16
19
 
17
20
  # Misc
21
+
18
22
  .DS_Store
19
23
  .fleet
20
24
  .idea
21
25
 
22
26
  # Local env files
27
+
23
28
  .env
24
- .env.*
29
+ .env.\*
25
30
  !.env.example
31
+ .preview
@@ -1,5 +1,6 @@
1
1
  import eslint from '@eslint/js';
2
2
  import tseslint from 'typescript-eslint';
3
+ import pluginImport from 'eslint-plugin-import';
3
4
  import pluginVue from 'eslint-plugin-vue';
4
5
  import { defineConfig, globalIgnores } from 'eslint/config';
5
6
 
@@ -7,6 +8,38 @@ export default defineConfig([
7
8
  eslint.configs.recommended,
8
9
  ...tseslint.configs.recommended,
9
10
  ...pluginVue.configs['flat/recommended'],
11
+ {
12
+ settings: {
13
+ 'import/extensions': [
14
+ '.vue',
15
+ '.ts',
16
+ '.tsx',
17
+ '.js',
18
+ '.jsx',
19
+ '.mjs',
20
+ '.cjs',
21
+ ],
22
+ 'import/resolver': {
23
+ node: {
24
+ extensions: [
25
+ '.vue',
26
+ '.ts',
27
+ '.tsx',
28
+ '.js',
29
+ '.jsx',
30
+ '.mjs',
31
+ '.cjs',
32
+ ],
33
+ },
34
+ },
35
+ },
36
+ plugins: {
37
+ import: pluginImport,
38
+ },
39
+ rules: {
40
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
41
+ },
42
+ },
10
43
  {
11
44
  files: ['**/*.vue'],
12
45
  languageOptions: {
@@ -28,6 +28,7 @@
28
28
  "autoprefixer": "^10.4.20",
29
29
  "coze-coding-dev-sdk": "^0.7.16",
30
30
  "eslint": "^9",
31
+ "eslint-plugin-import": "^2.32.0",
31
32
  "eslint-plugin-vue": "^10",
32
33
  "only-allow": "^1.2.2",
33
34
  "postcss": "^8.4.49",