@opentiny/tiny-robot-cli 0.5.2-alpha.13 → 0.5.2-alpha.14

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 (48) hide show
  1. package/README.md +32 -5
  2. package/bin/commands/add.js +589 -198
  3. package/bin/utils.js +139 -47
  4. package/package.json +4 -3
  5. package/templates/basic/.env.example +8 -0
  6. package/templates/basic/README.md +53 -22
  7. package/templates/basic/index.html +2 -2
  8. package/templates/basic/package.json +12 -16
  9. package/templates/basic/public/favicon.svg +1 -0
  10. package/templates/basic/public/icons.svg +24 -0
  11. package/templates/basic/src/App.vue +112 -119
  12. package/templates/basic/src/main.ts +2 -2
  13. package/templates/basic/tsconfig.app.json +2 -5
  14. package/templates/basic/tsconfig.node.json +3 -6
  15. package/templates/basic/vite.config.ts +6 -1
  16. package/templates/chat/.env.example +8 -0
  17. package/templates/chat/README.md +21 -13
  18. package/templates/chat/package.json +5 -5
  19. package/templates/chat/src/TinyRobotChat.vue +52 -132
  20. package/templates/chat/src/components/ComposerTools.vue +99 -0
  21. package/templates/chat/src/{tiny-robot-chat/components → components}/WindowHeader.vue +1 -1
  22. package/templates/chat/src/{tiny-robot-chat/composables → composables}/useWindow.ts +8 -18
  23. package/templates/chat/src/config/chat-runtime.ts +82 -0
  24. package/templates/chat/src/{tiny-robot-chat/config → config}/chat-ui.ts +22 -4
  25. package/templates/chat/src/index.css +116 -0
  26. package/templates/chat/src/main.ts +3 -0
  27. package/templates/basic/public/modelcontextprotocol.png +0 -0
  28. package/templates/basic/src/components/ChatList.vue +0 -82
  29. package/templates/basic/src/components/ChatSender.vue +0 -125
  30. package/templates/basic/src/components/ConversationHistory.vue +0 -136
  31. package/templates/basic/src/components/HistoryDrawerButton.vue +0 -43
  32. package/templates/basic/src/components/McpServerPickerButton.vue +0 -278
  33. package/templates/basic/src/components/ThemeToggleButton.vue +0 -44
  34. package/templates/basic/src/components/icons/IconDeepThink.vue +0 -29
  35. package/templates/basic/src/components/icons/IconModelAliyunBailian.vue +0 -51
  36. package/templates/basic/src/components/icons/IconModelDeepseek.vue +0 -29
  37. package/templates/basic/src/components/icons/IconMoon.vue +0 -29
  38. package/templates/basic/src/components/icons/IconPlugin.vue +0 -29
  39. package/templates/basic/src/components/icons/IconSun.vue +0 -35
  40. package/templates/basic/src/components/icons/IconWebSearch.vue +0 -36
  41. package/templates/basic/src/components/icons/index.ts +0 -7
  42. package/templates/basic/src/composables/useChat.ts +0 -129
  43. package/templates/basic/src/composables/useMcp.ts +0 -170
  44. package/templates/basic/src/composables/useModel.ts +0 -82
  45. package/templates/basic/src/mcpServers.ts +0 -40
  46. package/templates/basic/src/models.ts +0 -81
  47. package/templates/chat/src/tiny-robot-chat/components/ComposerTools.vue +0 -72
  48. package/templates/chat/src/tiny-robot-chat/config/chat-runtime.ts +0 -26
package/README.md CHANGED
@@ -7,22 +7,49 @@ A lightweight CLI for scaffolding TinyRobot-based product projects.
7
7
  ```bash
8
8
  npx @opentiny/tiny-robot-cli create my-app
9
9
  pnpm dlx @opentiny/tiny-robot-cli create my-app
10
- npx @opentiny/tiny-robot-cli add chat
10
+ npx @opentiny/tiny-robot-cli add chat --yes
11
11
  ```
12
12
 
13
13
  ## Options
14
14
 
15
- - `-t, --template <name>`: template name, currently supports `basic`
15
+ - `-t, --template <name>`: template name; `basic` generates the Chat Basic project
16
16
  - `-h, --help`: show help
17
17
 
18
- `add chat` adds a self-contained floating Chat component, including its runtime, UI configuration, composables, component-scoped styles, and supporting components. It updates these OpenTiny dependencies to `0.5.2-alpha.10`:
18
+ `create` is an overall project scaffold. The `basic` template is aligned with `packages/chat-basic` and is copied into a new project.
19
+
20
+ `add chat` is a local feature injection for an existing Vue project. It creates the isolated `src/tiny-robot-chat/` feature from `packages/cli/templates/chat`, adds the runtime dependencies (including `@vueuse/core`), and imports the feature CSS. It does not modify the host project's Vite configuration. Existing files with different contents are reported as conflicts and are never silently overwritten.
21
+
22
+ By default, `add chat` mounts `TinyRobotChat` into a standard `src/App.vue` when a safe template and script setup block are available, so the generated project includes the floating AI trigger. Use `--no-mount` to keep `App.vue` unchanged and print the mount snippet. Use `--dry-run` to inspect the plan without changing files and `--yes` to skip prompts:
23
+
24
+ ```bash
25
+ npx @opentiny/tiny-robot-cli add chat --dry-run
26
+ npx @opentiny/tiny-robot-cli add chat --yes
27
+ npx @opentiny/tiny-robot-cli add chat --yes --no-mount
28
+ ```
29
+
30
+ The feature adds or preserves these dependencies. Compatible versions are kept, and higher versions are not downgraded:
19
31
 
20
32
  - `@opentiny/tiny-robot`
21
33
  - `@opentiny/tiny-robot-chat`
22
34
  - `@opentiny/tiny-robot-kit`
23
35
  - `@opentiny/tiny-robot-svgs`
24
-
25
- It also adds `@vueuse/core@13.9.0`. The command does not modify the application entry file or create `src/index.css`. Configure a private environment file from the generated `.env.example` before starting the project; the generated example only includes the Qwen and DeepSeek API key variables. Their API URL variables remain optional overrides for proxies, private gateways, or other regions. The CLI never creates or modifies `.env`.
36
+ - `@vueuse/core`
37
+
38
+ Copy the generated `.env.example` to `.env.local`, then configure the provider API URL and API key before starting the project. `add chat` does not create or modify `.env`.
39
+
40
+ The Model Context MCP example uses `/modelcontextprotocol-mcp`. Add this proxy manually to the existing `vite.config.*` file under `server.proxy`, then restart Vite:
41
+
42
+ ```ts
43
+ server: {
44
+ proxy: {
45
+ '/modelcontextprotocol-mcp': {
46
+ target: 'https://modelcontextprotocol.io/mcp',
47
+ changeOrigin: true,
48
+ rewrite: (path) => path.replace(/^\/modelcontextprotocol-mcp/, ''),
49
+ },
50
+ },
51
+ },
52
+ ```
26
53
 
27
54
  ## Template Documentation
28
55