@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
@@ -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 Nuxt dev server on port ${PORT}..."
37
+ echo "Starting Nuxt dev server on port ${DEPLOY_RUN_PORT}..."
38
38
 
39
- PORT=$PORT pnpm nuxt dev
39
+ PORT=${DEPLOY_RUN_PORT} pnpm nuxt dev
@@ -1,3 +1,4 @@
1
1
  node_modules
2
2
  dist
3
- .env
3
+ .env
4
+ .preview
@@ -46,7 +46,7 @@
46
46
  "@types/node": "^24.3.0",
47
47
  "@types/react": "^18.3.12",
48
48
  "@types/react-dom": "^18.3.1",
49
- "@types/ws": "^8.5.10",
49
+ "@types/ws": "^8.18.1",
50
50
  "@vitejs/plugin-react": "^4.3.3",
51
51
  "autoprefixer": "^10.4.27",
52
52
  "postcss": "^8.5.9",
@@ -88,7 +88,7 @@ importers:
88
88
  specifier: ^18.3.1
89
89
  version: 18.3.7(@types/react@18.3.28)
90
90
  '@types/ws':
91
- specifier: ^8.5.10
91
+ specifier: ^8.18.1
92
92
  version: 8.18.1
93
93
  '@vitejs/plugin-react':
94
94
  specifier: ^4.3.3
@@ -171,7 +171,7 @@ test("web-search: returns error content on search failure", async (t) => {
171
171
  });
172
172
 
