@ai-setting/roy-agent-cli 1.0.0
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 +126 -0
- package/dist/bin/roy.js +127297 -0
- package/dist/roy-agent-darwin-arm64/bin/roy.js +127297 -0
- package/dist/roy-agent-darwin-x64/bin/roy.js +127297 -0
- package/dist/roy-agent-linux-arm64/bin/roy.js +127297 -0
- package/dist/roy-agent-linux-x64/bin/roy.js +127297 -0
- package/dist/roy-agent-windows-x64/bin/roy.js +127297 -0
- package/package.json +91 -0
- package/src/bin/roy.ts +12 -0
- package/src/cli.ts +101 -0
- package/src/commands/act.ts +480 -0
- package/src/commands/commands-add.ts +110 -0
- package/src/commands/commands-dirs.ts +70 -0
- package/src/commands/commands-info.ts +90 -0
- package/src/commands/commands-list.ts +161 -0
- package/src/commands/commands-remove.ts +147 -0
- package/src/commands/commands.ts +55 -0
- package/src/commands/config/config-service.test.ts +449 -0
- package/src/commands/config/config-service.ts +312 -0
- package/src/commands/config/deep-merge.test.ts +168 -0
- package/src/commands/config/deep-merge.ts +63 -0
- package/src/commands/config/export.ts +97 -0
- package/src/commands/config/filter-history-e2e.test.ts +141 -0
- package/src/commands/config/import-preserve-refs.test.ts +212 -0
- package/src/commands/config/import.ts +119 -0
- package/src/commands/config/index.ts +35 -0
- package/src/commands/config/list.ts +281 -0
- package/src/commands/config/roy-config-e2e.test.ts +297 -0
- package/src/commands/config/types.ts +54 -0
- package/src/commands/debug/index.ts +38 -0
- package/src/commands/debug/log.test.ts +233 -0
- package/src/commands/debug/log.ts +123 -0
- package/src/commands/debug/span.test.ts +297 -0
- package/src/commands/debug/span.ts +211 -0
- package/src/commands/debug/trace.test.ts +254 -0
- package/src/commands/debug/trace.ts +140 -0
- package/src/commands/eventsource/add.ts +133 -0
- package/src/commands/eventsource/index.ts +48 -0
- package/src/commands/eventsource/list.ts +194 -0
- package/src/commands/eventsource/remove.ts +95 -0
- package/src/commands/eventsource/start.ts +103 -0
- package/src/commands/eventsource/status.ts +185 -0
- package/src/commands/eventsource/stop.ts +89 -0
- package/src/commands/index.ts +22 -0
- package/src/commands/input-handler.test.ts +76 -0
- package/src/commands/input-handler.ts +43 -0
- package/src/commands/interactive-esc.test.ts +254 -0
- package/src/commands/interactive.shutdown.test.ts +122 -0
- package/src/commands/interactive.test.ts +221 -0
- package/src/commands/interactive.ts +1015 -0
- package/src/commands/lsp/check.ts +92 -0
- package/src/commands/lsp/index.ts +32 -0
- package/src/commands/lsp/install.ts +126 -0
- package/src/commands/lsp/list.ts +64 -0
- package/src/commands/mcp/index.ts +27 -0
- package/src/commands/mcp/list.ts +116 -0
- package/src/commands/mcp/reload.ts +70 -0
- package/src/commands/mcp/tools.ts +121 -0
- package/src/commands/memory/extract-e2e.test.ts +388 -0
- package/src/commands/memory/index.ts +11 -0
- package/src/commands/memory/memory-simplified.test.ts +58 -0
- package/src/commands/memory/memory.ts +25 -0
- package/src/commands/memory/organize.ts +300 -0
- package/src/commands/memory/recall.test.ts +120 -0
- package/src/commands/memory/recall.ts +88 -0
- package/src/commands/memory/record-extract-handle-query.test.ts +385 -0
- package/src/commands/memory/record-prompt-component.test.ts +343 -0
- package/src/commands/memory/record.test.ts +92 -0
- package/src/commands/memory/record.ts +332 -0
- package/src/commands/plugin.test.ts +292 -0
- package/src/commands/plugin.ts +267 -0
- package/src/commands/sessions/active.ts +96 -0
- package/src/commands/sessions/add-message.ts +96 -0
- package/src/commands/sessions/checkpoints.ts +154 -0
- package/src/commands/sessions/compact.test.ts +215 -0
- package/src/commands/sessions/compact.ts +269 -0
- package/src/commands/sessions/delete.ts +236 -0
- package/src/commands/sessions/get.ts +165 -0
- package/src/commands/sessions/grep.ts +233 -0
- package/src/commands/sessions/index.ts +95 -0
- package/src/commands/sessions/list.ts +210 -0
- package/src/commands/sessions/messages.test.ts +333 -0
- package/src/commands/sessions/messages.ts +248 -0
- package/src/commands/sessions/mock.ts +194 -0
- package/src/commands/sessions/new.ts +82 -0
- package/src/commands/sessions/rename.ts +98 -0
- package/src/commands/shared/event-handler.ts +213 -0
- package/src/commands/shared/event-message-formatter.ts +295 -0
- package/src/commands/shared/index.ts +11 -0
- package/src/commands/shared/query-executor.test.ts +434 -0
- package/src/commands/shared/query-executor.ts +324 -0
- package/src/commands/shared/repl-engine.test.ts +354 -0
- package/src/commands/shared/session-manager.test.ts +212 -0
- package/src/commands/shared/session-manager.ts +114 -0
- package/src/commands/skills/get.ts +90 -0
- package/src/commands/skills/index.ts +39 -0
- package/src/commands/skills/list.ts +129 -0
- package/src/commands/skills/reload.ts +59 -0
- package/src/commands/skills/search.ts +132 -0
- package/src/commands/skills/show-config.ts +93 -0
- package/src/commands/tasks/complete.ts +92 -0
- package/src/commands/tasks/create.ts +118 -0
- package/src/commands/tasks/delete.ts +86 -0
- package/src/commands/tasks/get.ts +116 -0
- package/src/commands/tasks/index.ts +53 -0
- package/src/commands/tasks/list.ts +140 -0
- package/src/commands/tasks/operations.ts +120 -0
- package/src/commands/tasks/update.ts +122 -0
- package/src/commands/tools/exec-tool.ts +128 -0
- package/src/commands/tools/get.ts +114 -0
- package/src/commands/tools/index.ts +35 -0
- package/src/commands/tools/list.ts +107 -0
- package/src/commands/tools/shared/index.ts +7 -0
- package/src/commands/tools/shared/schema-helper.ts +111 -0
- package/src/commands/workflow/commands/add.ts +315 -0
- package/src/commands/workflow/commands/get.ts +193 -0
- package/src/commands/workflow/commands/list.ts +137 -0
- package/src/commands/workflow/commands/nodes.ts +528 -0
- package/src/commands/workflow/commands/remove.ts +94 -0
- package/src/commands/workflow/commands/run.ts +398 -0
- package/src/commands/workflow/commands/status.ts +147 -0
- package/src/commands/workflow/commands/stop.ts +91 -0
- package/src/commands/workflow/commands/update.ts +130 -0
- package/src/commands/workflow/commands/validate.ts +139 -0
- package/src/commands/workflow/commands/workflow-cli.test.ts +196 -0
- package/src/commands/workflow/index.ts +65 -0
- package/src/commands/workflow/renderers.ts +358 -0
- package/src/commands/workflow/validators/index.ts +8 -0
- package/src/commands/workflow/validators/node-validator-factory.ts +40 -0
- package/src/commands/workflow/validators/node-validator.ts +125 -0
- package/src/commands/workflow/validators/nodes/agent-node-validator.ts +58 -0
- package/src/commands/workflow/validators/nodes/condition-node-validator.ts +34 -0
- package/src/commands/workflow/validators/nodes/decorator-node-validator.ts +45 -0
- package/src/commands/workflow/validators/nodes/merge-node-validator.ts +46 -0
- package/src/commands/workflow/validators/nodes/skill-node-validator.ts +33 -0
- package/src/commands/workflow/validators/nodes/tool-node-validator.ts +54 -0
- package/src/commands/workflow/validators/nodes/workflow-node-validator.ts +33 -0
- package/src/commands/workflow/validators/types.ts +78 -0
- package/src/commands/workflow/validators/workflow-validator.test.ts +273 -0
- package/src/commands/workflow/validators/workflow-validator.ts +320 -0
- package/src/index.ts +19 -0
- package/src/plugin/apply.ts +103 -0
- package/src/plugin/discover.ts +219 -0
- package/src/plugin/index.ts +45 -0
- package/src/plugin/registry.ts +272 -0
- package/src/plugin/types.ts +165 -0
- package/src/services/context-handler.service.test.ts +501 -0
- package/src/services/context-handler.service.ts +372 -0
- package/src/services/environment.service.commands-prompt.test.ts +167 -0
- package/src/services/environment.service.ts +656 -0
- package/src/services/output.service.test.ts +92 -0
- package/src/services/output.service.ts +122 -0
- package/src/services/quiet-mode.service.test.ts +114 -0
- package/src/services/quiet-mode.service.ts +81 -0
- package/src/services/stream-output.service.test.ts +214 -0
- package/src/services/stream-output.service.ts +323 -0
- package/src/util/which.test.ts +101 -0
- package/src/util/which.ts +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# @gddzhaokun/roy-agent-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for roy-agent. Provides non-interactive command execution.
|
|
4
|
+
|
|
5
|
+
## Dependencies
|
|
6
|
+
|
|
7
|
+
- `@gddzhaokun/roy-agent-core` ^1.1.0 - Core SDK
|
|
8
|
+
- `chalk` ^5.3.0 - Terminal colors
|
|
9
|
+
- `yargs` ^17.7.2 - CLI argument parsing
|
|
10
|
+
- `zod-to-json-schema` ^3.25.2 - Zod to JSON Schema conversion
|
|
11
|
+
|
|
12
|
+
## Build
|
|
13
|
+
|
|
14
|
+
### Prerequisites
|
|
15
|
+
|
|
16
|
+
**Important**: Build `@gddzhaokun/roy-agent-core` first before building CLI.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 1. Build core first
|
|
20
|
+
cd packages/core
|
|
21
|
+
bun run build:core:prod:single --pack --check
|
|
22
|
+
npm publish --access public --registry=https://npm.pkg.github.com/
|
|
23
|
+
|
|
24
|
+
# 2. Then build CLI
|
|
25
|
+
cd ../cli
|
|
26
|
+
bun run build:cli:prod:single --pack --check
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Build Modes
|
|
30
|
+
|
|
31
|
+
| Mode | Command | Output | Description |
|
|
32
|
+
|------|---------|--------|-------------|
|
|
33
|
+
| Dev Single | `bun run build:cli:dev:single` | `roy.js` | Current platform, with sourcemap |
|
|
34
|
+
| Dev All | `bun run build:cli:dev` | `roy.js` | All platforms, with sourcemap |
|
|
35
|
+
| Prod Single | `bun run build:cli:prod:single` | `roy` | Current platform, standalone exe |
|
|
36
|
+
| Prod All | `bun run build:cli:prod` | `roy` | All platforms, standalone exe |
|
|
37
|
+
|
|
38
|
+
### Build Options
|
|
39
|
+
|
|
40
|
+
| Flag | Description |
|
|
41
|
+
|------|-------------|
|
|
42
|
+
| `--single` | Build for current platform only |
|
|
43
|
+
| `--pack` | Create npm tarball after build |
|
|
44
|
+
| `--publish` | Pack and publish to npm |
|
|
45
|
+
| `--check` | Verify tarball contents |
|
|
46
|
+
|
|
47
|
+
### Build Steps (Production Mode)
|
|
48
|
+
|
|
49
|
+
1. **Build JS library** - Uses `tsc` to compile TypeScript
|
|
50
|
+
2. **Fix ESM imports** - Adds `.js` extensions for Node.js compatibility
|
|
51
|
+
3. **Bundle** - Uses `bun build` to create bundle
|
|
52
|
+
4. **Compile** - Uses `bun compile` to create standalone executable
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
Run from source without building:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bun run dev
|
|
60
|
+
# or
|
|
61
|
+
bun run src/bin/roy.ts
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Interactive mode
|
|
68
|
+
roy
|
|
69
|
+
|
|
70
|
+
# Execute task
|
|
71
|
+
roy act "帮我写一个 hello world"
|
|
72
|
+
|
|
73
|
+
# With options
|
|
74
|
+
roy act "任务" --model gpt-4 --quiet
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Publishing
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Build and pack
|
|
81
|
+
bun run build:cli:prod:single --pack --check
|
|
82
|
+
|
|
83
|
+
# Publish to GitHub Packages
|
|
84
|
+
npm publish --access public --registry=https://npm.pkg.github.com/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Version
|
|
88
|
+
|
|
89
|
+
Current: **1.2.8**
|
|
90
|
+
|
|
91
|
+
To publish a new version:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# 1. Update version in package.json
|
|
95
|
+
vi package.json
|
|
96
|
+
|
|
97
|
+
# 2. Build and pack
|
|
98
|
+
bun run build:cli:prod:single --pack --check
|
|
99
|
+
|
|
100
|
+
# 3. Verify tarball
|
|
101
|
+
tar -tzf gddzhaokun-roy-agent-cli-*.tgz | head -20
|
|
102
|
+
|
|
103
|
+
# 4. Publish
|
|
104
|
+
npm publish --access public --registry=https://npm.pkg.github.com/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Troubleshooting
|
|
108
|
+
|
|
109
|
+
### Type errors when building
|
|
110
|
+
|
|
111
|
+
Ensure `@gddzhaokun/roy-agent-core` is built and published first:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cd packages/core
|
|
115
|
+
bun run build:core:prod:single
|
|
116
|
+
npm publish --access public --registry=https://npm.pkg.github.com/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### CLI commands not working after install
|
|
120
|
+
|
|
121
|
+
Reinstall dependencies:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
rm -rf node_modules
|
|
125
|
+
bun install
|
|
126
|
+
```
|