@vention/vention-cli 0.9.0 → 0.10.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 CHANGED
@@ -1,39 +1,119 @@
1
- # @vention/vention-cli
1
+ # Vention CLI — Work locally with MachineLogic Python apps
2
2
 
3
- A command-line interface Tool to interact with MachineCode applications from your local setup
3
+ The Vention CLI lets you pull MachineLogic Python applications from an active design into your local IDE, edit them, and push changes back — without leaving MachineBuilder.
4
+
5
+ Important:
6
+ - Supports MachineLogic Python apps only. Code-free MachineLogic programs are not supported.
7
+ - You must have the MachineLogic tab open for your design in MachineBuilder. Opening that tab makes the design active for the CLI.
8
+ - Learn about MachineLogic Python app structure (main.py, project.json, HMI, etc.): https://docs.vention.io/docs/machinelogic-python-programming-guide
4
9
 
5
10
  ## Installation
6
11
 
7
12
  ```bash
8
13
  # Install from npm
9
14
  npm install -g @vention/vention-cli
15
+ ```
16
+
17
+ Use either `vention` or `vn` as the command.
18
+
19
+ ## Quick start
10
20
 
11
- # Or install locally for development
12
- nx build vention-cli
13
- cd dist/projects/machine-code/apps/vention-cli
14
- npm link
21
+ 1) Open your design in MachineBuilder and select the MachineLogic tab (this makes your design active).
22
+ 2) Authenticate:
23
+ ```bash
24
+ vention login
25
+ ```
26
+ 3) Pull your app locally (creates a folder named after the app):
27
+ ```bash
28
+ vention pull
15
29
  ```
30
+ 4) Edit code in your IDE (e.g., update `main.py`, `project.json`).
31
+ 5) Push changes back to your active design:
32
+ ```bash
33
+ vention push
34
+ ```
35
+ 6) In MachineBuilder, use the MachineLogic panel to run/simulate your updated app.
36
+
37
+ ## How it works
16
38
 
17
- ## Usage
39
+ - Active design: The CLI finds designs where the MachineLogic tab is open and connects to your active design.
40
+ - App selection: When pulling/linking, choose one of the design’s MachineLogic Python apps.
41
+ - Local state: The CLI writes `.machine-code-app-directory-info.json` at the project root to remember the selected design/app and environment.
42
+ - File sync:
43
+ - Pull: Downloads the app’s source files and writes them to disk.
44
+ - Push: Serializes local files and uploads them to your active design.
45
+ - Ignored items when pushing: `venv`, `node_modules`, `dist`, `build`, `__pycache__`, `*.egg-info`, `.machine-code-app-directory-info.json`.
18
46
 
19
- After installation, you can use either `vention` or `vn` as the command:
47
+ ## Commands
20
48
 
21
49
  ```bash
22
- # Show help
23
- vention --help
24
- # or
25
- vn --help
50
+ vention --help # Show help
51
+ vention --version # Show version
52
+ ```
26
53
 
27
- # Run the hello command
28
- vention hello
29
- # or
30
- vn hello
54
+ - login: Authenticate and select environment
55
+ ```bash
56
+ vention login
57
+ # Choose environment:
58
+ # - prod: most users
59
+ # - demo: testing/sandboxes
60
+ ```
31
61
 
32
- # Show version
33
- vention --version
34
- # or
35
- vn --version
62
+ - pull: Fetch a MachineLogic Python app from your active design into the current directory
63
+ ```bash
64
+ vention pull
65
+ # If the current folder isn’t linked yet, select a design (with MachineLogic open) and then an app.
66
+ # If linked, the CLI updates the existing project in place.
36
67
  ```
37
68
 
38
- Both commands (`vention` and `vn`) do exactly the same thing - use whichever you prefer!
69
+ - link: Link the current directory to a design + app without pulling files
70
+ ```bash
71
+ vention link
72
+ # Writes .machine-code-app-directory-info.json so future push/pull operations know what to target.
73
+ ```
74
+
75
+ - push: Upload local changes from the linked directory to your active design
76
+ ```bash
77
+ vention push
78
+ # Requires the same design to be open in MachineBuilder (MachineLogic tab selected).
79
+ ```
80
+
81
+ ## Project metadata file
82
+
83
+ The CLI stores link info in `.machine-code-app-directory-info.json` at the project root:
84
+ ```json
85
+ {
86
+ "appName": "My App",
87
+ "designId": 12345,
88
+ "applicationId": "abcdef",
89
+ "uuid": "optional-app-uuid",
90
+ "environment": "prod",
91
+ "lastPulledAt": "2025-01-01T12:34:56.789Z",
92
+ "lastPushedAt": "2025-01-02T09:10:11.123Z"
93
+ }
94
+ ```
95
+
96
+ ## Requirements and limitations
97
+
98
+ - The MachineLogic tab must be open for the target design (the design must be active) when running pull or push.
99
+ - Only MachineLogic Python apps are supported.
100
+ - The CLI ignores common build artifacts and environments when pushing (see list above).
101
+ - Session storage: Login data is saved to `~/.vention-cli-config.json`.
102
+
103
+ ## Typical workflow
104
+
105
+ - Create your app in the web IDE first (MachineLogic Python).
106
+ - Keep MachineBuilder open with the MachineLogic tab selected (design active).
107
+ - Use `vention pull` to get the app locally, edit in your IDE, then `vention push` to update the running app in your active design.
108
+ - Use the MachineLogic UI to run and test.
109
+
110
+ For app structure, deployment, multi-process `project.json`, and HMI guidance see: https://docs.vention.io/docs/machinelogic-python-programming-guide
111
+
112
+ ## Troubleshooting
113
+
114
+ - “Not logged in. Please run 'vention login' first.” → Run `vention login`.
115
+ - “No active design found …” or “Please open the design and navigate to MachineLogic …” → Open your design in MachineBuilder and select the MachineLogic tab.
116
+ - “This directory is not linked …” during push → Run `vention link` or pull the app first.
117
+ - Push fails with auth errors → Re-run `vention login` (tokens may have expired).
118
+ - Directory already exists when pulling → Either run pull inside the existing project directory or rename/delete the conflicting folder.
39
119