173
173
  test("web-search: defaults count to 10 and type to web", async (t) => {
174
- const captured: any[] = [];
174
+ const captured: Array<{ query: string; count: number; needSummary?: boolean }> = [];
175
175
  t.mock.method(SearchClient.prototype, "webSearch", async (query: string, count: number, needSummary?: boolean) => {
176
176
  captured.push({ query, count, needSummary });
177
177
  return makeWebSearchResponse();
@@ -181,7 +181,7 @@ test("web-search: defaults count to 10 and type to web", async (t) => {
181
181
 
182
182
  assert.equal(captured[0].query, "hello");
183
183
  assert.equal(captured[0].count, 10);
184
- assert.equal((captured[0] as any).needSummary, undefined);
184
+ assert.equal(captured[0].needSummary, undefined);
185
185
  });
186
186
 
187
187
  test("web-search: details contain correct metadata", async (t) => {
@@ -39,3 +39,4 @@ pnpm-debug.log*
39
39
 
40
40
  # Key
41
41
  # key/
42
+ .preview
@@ -46,11 +46,11 @@ const CollapsibleTrigger = React.forwardRef<
46
46
  <View
47
47
  ref={ref}
48
48
  className={className}
49
- onClick={(e: any) => {
49
+ onClick={(e) => {
50
50
  context?.onOpenChange(!context.open)
51
51
  onClick?.(e)
52
52
  }}
53
- {...(props as any)}
53
+ {...props}
54
54
  />
55
55
  )
56
56
  })
@@ -83,8 +83,8 @@ const HoverCard = ({
83
83
  const HoverCardTrigger = React.forwardRef<
84
84
  React.ElementRef<typeof View>,
85
85
  React.ComponentPropsWithoutRef<typeof View> & {
86
- onMouseEnter?: (e: any) => void
87
- onMouseLeave?: (e: any) => void
86
+ onMouseEnter?: (e: React.MouseEvent) => void
87
+ onMouseLeave?: (e: React.MouseEvent) => void
88
88
  }
89
89
  >(({ className, children, onClick, onMouseEnter, onMouseLeave, ...props }, ref) => {
90
90
  const context = React.useContext(HoverCardContext)
@@ -101,15 +101,15 @@ const HoverCardTrigger = React.forwardRef<
101
101
  }}
102
102
  {...(isH5()
103
103
  ? ({
104
- onMouseEnter: (e: any) => {
104
+ onMouseEnter: (e: React.MouseEvent) => {
105
105
  onMouseEnter?.(e)
106
106
  context?.setHoverPart?.("trigger", true)
107
107
  },
108
- onMouseLeave: (e: any) => {
108
+ onMouseLeave: (e: React.MouseEvent) => {
109
109
  onMouseLeave?.(e)
110
110
  context?.setHoverPart?.("trigger", false)
111
111
  },
112
- } as any)
112
+ } as React.ComponentPropsWithoutRef<typeof View>)
113
113
  : {})}
114
114
  >
115
115
  {children}
@@ -124,8 +124,8 @@ const HoverCardContent = React.forwardRef<
124
124
  align?: "start" | "center" | "end"
125
125
  side?: "top" | "bottom" | "left" | "right"
126
126
  sideOffset?: number
127
- onMouseEnter?: (e: any) => void
128
- onMouseLeave?: (e: any) => void
127
+ onMouseEnter?: (e: React.MouseEvent) => void
128
+ onMouseLeave?: (e: React.MouseEvent) => void
129
129
  }
130
130
  >(
131
131
  (
@@ -262,15 +262,15 @@ const HoverCardContent = React.forwardRef<
262
262
  style={contentStyle}
263
263
  {...(isH5()
264
264
  ? ({
265
- onMouseEnter: (e: any) => {
265
+ onMouseEnter: (e: React.MouseEvent) => {
266
266
  onMouseEnter?.(e)
267
267
  context?.setHoverPart?.("content", true)
268
268
  },
269
- onMouseLeave: (e: any) => {
269
+ onMouseLeave: (e: React.MouseEvent) => {
270
270
  onMouseLeave?.(e)
271
271
  context?.setHoverPart?.("content", false)
272
272
  },
273
- } as any)
273
+ } as React.ComponentPropsWithoutRef<typeof View>)
274
274
  : {})}
275
275
  />
276
276
  </Portal>
@@ -1,5 +1,6 @@
1
1
  import * as React from "react"
2
- import { View, Input } from "@tarojs/components"
2
+ import { View, Input, type BaseEventOrig } from "@tarojs/components"
3
+ import { type InputProps } from "@tarojs/components/types/Input"
3
4
  import { Dot } from "lucide-react-taro"
4
5
  import { cn } from "@/lib/utils"
5
6
 
@@ -27,7 +28,7 @@ const InputOTP = React.forwardRef<
27
28
  const [isFocused, setIsFocused] = React.useState(false)
28
29
  const value = valueProp !== undefined ? valueProp : valueState
29
30
 
30
- const handleChange = (e: any) => {
31
+ const handleChange = (e: BaseEventOrig<InputProps.inputValueEventDetail>) => {
31
32
  const newValue = e.detail.value
32
33
  if (newValue.length <= maxLength) {
33
34
  if (valueProp === undefined) {
@@ -1,6 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { View } from "@tarojs/components"
3
- import Taro from "@tarojs/taro"
3
+ import Taro, { type ITouchEvent } from "@tarojs/taro"
4
4
 
5
5
  import { cn } from "@/lib/utils"
6
6
 
@@ -79,7 +79,7 @@ const Slider = React.forwardRef<
79
79
  }
80
80
  }
81
81
 
82
- const handleTouchStart = (e: any) => {
82
+ const handleTouchStart = (e: ITouchEvent) => {
83
83
  if (disabled) return
84
84
  setIsDragging(true)
85
85
  // Try to update rect on touch start in case of layout changes
@@ -135,7 +135,7 @@ const Slider = React.forwardRef<
135
135
  }
136
136
  }
137
137
 
138
- const handleTouchMove = (e: any) => {
138
+ const handleTouchMove = (e: ITouchEvent) => {
139
139
  if (disabled) return
140
140
  const touch = e.touches[0] || e.changedTouches[0]
141
141
  if (touch) {
@@ -143,7 +143,7 @@ const Slider = React.forwardRef<
143
143
  }
144
144
  }
145
145
 
146
- const handleTouchEnd = (e: any) => {
146
+ const handleTouchEnd = (e: ITouchEvent) => {
147
147
  if (disabled) return
148
148
  setIsDragging(false)
149
149
  const touch = e.touches[0] || e.changedTouches[0]
@@ -1,5 +1,6 @@
1
1
  import * as React from "react"
2
2
  import { View } from "@tarojs/components"
3
+ import { type ITouchEvent } from "@tarojs/taro"
3
4
  import { cn } from "@/lib/utils"
4
5
 
5
6
  const TabsContext = React.createContext<{
@@ -62,7 +63,7 @@ const TabsTrigger = React.forwardRef<
62
63
  const context = React.useContext(TabsContext)
63
64
  const isActive = context?.value === value
64
65
 
65
- const handleClick = (e: any) => {
66
+ const handleClick = (e: ITouchEvent) => {
66
67
  if (disabled) return
67
68
  context?.onValueChange?.(value)
68
69
  onClick?.(e)
@@ -119,7 +119,7 @@ const toast = Object.assign(toastFn, {
119
119
  data: {
120
120
  loading?: string | React.ReactNode
121
121
  success?: string | React.ReactNode | ((data: T) => React.ReactNode)
122
- error?: string | React.ReactNode | ((error: any) => React.ReactNode)
122
+ error?: string | React.ReactNode | ((error: unknown) => React.ReactNode)
123
123
  finally?: () => void
124
124
  } & ToastData
125
125
  ) => {
@@ -92,8 +92,8 @@ const Tooltip = ({
92
92
  const TooltipTrigger = React.forwardRef<
93
93
  React.ElementRef<typeof View>,
94
94
  React.ComponentPropsWithoutRef<typeof View> & {
95
- onMouseEnter?: (e: any) => void
96
- onMouseLeave?: (e: any) => void
95
+ onMouseEnter?: (e: React.MouseEvent) => void
96
+ onMouseLeave?: (e: React.MouseEvent) => void
97
97
  }
98
98
  >(
99
99
  (
@@ -113,15 +113,15 @@ const TooltipTrigger = React.forwardRef<
113
113
  }}
114
114
  {...(isH5()
115
115
  ? ({
116
- onMouseEnter: (e: any) => {
116
+ onMouseEnter: (e: React.MouseEvent) => {
117
117
  onMouseEnter?.(e)
118
118
  context?.setHoverPart?.("trigger", true)
119
119
  },
120
- onMouseLeave: (e: any) => {
120
+ onMouseLeave: (e: React.MouseEvent) => {
121
121
  onMouseLeave?.(e)
122
122
  context?.setHoverPart?.("trigger", false)
123
123
  },
124
- } as any)
124
+ } as React.ComponentPropsWithoutRef<typeof View>)
125
125
  : {})}
126
126
  {...props}
127
127
  >
@@ -142,8 +142,8 @@ const TooltipContent = React.forwardRef<
142
142
  collisionPadding?: number
143
143
  showArrow?: boolean
144
144
  arrowSize?: number
145
- onMouseEnter?: (e: any) => void
146
- onMouseLeave?: (e: any) => void
145
+ onMouseEnter?: (e: React.MouseEvent) => void
146
+ onMouseLeave?: (e: React.MouseEvent) => void
147
147
  }
148
148
  >(
149
149
  (
@@ -432,15 +432,15 @@ const TooltipContent = React.forwardRef<
432
432
  style={contentStyle}
433
433
  {...(isH5()
434
434
  ? ({
435
- onMouseEnter: (e: any) => {
435
+ onMouseEnter: (e: React.MouseEvent) => {
436
436
  onMouseEnter?.(e)
437
437
  context?.setHoverPart?.("content", true)
438
438
  },
439
- onMouseLeave: (e: any) => {
439
+ onMouseLeave: (e: React.MouseEvent) => {
440
440
  onMouseLeave?.(e)
441
441
  context?.setHoverPart?.("content", false)
442
442
  },
443
- } as any)
443
+ } as React.ComponentPropsWithoutRef<typeof View>)
444
444
  : {})}
445
445
  {...props}
446
446
  >
@@ -12,7 +12,7 @@ const toNumber = (v: unknown) => {
12
12
  return 0
13
13
  }
14
14
 
15
- const normalizeRect = (r: any): Rect | null => {
15
+ const normalizeRect = (r: Record<string, unknown> | null | undefined): Rect | null => {
16
16
  if (!r) return null
17
17
  return {
18
18
  left: toNumber(r.left),
@@ -94,6 +94,30 @@
94
94
  "additionalProperties": false
95
95
  }
96
96
  },
97
+ {
98
+ "name": "pi-agent",
99
+ "description": "Pi Agent:`coze init ${COZE_WORKSPACE_PATH} --template pi-agent`\n- 适用:基于 pi-agent-core 的 AI Agent 应用\n- 支持飞书、微信等多渠道接入\n- 内置 Dashboard 管理面板\n- 使用 TypeScript + Express + Vite",
100
+ "location": "./pi-agent",
101
+ "paramsSchema": {
102
+ "type": "object",
103
+ "properties": {
104
+ "port": {
105
+ "type": "number",
106
+ "default": 5000,
107
+ "minimum": 1024,
108
+ "maximum": 65535,
109
+ "description": "Dashboard server port"
110
+ },
111
+ "workspaceDir": {
112
+ "type": "string",
113
+ "default": "/workspace/workspace",
114
+ "description": "Workspace directory path"
115
+ }
116
+ },
117
+ "required": [],
118
+ "additionalProperties": false
119
+ }
120
+ },
97
121
  {
98
122
  "name": "taro",
99
123
  "description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
@@ -157,30 +181,6 @@
157
181
  "required": [],
158
182
  "additionalProperties": false
159
183
  }
160
- },
161
- {
162
- "name": "pi-agent",
163
- "description": "Pi Agent:`coze init ${COZE_WORKSPACE_PATH} --template pi-agent`\n- 适用:基于 pi-agent-core 的 AI Agent 应用\n- 支持飞书、微信等多渠道接入\n- 内置 Dashboard 管理面板\n- 使用 TypeScript + Express + Vite",
164
- "location": "./pi-agent",
165
- "paramsSchema": {
166
- "type": "object",
167
- "properties": {
168
- "port": {
169
- "type": "number",
170
- "default": 5000,
171
- "minimum": 1024,
172
- "maximum": 65535,
173
- "description": "Dashboard server port"
174
- },
175
- "workspaceDir": {
176
- "type": "string",
177
- "default": "/workspace/workspace",
178
- "description": "Workspace directory path"
179
- }
180
- },
181
- "required": [],
182
- "additionalProperties": false
183
- }
184
184
  }
185
185
  ]
186
186
  }
@@ -66,3 +66,4 @@ Thumbs.db
66
66
  .vite/
67
67
 
68
68
  .coze-logs
69
+ .preview
@@ -1,10 +1,27 @@
1
1
  import eslint from '@eslint/js';
2
+ import pluginImport from 'eslint-plugin-import';
2
3
  import tseslint from 'typescript-eslint';
3
4
  import { defineConfig, globalIgnores } from 'eslint/config';
4
5
 
5
6
  export default defineConfig([
6
7
  eslint.configs.recommended,
7
8
  ...tseslint.configs.recommended,
9
+ {
10
+ settings: {
11
+ 'import/extensions': ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
12
+ 'import/resolver': {
13
+ node: {
14
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'],
15
+ },
16
+ },
17
+ },
18
+ plugins: {
19
+ import: pluginImport,
20
+ },
21
+ rules: {
22
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
23
+ },
24
+ },
8
25
  globalIgnores([
9
26
  'dist/**',
10
27
  'dist-server/**',
@@ -24,6 +24,7 @@
24
24
  "coze-coding-dev-sdk": "^0.7.16",
25
25
  "esbuild": "^0.24.2",
26
26
  "eslint": "^9",
27
+ "eslint-plugin-import": "^2.32.0",
27
28
  "only-allow": "^1.2.2",
28
29
  "postcss": "^8.4.49",
29
30
  "tailwindcss": "^3.4.17",