@opentiny/tiny-robot-cli 0.5.2-alpha.3 → 1.0.0-beta.1

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 (53) hide show
  1. package/README.md +49 -1
  2. package/bin/commands/add.js +563 -269
  3. package/bin/commands/create.js +6 -3
  4. package/bin/runtime-version.js +37 -0
  5. package/bin/utils.js +147 -45
  6. package/package.json +5 -3
  7. package/templates/basic/.env.example +8 -0
  8. package/templates/basic/README.md +53 -22
  9. package/templates/basic/index.html +2 -2
  10. package/templates/basic/package.json +12 -16
  11. package/templates/basic/public/favicon.svg +1 -0
  12. package/templates/basic/public/icons.svg +24 -0
  13. package/templates/basic/src/App.vue +111 -119
  14. package/templates/basic/src/main.ts +2 -2
  15. package/templates/basic/tsconfig.app.json +2 -5
  16. package/templates/basic/tsconfig.node.json +3 -6
  17. package/templates/basic/vite.config.ts +6 -1
  18. package/templates/chat/.env.example +9 -0
  19. package/templates/chat/README.md +46 -0
  20. package/templates/chat/index.html +12 -0
  21. package/templates/chat/package.json +28 -0
  22. package/templates/chat/src/TinyRobotChat.vue +88 -27
  23. package/templates/chat/src/components/ComposerTools.vue +99 -0
  24. package/templates/chat/src/components/WindowHeader.vue +192 -0
  25. package/templates/chat/src/composables/useWindow.ts +83 -0
  26. package/templates/chat/src/config/chat-runtime.ts +82 -0
  27. package/templates/chat/src/config/chat-ui.ts +289 -0
  28. package/templates/chat/src/index.css +109 -0
  29. package/templates/chat/src/main.ts +7 -0
  30. package/templates/chat/tsconfig.app.json +13 -0
  31. package/templates/chat/tsconfig.json +7 -0
  32. package/templates/chat/tsconfig.node.json +19 -0
  33. package/templates/chat/vite.config.ts +16 -0
  34. package/templates/basic/public/modelcontextprotocol.png +0 -0
  35. package/templates/basic/src/components/ChatList.vue +0 -82
  36. package/templates/basic/src/components/ChatSender.vue +0 -125
  37. package/templates/basic/src/components/ConversationHistory.vue +0 -136
  38. package/templates/basic/src/components/HistoryDrawerButton.vue +0 -43
  39. package/templates/basic/src/components/McpServerPickerButton.vue +0 -278
  40. package/templates/basic/src/components/ThemeToggleButton.vue +0 -44
  41. package/templates/basic/src/components/icons/IconDeepThink.vue +0 -29
  42. package/templates/basic/src/components/icons/IconModelAliyunBailian.vue +0 -51
  43. package/templates/basic/src/components/icons/IconModelDeepseek.vue +0 -29
  44. package/templates/basic/src/components/icons/IconMoon.vue +0 -29
  45. package/templates/basic/src/components/icons/IconPlugin.vue +0 -29
  46. package/templates/basic/src/components/icons/IconSun.vue +0 -35
  47. package/templates/basic/src/components/icons/IconWebSearch.vue +0 -36
  48. package/templates/basic/src/components/icons/index.ts +0 -7
  49. package/templates/basic/src/composables/useChat.ts +0 -129
  50. package/templates/basic/src/composables/useMcp.ts +0 -170
  51. package/templates/basic/src/composables/useModel.ts +0 -82
  52. package/templates/basic/src/mcpServers.ts +0 -40
  53. package/templates/basic/src/models.ts +0 -81
package/README.md CHANGED
@@ -7,13 +7,61 @@ 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
10
11
  ```
11
12
 
12
13
  ## Options
13
14
 
14
- - `-t, --template <name>`: template name, currently supports `basic`
15
+ - `-t, --template <name>`: template name; `basic` generates the Chat Basic project
16
+ - `--runtime-version <version>`: override the TinyRobot runtime version for local CLI development or diagnosis
15
17
  - `-h, --help`: show help
16
18
 
19
+ `create` is an overall project scaffold. The `basic` template is aligned with `packages/chat-basic` and is copied into a new project.
20
+
21
+ `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@13.9.0`), and imports feature-scoped CSS that does not reset the host document. It does not modify the host project's Vite configuration. Existing files with different contents are reported as conflicts and are never silently overwritten.
22
+
23
+ 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:
24
+
25
+ ```bash
26
+ npx @opentiny/tiny-robot-cli add chat --dry-run
27
+ npx @opentiny/tiny-robot-cli add chat --yes
28
+ npx @opentiny/tiny-robot-cli add chat --yes --no-mount
29
+ ```
30
+
31
+ The feature adds or preserves these dependencies. Compatible versions are kept, and higher versions are not downgraded:
32
+
33
+ - `@opentiny/tiny-robot`
34
+ - `@opentiny/tiny-robot-chat`
35
+ - `@opentiny/tiny-robot-kit`
36
+ - `@opentiny/tiny-robot-svgs`
37
+ - `@vueuse/core`
38
+
39
+ Both `create` and `add chat` derive TinyRobot runtime dependency versions from the CLI package version. Prerelease CLI versions use the same exact runtime version, while stable CLI versions use a caret range:
40
+
41
+ ```text
42
+ CLI 0.5.2-alpha.15 -> runtime 0.5.2-alpha.15
43
+ CLI 0.5.2-beta.3 -> runtime 0.5.2-beta.3
44
+ CLI 0.5.3 -> runtime ^0.5.3
45
+ ```
46
+
47
+ An existing dependency range is preserved when it accepts the target runtime version; for example, `^0.5.1` is kept for a stable `0.5.3` target. Use `--runtime-version` only when testing an unpublished CLI checkout or diagnosing version resolution. The override follows the same prerelease-exact and stable-caret rules.
48
+
49
+ 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`.
50
+
51
+ The Model Context MCP example uses `/modelcontextprotocol-mcp`. Add this proxy manually to the existing `vite.config.*` file under `server.proxy`, then restart Vite:
52
+
53
+ ```ts
54
+ server: {
55
+ proxy: {
56
+ '/modelcontextprotocol-mcp': {
57
+ target: 'https://modelcontextprotocol.io/mcp',
58
+ changeOrigin: true,
59
+ rewrite: (path) => path.replace(/^\/modelcontextprotocol-mcp/, ''),
60
+ },
61
+ },
62
+ },
63
+ ```
64
+
17
65
  ## Template Documentation
18
66
 
19
67
  Template-specific features and environment variables are documented in each template directory, for example: