@visualautomate/cli 0.3.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +139 -0
  3. package/dist/index.js +2468 -0
  4. package/package.json +44 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WvB Solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # @visualautomate/cli
2
+
3
+ Build and publish VisualAutomate plugins.
4
+
5
+ ```bash
6
+ npm install -g @visualautomate/cli
7
+ visualautomate login
8
+ visualautomate init my-step
9
+ cd my-step
10
+ visualautomate dev # run it on every save
11
+ visualautomate push
12
+ ```
13
+
14
+ `va` is the same command, shorter.
15
+
16
+ That is the whole toolchain. There is nothing else to install: the CLI carries
17
+ the SDK inside it, compiles your TypeScript itself, and writes the type
18
+ declarations into the project. A plugin directory has no `node_modules`, no
19
+ build step and no dependencies.
20
+
21
+ ## What `init` gives you
22
+
23
+ ```
24
+ plugin.ts your code
25
+ manifest.json what the canvas shows, with the rest of the options
26
+ written out as commented examples
27
+ plugin.json name, version, description, category
28
+ test.json the input, config, storage and state `test` runs with
29
+ visualautomate.d.ts the types, written in rather than installed
30
+ tsconfig.json so your editor type-checks it
31
+ ```
32
+
33
+ Templates: `blank`, `http-request`, `connection`, `file`. Pass one with
34
+ `--template`. Each runs unmodified.
35
+
36
+ ## `test`
37
+
38
+ Runs your plugin the way the platform would, in three steps:
39
+
40
+ 1. **The platform's code checks.** The same rules the upload applies: only
41
+ allowed packages in `require`, no dynamic `require`, none of the refused
42
+ patterns (`eval`, `process.env`, `import`, …). Code that fails here would be
43
+ refused on push, and says why.
44
+ 2. **The sandbox's `require`.** A step gets the allowed npm packages and nothing
45
+ else — no `fs`, no `http`. Those packages are installed in the sandbox; here
46
+ they come from your project, and a missing one prints the `npm install`
47
+ command for the version the sandbox has.
48
+ 3. **A context that behaves.** `storage` and `state` are real, in memory, and
49
+ the result shows what the step left behind:
50
+
51
+ ```
52
+ ✓ passed success, 3ms
53
+ output success (expected success)
54
+ data { "path": "notes/hello-shouted.txt", "size": 17 }
55
+ files notes/hello.txt, notes/hello-shouted.txt
56
+ state {"runs":1}
57
+ ```
58
+
59
+ A run passes when it succeeds and, if the test file names an `expectOutput`,
60
+ leaves by that port — the same verdict as the GitHub check.
61
+
62
+ ### In a GitHub repository
63
+
64
+ `test` works wherever the platform tests your code on a push:
65
+
66
+ ```
67
+ my-plugin/ a plugin's repository
68
+ manifest.json
69
+ index.js
70
+ visualautomate.test.json
71
+
72
+ my-app/ an app's repository
73
+ modules/
74
+ send-message/
75
+ manifest.json
76
+ index.js
77
+ visualautomate.test.json
78
+ list-channels/
79
+ …
80
+ ```
81
+
82
+ At the root of an app's repository every module runs, one after another;
83
+ `--module send-message` runs one. `index.js` in a repository is run as written,
84
+ unbundled, because that is the file the sandbox loads.
85
+
86
+ ## `dev`
87
+
88
+ `test`, and again on every save. Only the module whose folder changed runs
89
+ again; a change anywhere else runs them all. Ctrl+C stops it.
90
+
91
+ ```bash
92
+ va dev
93
+ va dev --module send-message
94
+ ```
95
+
96
+ `context.connections` and `context.media` are **not** simulated. One is
97
+ somebody's OAuth account and the other is an ffmpeg container; pretending to be
98
+ either would produce a plugin that passes here and fails on a canvas. Asking for
99
+ one fails with a sentence saying so.
100
+
101
+ `visualautomate.test.json` (or `test.json`, or `--input <file>`) seeds the run:
102
+
103
+ ```json
104
+ {
105
+ "config": { "source": "notes/hello.txt" },
106
+ "input": {},
107
+ "storage": { "notes/hello.txt": "hello from a file" },
108
+ "state": { "runs": 0 },
109
+ "expectOutput": "success",
110
+ "timeoutMs": 30000
111
+ }
112
+ ```
113
+
114
+ The platform's push check reads `config`, `input`, `expectOutput` and
115
+ `timeoutMs`; `storage`, `state` and `secrets` are for running locally. A file that is not valid JSON
116
+ stops the run rather than running with nothing.
117
+
118
+ ## `push`
119
+
120
+ Bundles the same code `test` ran, strips the comments out of `manifest.json`,
121
+ and publishes. A version snapshot is saved, so you can roll back from the
122
+ dashboard.
123
+
124
+ Comments in `manifest.json` are a convenience of this tool: the file on your
125
+ disk may have them, the bytes on the wire never do.
126
+
127
+ ## CI
128
+
129
+ There is no browser on a build machine, so `login` is not available there. Set
130
+ `VISUALAUTOMATE_API_TOKEN` instead — the same token `login` would have stored,
131
+ which you can read out of `~/.visualautomate/config.json`.
132
+
133
+ `VISUALAUTOMATE_API_URL` points the CLI at a different installation.
134
+
135
+ ## Where things are
136
+
137
+ The runtime API your plugin is written against is documented in the types
138
+ (`visualautomate.d.ts` in your project, `@visualautomate/plugin-sdk` if you
139
+ prefer to install it) and on the platform's own docs page.