@opentiny/tiny-robot-cli 0.5.2-alpha.15 → 0.5.2-alpha.17

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 (51) hide show
  1. package/README.md +1 -38
  2. package/bin/commands/add.js +268 -552
  3. package/bin/utils.js +44 -144
  4. package/package.json +3 -5
  5. package/templates/basic/.env.example +0 -8
  6. package/templates/basic/README.md +22 -53
  7. package/templates/basic/index.html +2 -2
  8. package/templates/basic/package.json +16 -12
  9. package/templates/basic/public/modelcontextprotocol.png +0 -0
  10. package/templates/basic/src/App.vue +119 -112
  11. package/templates/basic/src/components/ChatList.vue +82 -0
  12. package/templates/basic/src/components/ChatSender.vue +125 -0
  13. package/templates/basic/src/components/ConversationHistory.vue +136 -0
  14. package/templates/basic/src/components/HistoryDrawerButton.vue +43 -0
  15. package/templates/basic/src/components/McpServerPickerButton.vue +278 -0
  16. package/templates/basic/src/components/ThemeToggleButton.vue +44 -0
  17. package/templates/basic/src/components/icons/IconDeepThink.vue +29 -0
  18. package/templates/basic/src/components/icons/IconModelAliyunBailian.vue +51 -0
  19. package/templates/basic/src/components/icons/IconModelDeepseek.vue +29 -0
  20. package/templates/basic/src/components/icons/IconMoon.vue +29 -0
  21. package/templates/basic/src/components/icons/IconPlugin.vue +29 -0
  22. package/templates/basic/src/components/icons/IconSun.vue +35 -0
  23. package/templates/basic/src/components/icons/IconWebSearch.vue +36 -0
  24. package/templates/basic/src/components/icons/index.ts +7 -0
  25. package/templates/basic/src/composables/useChat.ts +129 -0
  26. package/templates/basic/src/composables/useMcp.ts +170 -0
  27. package/templates/basic/src/composables/useModel.ts +82 -0
  28. package/templates/basic/src/main.ts +2 -2
  29. package/templates/basic/src/mcpServers.ts +40 -0
  30. package/templates/basic/src/models.ts +81 -0
  31. package/templates/basic/tsconfig.app.json +5 -2
  32. package/templates/basic/tsconfig.node.json +6 -3
  33. package/templates/basic/vite.config.ts +1 -6
  34. package/templates/chat/.env.example +0 -9
  35. package/templates/chat/src/TinyRobotChat.vue +27 -88
  36. package/templates/basic/public/favicon.svg +0 -1
  37. package/templates/basic/public/icons.svg +0 -24
  38. package/templates/chat/README.md +0 -46
  39. package/templates/chat/index.html +0 -12
  40. package/templates/chat/package.json +0 -28
  41. package/templates/chat/src/components/ComposerTools.vue +0 -99
  42. package/templates/chat/src/components/WindowHeader.vue +0 -192
  43. package/templates/chat/src/composables/useWindow.ts +0 -83
  44. package/templates/chat/src/config/chat-runtime.ts +0 -82
  45. package/templates/chat/src/config/chat-ui.ts +0 -290
  46. package/templates/chat/src/index.css +0 -116
  47. package/templates/chat/src/main.ts +0 -7
  48. package/templates/chat/tsconfig.app.json +0 -13
  49. package/templates/chat/tsconfig.json +0 -7
  50. package/templates/chat/tsconfig.node.json +0 -19
  51. package/templates/chat/vite.config.ts +0 -16
package/README.md CHANGED
@@ -7,50 +7,13 @@ 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 --yes
11
10
  ```
12
11
 
13
12
  ## Options
14
13
 
15
- - `-t, --template <name>`: template name; `basic` generates the Chat Basic project
14
+ - `-t, --template <name>`: template name, currently supports `basic`
16
15
  - `-h, --help`: show help
17
16
 
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:
31
-
32
- - `@opentiny/tiny-robot`
33
- - `@opentiny/tiny-robot-chat`
34
- - `@opentiny/tiny-robot-kit`
35
- - `@opentiny/tiny-robot-svgs`
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
- ```
53
-
54
17
  ## Template Documentation
55
18
 
56
19
  Template-specific features and environment variables are documented in each template directory, for example: