@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.
- package/README.md +49 -1
- package/bin/commands/add.js +563 -269
- package/bin/commands/create.js +6 -3
- package/bin/runtime-version.js +37 -0
- package/bin/utils.js +147 -45
- package/package.json +5 -3
- package/templates/basic/.env.example +8 -0
- package/templates/basic/README.md +53 -22
- package/templates/basic/index.html +2 -2
- package/templates/basic/package.json +12 -16
- package/templates/basic/public/favicon.svg +1 -0
- package/templates/basic/public/icons.svg +24 -0
- package/templates/basic/src/App.vue +111 -119
- package/templates/basic/src/main.ts +2 -2
- package/templates/basic/tsconfig.app.json +2 -5
- package/templates/basic/tsconfig.node.json +3 -6
- package/templates/basic/vite.config.ts +6 -1
- package/templates/chat/.env.example +9 -0
- package/templates/chat/README.md +46 -0
- package/templates/chat/index.html +12 -0
- package/templates/chat/package.json +28 -0
- package/templates/chat/src/TinyRobotChat.vue +88 -27
- package/templates/chat/src/components/ComposerTools.vue +99 -0
- package/templates/chat/src/components/WindowHeader.vue +192 -0
- package/templates/chat/src/composables/useWindow.ts +83 -0
- package/templates/chat/src/config/chat-runtime.ts +82 -0
- package/templates/chat/src/config/chat-ui.ts +289 -0
- package/templates/chat/src/index.css +109 -0
- package/templates/chat/src/main.ts +7 -0
- package/templates/chat/tsconfig.app.json +13 -0
- package/templates/chat/tsconfig.json +7 -0
- package/templates/chat/tsconfig.node.json +19 -0
- package/templates/chat/vite.config.ts +16 -0
- package/templates/basic/public/modelcontextprotocol.png +0 -0
- package/templates/basic/src/components/ChatList.vue +0 -82
- package/templates/basic/src/components/ChatSender.vue +0 -125
- package/templates/basic/src/components/ConversationHistory.vue +0 -136
- package/templates/basic/src/components/HistoryDrawerButton.vue +0 -43
- package/templates/basic/src/components/McpServerPickerButton.vue +0 -278
- package/templates/basic/src/components/ThemeToggleButton.vue +0 -44
- package/templates/basic/src/components/icons/IconDeepThink.vue +0 -29
- package/templates/basic/src/components/icons/IconModelAliyunBailian.vue +0 -51
- package/templates/basic/src/components/icons/IconModelDeepseek.vue +0 -29
- package/templates/basic/src/components/icons/IconMoon.vue +0 -29
- package/templates/basic/src/components/icons/IconPlugin.vue +0 -29
- package/templates/basic/src/components/icons/IconSun.vue +0 -35
- package/templates/basic/src/components/icons/IconWebSearch.vue +0 -36
- package/templates/basic/src/components/icons/index.ts +0 -7
- package/templates/basic/src/composables/useChat.ts +0 -129
- package/templates/basic/src/composables/useMcp.ts +0 -170
- package/templates/basic/src/composables/useModel.ts +0 -82
- package/templates/basic/src/mcpServers.ts +0 -40
- 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
|
|
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:
|