skillpond-cli 0.1.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 +164 -0
- package/bin/skillpond-cli.js +26 -0
- package/dist/skillpond-cli.exe +0 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Skillpond CLI
|
|
2
|
+
|
|
3
|
+
Go CLI for Yunmai RPA. Auth, script market, browser, and task CRUD commands call the remote API. The CLI mirrors remote task metadata and CLI launch payloads into local SQLite, stores run records locally, and writes all logs to files while `run start` executes `server-rpa-agent`.
|
|
4
|
+
|
|
5
|
+
## Build
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
.\build.ps1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The standalone CLI is written to `dist\skillpond-cli.exe`. No installer is generated.
|
|
12
|
+
|
|
13
|
+
To build it directly with Go:
|
|
14
|
+
|
|
15
|
+
```powershell
|
|
16
|
+
go build -buildvcs=false -trimpath -o dist\skillpond-cli.exe ./cmd/skillpond-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Run with npx
|
|
20
|
+
|
|
21
|
+
The npm package currently contains the Windows x64 Go executable. Node.js is only used as a launcher; the CLI implementation remains in Go.
|
|
22
|
+
|
|
23
|
+
After the package is published:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
npx skillpond-cli --help
|
|
27
|
+
npx skillpond-cli config show
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For a permanent global command:
|
|
31
|
+
|
|
32
|
+
```powershell
|
|
33
|
+
npm install --global skillpond-cli
|
|
34
|
+
skillpond-cli --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Build and inspect the npm package locally:
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
npm.cmd pack --dry-run
|
|
41
|
+
npm.cmd pack
|
|
42
|
+
npx.cmd --yes .\skillpond-cli-0.1.0.tgz --help
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Publish it after logging in to npm:
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
npm.cmd login
|
|
49
|
+
npm.cmd publish
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The package name and version come from `package.json`. Each subsequent publish requires a new version, for example `npm.cmd version patch`.
|
|
53
|
+
|
|
54
|
+
## Configure
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
.\dist\skillpond-cli.exe config set base-url https://api.example.com
|
|
58
|
+
.\dist\skillpond-cli.exe config set db-path D:\tmp\skillpond-cli.db
|
|
59
|
+
.\dist\skillpond-cli.exe config set executor-command "D:\workspace\server_rpa_agent\dist\server-rpa-agent.exe"
|
|
60
|
+
.\dist\skillpond-cli.exe auth login --email user@example.com --password 123456
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Global flags:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
--base-url <url> API base URL override
|
|
67
|
+
--token <token> Bearer token override
|
|
68
|
+
--config <path> config file path
|
|
69
|
+
--db <path> local SQLite database path
|
|
70
|
+
--json pretty-print JSON
|
|
71
|
+
--debug print remote request method and URL
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Remote Task, Local Run
|
|
75
|
+
|
|
76
|
+
Default local database:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
%APPDATA%\skillpond\skillpond-cli.db
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Create a remote task, cache its CLI launch payload locally, and run it:
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
.\dist\skillpond-cli.exe task create --name 采集任务 --browser-id <browser-id> --script-id <script-id> --type local
|
|
86
|
+
.\dist\skillpond-cli.exe task refresh --id <task-id>
|
|
87
|
+
.\dist\skillpond-cli.exe run start --task-id <task-id>
|
|
88
|
+
.\dist\skillpond-cli.exe run list --task-id <task-id>
|
|
89
|
+
.\dist\skillpond-cli.exe run logs --run-id <run-id>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`task create` calls `POST /v1/tasks`, then `POST /v1/tasks/{id}/cli`, and stores both the remote task summary and launch payload in SQLite. `run start` uses the cached CLI payload, so the actual execution path is local.
|
|
93
|
+
|
|
94
|
+
`task create`, `task get`, `run start`, `run list`, and `run get` print compact summaries by default so PowerShell pipelines can safely use `ConvertFrom-Json`. Use `task get --full` or `run get --full` to inspect cached payloads.
|
|
95
|
+
|
|
96
|
+
The executor command is called as:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
<executor-command> execute <task.json> --log-output
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`executor-command` should be the `server-rpa-agent.exe` path plus any global agent flags. For browser tasks, put global flags before `execute` by storing them in the command:
|
|
103
|
+
|
|
104
|
+
```powershell
|
|
105
|
+
.\dist\skillpond-cli.exe config set executor-command "D:\workspace\server_rpa_agent\dist\server-rpa-agent.exe --browser-executable ""C:\Program Files\Google\Chrome\Application\chrome.exe"""
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Exit code `0` marks the run as `SUCCESS`; any non-zero exit code marks it as `FAILED`.
|
|
109
|
+
|
|
110
|
+
Lifecycle logs and agent stdout/stderr are written to files under:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
%APPDATA%\Skillpond\tasks\<task-id>\runs\<run-id>\
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Files:
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
task.json task payload passed to server-rpa-agent
|
|
120
|
+
lifecycle.jsonl
|
|
121
|
+
stdout.log agent stdout
|
|
122
|
+
stderr.log agent stderr
|
|
123
|
+
agent.log combined stdout/stderr with stream prefixes
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Command Mapping
|
|
127
|
+
|
|
128
|
+
| Command | Backend |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| `auth register --email --password [--client-id]` | `POST /v1/users/register` |
|
|
131
|
+
| `auth login --email --password [--client-id]` | `POST /v1/users/login` |
|
|
132
|
+
| `auth logout` | `DELETE /v1/users/logout` |
|
|
133
|
+
| `auth kick-platform --platform cli` | `DELETE /v1/users/tokens/{platform}` |
|
|
134
|
+
| `auth kick-client --platform cli --client-id <id>` | `DELETE /v1/users/tokens/{platform}/{clientId}` |
|
|
135
|
+
| `auth device` | `POST /v1/auth/device/authorize` then poll `POST /v1/auth/device/token` |
|
|
136
|
+
| `auth device-authorize --device-name --client-id` | `POST /v1/auth/device/authorize` |
|
|
137
|
+
| `auth device-token --device-code` | `POST /v1/auth/device/token` |
|
|
138
|
+
| `auth device-confirm --user-code` | `POST /v1/auth/device/confirm` |
|
|
139
|
+
| `script create --name --description --code-file` | `POST /v1/script-market` |
|
|
140
|
+
| `script update --id --name --description --code-file` | `PUT /v1/script-market/{id}` |
|
|
141
|
+
| `script delete --id` | `DELETE /v1/script-market/{id}` |
|
|
142
|
+
| `script get --id` | `GET /v1/script-market/{id}` |
|
|
143
|
+
| `script list --search --page --size` | `GET /v1/script-market` |
|
|
144
|
+
| `script import --file examples/script-import.json` | `POST /v1/script-market/import` |
|
|
145
|
+
| `script add-my --id` | `POST /v1/script-market/{id}/my` |
|
|
146
|
+
| `script remove-my --id` | `DELETE /v1/script-market/{id}/my` |
|
|
147
|
+
| `script my --page --size` | `GET /v1/script-market/my` |
|
|
148
|
+
| `browser template --file examples/browser-template.json` | `POST /v1/browser/template` |
|
|
149
|
+
| `browser create --file examples/browser.json` | `POST /v1/browser` |
|
|
150
|
+
| `browser list --search --page --size` | `GET /v1/browser` |
|
|
151
|
+
| `browser update --id --file examples/browser.json` | `PUT /v1/browser/{id}` |
|
|
152
|
+
| `browser delete --id` | `DELETE /v1/browser/{id}` |
|
|
153
|
+
| `browser launch --id [--script-id]` | `POST /v1/browser/{id}/launcher` |
|
|
154
|
+
| `task create --name --browser-id --script-id --type local` | `POST /v1/tasks` + `POST /v1/tasks/{id}/cli` + local SQLite cache |
|
|
155
|
+
| `task update --id --name --browser-id --script-id --type local` | `PUT /v1/tasks/{id}` + refresh local CLI payload |
|
|
156
|
+
| `task list --page --size` | `GET /v1/tasks` + sync local SQLite cache |
|
|
157
|
+
| `task get --id` | local SQLite task mirror |
|
|
158
|
+
| `task refresh --id` | `POST /v1/tasks/{id}/cli` + update local SQLite payload |
|
|
159
|
+
| `task delete --id` | active-run check + `DELETE /v1/tasks/{id}` + local SQLite delete |
|
|
160
|
+
| `run start --task-id [--executor-command]` | local SQLite cached CLI payload + server-rpa-agent CLI |
|
|
161
|
+
| `run list --task-id --page --size` | local SQLite `task_runs` |
|
|
162
|
+
| `run get --run-id` | local SQLite `task_runs` |
|
|
163
|
+
| `run logs --run-id` | local lifecycle log file |
|
|
164
|
+
| `run cancel --run-id` | local process kill attempt + local SQLite status update |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { spawnSync } = require("node:child_process");
|
|
7
|
+
|
|
8
|
+
if (process.platform !== "win32" || process.arch !== "x64") {
|
|
9
|
+
console.error(
|
|
10
|
+
`skillpond-cli currently supports Windows x64 only (current: ${process.platform}/${process.arch}).`,
|
|
11
|
+
);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const executable = path.resolve(__dirname, "..", "dist", "skillpond-cli.exe");
|
|
16
|
+
const result = spawnSync(executable, process.argv.slice(2), {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
windowsHide: false,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (result.error) {
|
|
22
|
+
console.error(`Failed to start skillpond-cli: ${result.error.message}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process.exit(result.status ?? 1);
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "skillpond-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line client for Skillpond automation workflows",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"skillpond-cli": "bin/skillpond-cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/skillpond-cli.js",
|
|
12
|
+
"dist/skillpond-cli.exe",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"os": [
|
|
16
|
+
"win32"
|
|
17
|
+
],
|
|
18
|
+
"cpu": [
|
|
19
|
+
"x64"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:cli": "set \"GOCACHE=%CD%\\.gocache\" && go build -buildvcs=false -trimpath -o dist/skillpond-cli.exe ./cmd/skillpond-cli",
|
|
26
|
+
"prepack": "npm run build:cli && node --check bin/skillpond-cli.js",
|
|
27
|
+
"test:package": "node bin/skillpond-cli.js --help"
|
|
28
|
+
}
|
|
29
|
+
}
|