tlaplus-cli 0.1.8__tar.gz → 0.3.1__tar.gz
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.
- {tlaplus_cli-0.1.8/src/tlaplus_cli.egg-info → tlaplus_cli-0.3.1}/PKG-INFO +101 -20
- tlaplus_cli-0.3.1/README.md +194 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/pyproject.toml +2 -1
- tlaplus_cli-0.3.1/src/tlaplus_cli/__init__.py +6 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/build_tlc_module.py +8 -4
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/cli.py +5 -4
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/resources/default_config.yaml +3 -3
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/run_tlc.py +16 -9
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/settings.py +3 -3
- tlaplus_cli-0.3.1/src/tlaplus_cli/tools_manager.py +367 -0
- tlaplus_cli-0.3.1/src/tlaplus_cli/version_manager.py +386 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1/src/tlaplus_cli.egg-info}/PKG-INFO +101 -20
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli.egg-info/SOURCES.txt +5 -3
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli.egg-info/requires.txt +1 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/tests/test_run_tlc.py +7 -10
- tlaplus_cli-0.3.1/tests/test_tools_manager.py +631 -0
- tlaplus_cli-0.3.1/tests/test_version_manager.py +193 -0
- tlaplus_cli-0.1.8/README.md +0 -114
- tlaplus_cli-0.1.8/src/tlaplus_cli/__init__.py +0 -0
- tlaplus_cli-0.1.8/src/tlaplus_cli/download_tla2tools.py +0 -109
- tlaplus_cli-0.1.8/tests/test_download_tla2tools.py +0 -147
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/LICENSE +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/MANIFEST.in +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/setup.cfg +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/check_java.py +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/config.py +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli/py.typed +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli.egg-info/dependency_links.txt +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli.egg-info/entry_points.txt +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/src/tlaplus_cli.egg-info/top_level.txt +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/tests/test_build_tlc_module.py +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/tests/test_check_java.py +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/tests/test_cli.py +0 -0
- {tlaplus_cli-0.1.8 → tlaplus_cli-0.3.1}/tests/test_java_module_naming.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tlaplus-cli
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: TLA+ tools: download TLC, compile custom modules, run model checker
|
|
5
5
|
Author-email: Denis Nikolskiy <codeomatics@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -24,6 +24,7 @@ Requires-Dist: requests<3.0.0,>=2.31.0
|
|
|
24
24
|
Requires-Dist: pyyaml<7.0,>=6.0
|
|
25
25
|
Requires-Dist: platformdirs<5.0,>=4.0
|
|
26
26
|
Requires-Dist: pydantic<3.0.0,>=2.12.5
|
|
27
|
+
Requires-Dist: truststore<1.0.0,>=0.9.0
|
|
27
28
|
Dynamic: license-file
|
|
28
29
|
|
|
29
30
|
# TLA+ CLI
|
|
@@ -32,7 +33,7 @@ Command-line tool for working with TLA+ specifications and the TLC model checker
|
|
|
32
33
|
|
|
33
34
|
## Installation
|
|
34
35
|
|
|
35
|
-
Install system-wide via uv tool
|
|
36
|
+
Install system-wide via uv tool:
|
|
36
37
|
|
|
37
38
|
```bash
|
|
38
39
|
uv tool install tlaplus-cli
|
|
@@ -43,51 +44,131 @@ Upgrade:
|
|
|
43
44
|
uv tool upgrade tlaplus-cli
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
Uninstall
|
|
47
|
-
|
|
47
|
+
Uninstall:
|
|
48
48
|
```bash
|
|
49
49
|
uv tool uninstall tlaplus-cli
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Usage
|
|
53
53
|
|
|
54
|
-
###
|
|
54
|
+
### Managing TLA+ Tools
|
|
55
|
+
|
|
56
|
+
The `tla tools` command group allows you to download and manage multiple versions of the TLA+ toolset (TLC, SANY, TLATeX) directly from GitHub releases.
|
|
55
57
|
|
|
58
|
+
List available and installed toolset versions:
|
|
56
59
|
```bash
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
tla tools list
|
|
61
|
+
```
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
Install the latest toolset version:
|
|
64
|
+
```bash
|
|
65
|
+
tla tools install
|
|
62
66
|
```
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
> [!TIP]
|
|
69
|
+
> The first version you install is automatically "pinned" as the default. Subsequent installs won't change your pin unless you manually use `tla tools pin`.
|
|
65
70
|
|
|
71
|
+
Install a specific toolset version:
|
|
66
72
|
```bash
|
|
67
|
-
tla
|
|
73
|
+
tla tools install v1.8.0
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Pin a specific version to be used by default:
|
|
77
|
+
```bash
|
|
78
|
+
tla tools pin v1.8.0
|
|
68
79
|
```
|
|
69
80
|
|
|
81
|
+
Upgrade the pinned version (or a specific version) to a newer commit:
|
|
82
|
+
```bash
|
|
83
|
+
tla tools upgrade
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
> [!NOTE]
|
|
87
|
+
> If the target version to upgrade is not yet installed locally, the CLI will automatically download it.
|
|
88
|
+
|
|
89
|
+
Show the TLC2 version string and absolute path to the pinned version's `tla2tools.jar`:
|
|
90
|
+
```bash
|
|
91
|
+
tla tools path
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or for a specific version:
|
|
95
|
+
```bash
|
|
96
|
+
tla tools path v1.8.0
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Example output:
|
|
100
|
+
```text
|
|
101
|
+
TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802)
|
|
102
|
+
/home/bob/.cache/tla/tools/v1.8.0-5a47802/tla2tools.jar
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Show the toolset versions directory and all installed version directories:
|
|
106
|
+
```bash
|
|
107
|
+
tla tools dir
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Example output:
|
|
111
|
+
```text
|
|
112
|
+
/home/bob/.cache/tla/tools
|
|
113
|
+
v1.7.0-abc1234
|
|
114
|
+
v1.8.0-5a47802
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Uninstall a specific version (or use 'default' to remove legacy jars):
|
|
118
|
+
```bash
|
|
119
|
+
tla tools uninstall v1.8.0
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
> [!TIP]
|
|
123
|
+
> Use `--all` to remove all installed tags for a specific version name without interactive prompts.
|
|
124
|
+
|
|
125
|
+
> [!NOTE]
|
|
126
|
+
> If you uninstall the currently pinned version, the CLI will automatically "fall back" to the next best installed version (ranked by semver, then release date).
|
|
127
|
+
|
|
128
|
+
### Run TLC
|
|
129
|
+
|
|
130
|
+
Run the TLC model checker on a specification. This uses the currently pinned toolset version.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
tla tlc <spec_name>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For example (runs `queue.tla`):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
tla tlc queue
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
> **Note:** Starting from version `0.3.0`, the command structure has changed. To run a model, use `tla tlc <spec>`. For version `0.2.x`, the command was `tla run <spec>`. Since `0.3.0`, management commands are under `tla tools`.
|
|
143
|
+
|
|
70
144
|
### Compile Custom Java Modules
|
|
71
145
|
|
|
146
|
+
Note that modules are compiled using the pinned version of the toolset.
|
|
147
|
+
|
|
148
|
+
Compile modules:
|
|
72
149
|
```bash
|
|
73
150
|
tla build
|
|
151
|
+
```
|
|
74
152
|
|
|
75
|
-
|
|
153
|
+
Verbose output:
|
|
154
|
+
```bash
|
|
76
155
|
tla build --verbose
|
|
77
156
|
```
|
|
78
157
|
|
|
79
158
|
Compiles `.java` files from `workspace/modules/` into `workspace/classes/`.
|
|
80
159
|
|
|
81
|
-
###
|
|
160
|
+
### Check Java Version
|
|
82
161
|
|
|
83
162
|
```bash
|
|
84
|
-
tla
|
|
163
|
+
tla check-java
|
|
85
164
|
```
|
|
86
165
|
|
|
87
|
-
|
|
166
|
+
### Cache Management
|
|
167
|
+
|
|
168
|
+
The CLI caches GitHub API responses for 1 hour to prevent rate limiting. To clear this cache manually:
|
|
88
169
|
|
|
89
170
|
```bash
|
|
90
|
-
tla
|
|
171
|
+
tla fetch-cache clear
|
|
91
172
|
```
|
|
92
173
|
|
|
93
174
|
## Configuration
|
|
@@ -102,10 +183,9 @@ Edit this file to set your workspace path and TLC options:
|
|
|
102
183
|
|
|
103
184
|
```yaml
|
|
104
185
|
tla:
|
|
105
|
-
jar_name: tla2tools.jar
|
|
106
186
|
urls:
|
|
107
|
-
|
|
108
|
-
|
|
187
|
+
tags: https://api.github.com/repos/tlaplus/tlaplus/tags
|
|
188
|
+
releases: https://api.github.com/repos/tlaplus/tlaplus/releases
|
|
109
189
|
|
|
110
190
|
workspace:
|
|
111
191
|
root: . # Project root (relative to CWD)
|
|
@@ -129,7 +209,8 @@ java:
|
|
|
129
209
|
| Directory | Purpose | Location |
|
|
130
210
|
|---|---|---|
|
|
131
211
|
| Config | `config.yaml` | `~/.config/tla/` |
|
|
132
|
-
|
|
|
212
|
+
| Toolset Versions | Version dirs & `tools-pinned-version.txt` file | `~/.cache/tla/tools/` |
|
|
213
|
+
| API Cache | `github_cache.json` | `~/.cache/tla/` |
|
|
133
214
|
| Workspace | specs + modules + classes | Set via `workspace.root` in config |
|
|
134
215
|
|
|
135
216
|
## Note on Package Name
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# TLA+ CLI
|
|
2
|
+
|
|
3
|
+
Command-line tool for working with TLA+ specifications and the TLC model checker.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install system-wide via uv tool:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv tool install tlaplus-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Upgrade:
|
|
14
|
+
```bash
|
|
15
|
+
uv tool upgrade tlaplus-cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Uninstall:
|
|
19
|
+
```bash
|
|
20
|
+
uv tool uninstall tlaplus-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Managing TLA+ Tools
|
|
26
|
+
|
|
27
|
+
The `tla tools` command group allows you to download and manage multiple versions of the TLA+ toolset (TLC, SANY, TLATeX) directly from GitHub releases.
|
|
28
|
+
|
|
29
|
+
List available and installed toolset versions:
|
|
30
|
+
```bash
|
|
31
|
+
tla tools list
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Install the latest toolset version:
|
|
35
|
+
```bash
|
|
36
|
+
tla tools install
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> [!TIP]
|
|
40
|
+
> The first version you install is automatically "pinned" as the default. Subsequent installs won't change your pin unless you manually use `tla tools pin`.
|
|
41
|
+
|
|
42
|
+
Install a specific toolset version:
|
|
43
|
+
```bash
|
|
44
|
+
tla tools install v1.8.0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Pin a specific version to be used by default:
|
|
48
|
+
```bash
|
|
49
|
+
tla tools pin v1.8.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Upgrade the pinned version (or a specific version) to a newer commit:
|
|
53
|
+
```bash
|
|
54
|
+
tla tools upgrade
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> [!NOTE]
|
|
58
|
+
> If the target version to upgrade is not yet installed locally, the CLI will automatically download it.
|
|
59
|
+
|
|
60
|
+
Show the TLC2 version string and absolute path to the pinned version's `tla2tools.jar`:
|
|
61
|
+
```bash
|
|
62
|
+
tla tools path
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or for a specific version:
|
|
66
|
+
```bash
|
|
67
|
+
tla tools path v1.8.0
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Example output:
|
|
71
|
+
```text
|
|
72
|
+
TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802)
|
|
73
|
+
/home/bob/.cache/tla/tools/v1.8.0-5a47802/tla2tools.jar
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Show the toolset versions directory and all installed version directories:
|
|
77
|
+
```bash
|
|
78
|
+
tla tools dir
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Example output:
|
|
82
|
+
```text
|
|
83
|
+
/home/bob/.cache/tla/tools
|
|
84
|
+
v1.7.0-abc1234
|
|
85
|
+
v1.8.0-5a47802
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Uninstall a specific version (or use 'default' to remove legacy jars):
|
|
89
|
+
```bash
|
|
90
|
+
tla tools uninstall v1.8.0
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> [!TIP]
|
|
94
|
+
> Use `--all` to remove all installed tags for a specific version name without interactive prompts.
|
|
95
|
+
|
|
96
|
+
> [!NOTE]
|
|
97
|
+
> If you uninstall the currently pinned version, the CLI will automatically "fall back" to the next best installed version (ranked by semver, then release date).
|
|
98
|
+
|
|
99
|
+
### Run TLC
|
|
100
|
+
|
|
101
|
+
Run the TLC model checker on a specification. This uses the currently pinned toolset version.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
tla tlc <spec_name>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For example (runs `queue.tla`):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
tla tlc queue
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
> **Note:** Starting from version `0.3.0`, the command structure has changed. To run a model, use `tla tlc <spec>`. For version `0.2.x`, the command was `tla run <spec>`. Since `0.3.0`, management commands are under `tla tools`.
|
|
114
|
+
|
|
115
|
+
### Compile Custom Java Modules
|
|
116
|
+
|
|
117
|
+
Note that modules are compiled using the pinned version of the toolset.
|
|
118
|
+
|
|
119
|
+
Compile modules:
|
|
120
|
+
```bash
|
|
121
|
+
tla build
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Verbose output:
|
|
125
|
+
```bash
|
|
126
|
+
tla build --verbose
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Compiles `.java` files from `workspace/modules/` into `workspace/classes/`.
|
|
130
|
+
|
|
131
|
+
### Check Java Version
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
tla check-java
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Cache Management
|
|
138
|
+
|
|
139
|
+
The CLI caches GitHub API responses for 1 hour to prevent rate limiting. To clear this cache manually:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
tla fetch-cache clear
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
On first run, a default config is created at:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
~/.config/tla/config.yaml
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Edit this file to set your workspace path and TLC options:
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
tla:
|
|
157
|
+
urls:
|
|
158
|
+
tags: https://api.github.com/repos/tlaplus/tlaplus/tags
|
|
159
|
+
releases: https://api.github.com/repos/tlaplus/tlaplus/releases
|
|
160
|
+
|
|
161
|
+
workspace:
|
|
162
|
+
root: . # Project root (relative to CWD)
|
|
163
|
+
spec_dir: spec # Directory containing .tla files
|
|
164
|
+
modules_dir: modules # Directory containing .java files
|
|
165
|
+
classes_dir: classes # Directory for compiled .class files
|
|
166
|
+
|
|
167
|
+
tlc:
|
|
168
|
+
java_class: tlc2.TLC
|
|
169
|
+
overrides_class: tlc2.overrides.TLCOverrides
|
|
170
|
+
|
|
171
|
+
java:
|
|
172
|
+
min_version: 11
|
|
173
|
+
opts:
|
|
174
|
+
- "-XX:+IgnoreUnrecognizedVMOptions"
|
|
175
|
+
- "-XX:+UseParallelGC"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Directory Layout
|
|
179
|
+
|
|
180
|
+
| Directory | Purpose | Location |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| Config | `config.yaml` | `~/.config/tla/` |
|
|
183
|
+
| Toolset Versions | Version dirs & `tools-pinned-version.txt` file | `~/.cache/tla/tools/` |
|
|
184
|
+
| API Cache | `github_cache.json` | `~/.cache/tla/` |
|
|
185
|
+
| Workspace | specs + modules + classes | Set via `workspace.root` in config |
|
|
186
|
+
|
|
187
|
+
## Note on Package Name
|
|
188
|
+
|
|
189
|
+
This package is distributed on PyPI as **`tlaplus-cli`** but imports as **`tla`**. There is a separate, unrelated [`tla`](https://pypi.org/project/tla/) package on PyPI (a TLA+ parser). If you have both installed, they will conflict. In practice this is unlikely since they serve different purposes, but be aware of it.
|
|
190
|
+
|
|
191
|
+
## Dependencies
|
|
192
|
+
|
|
193
|
+
* **Java >= 11**: Required for TLC.
|
|
194
|
+
* [**uv**](https://docs.astral.sh/uv/getting-started/installation/): For installing the tool.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tlaplus-cli"
|
|
7
|
-
version = "0.1
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "TLA+ tools: download TLC, compile custom modules, run model checker"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -14,6 +14,7 @@ dependencies = [
|
|
|
14
14
|
"pyyaml>=6.0,<7.0",
|
|
15
15
|
"platformdirs>=4.0,<5.0",
|
|
16
16
|
"pydantic>=2.12.5,<3.0.0",
|
|
17
|
+
"truststore>=0.9.0,<1.0.0",
|
|
17
18
|
]
|
|
18
19
|
authors = [
|
|
19
20
|
{name = "Denis Nikolskiy", email = "codeomatics@gmail.com"}
|
|
@@ -5,6 +5,7 @@ import subprocess
|
|
|
5
5
|
import typer
|
|
6
6
|
|
|
7
7
|
from tlaplus_cli.config import cache_dir, load_config, workspace_root
|
|
8
|
+
from tlaplus_cli.version_manager import get_pinned_version_dir
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def build(
|
|
@@ -13,16 +14,19 @@ def build(
|
|
|
13
14
|
"""Compile custom Java modules."""
|
|
14
15
|
config = load_config()
|
|
15
16
|
|
|
16
|
-
#
|
|
17
|
-
|
|
17
|
+
# Fallback chain: pinned directory -> legacy jar
|
|
18
|
+
pinned_dir = get_pinned_version_dir()
|
|
19
|
+
pinned_jar = pinned_dir / "tla2tools.jar" if pinned_dir else None
|
|
20
|
+
legacy = cache_dir() / "tla2tools.jar"
|
|
21
|
+
jar_path = pinned_jar if (pinned_jar and pinned_jar.exists()) else legacy
|
|
18
22
|
|
|
19
23
|
ws_root = workspace_root()
|
|
20
24
|
modules_dir = ws_root / config.workspace.modules_dir
|
|
21
25
|
classes_dir = ws_root / config.workspace.classes_dir
|
|
22
26
|
|
|
23
27
|
if not jar_path.exists():
|
|
24
|
-
typer.echo(
|
|
25
|
-
typer.echo("Run 'tla
|
|
28
|
+
typer.echo("Error: tla2tools.jar not found.", err=True)
|
|
29
|
+
typer.echo("Run 'tla tlc install' first.", err=True)
|
|
26
30
|
raise typer.Exit(1)
|
|
27
31
|
|
|
28
32
|
if not modules_dir.exists():
|
|
@@ -7,12 +7,12 @@ import typer
|
|
|
7
7
|
from tlaplus_cli.build_tlc_module import build as build_tlc_cmd
|
|
8
8
|
from tlaplus_cli.check_java import check_java_version, get_java_version
|
|
9
9
|
from tlaplus_cli.config import load_config
|
|
10
|
-
from tlaplus_cli.download_tla2tools import tla as download_tla_cmd
|
|
11
10
|
from tlaplus_cli.run_tlc import tlc as run_tlc_cmd
|
|
11
|
+
from tlaplus_cli.tools_manager import fetch_cache_app, tools_app
|
|
12
12
|
|
|
13
13
|
app = typer.Typer(
|
|
14
14
|
name="tla",
|
|
15
|
-
help="TLA+ tools: download
|
|
15
|
+
help="TLA+ tools: download TLA+ toolset distribution, compile custom modules, run model checker.",
|
|
16
16
|
no_args_is_help=True,
|
|
17
17
|
add_completion=False,
|
|
18
18
|
)
|
|
@@ -47,8 +47,9 @@ def root(
|
|
|
47
47
|
|
|
48
48
|
# --- Subcommands ---
|
|
49
49
|
|
|
50
|
-
#
|
|
51
|
-
app.
|
|
50
|
+
# Attach typer subgroups for tools and fetch-cache
|
|
51
|
+
app.add_typer(tools_app, name="tools")
|
|
52
|
+
app.add_typer(fetch_cache_app, name="fetch-cache")
|
|
52
53
|
|
|
53
54
|
app.command(name="tlc")(run_tlc_cmd)
|
|
54
55
|
app.command(name="build")(build_tlc_cmd)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
tla:
|
|
2
|
-
jar_name: tla2tools.jar
|
|
3
2
|
urls:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
tags: https://api.github.com/repos/tlaplus/tlaplus/tags
|
|
4
|
+
releases: https://api.github.com/repos/tlaplus/tlaplus/releases
|
|
5
|
+
per_page: 30
|
|
6
6
|
|
|
7
7
|
# Path to the TLA+ workspace (specs, custom modules, compiled classes).
|
|
8
8
|
# Relative paths are resolved from the current working directory.
|
|
@@ -7,17 +7,21 @@ import typer
|
|
|
7
7
|
|
|
8
8
|
from tlaplus_cli.check_java import check_java_version
|
|
9
9
|
from tlaplus_cli.config import cache_dir, load_config, workspace_root
|
|
10
|
+
from tlaplus_cli.version_manager import get_pinned_version_dir
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def version_callback(value: bool) -> None:
|
|
13
14
|
if value:
|
|
14
15
|
config = load_config()
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
pinned_dir = get_pinned_version_dir()
|
|
17
|
+
pinned_jar = pinned_dir / "tla2tools.jar" if pinned_dir else None
|
|
18
|
+
legacy = cache_dir() / "tla2tools.jar"
|
|
19
|
+
jar_path = pinned_jar if (pinned_jar and pinned_jar.exists()) else legacy
|
|
20
|
+
typer.echo(f"tla2tools.jar path: {jar_path}")
|
|
17
21
|
|
|
18
22
|
if not jar_path.exists():
|
|
19
|
-
typer.echo(f"Error:
|
|
20
|
-
typer.echo("Run 'tla
|
|
23
|
+
typer.echo(f"Error: tla2tools.jar not found at {jar_path}", err=True)
|
|
24
|
+
typer.echo("Run 'tla tools install' first.", err=True)
|
|
21
25
|
raise typer.Exit(1)
|
|
22
26
|
|
|
23
27
|
cmd = ["java", "-cp", str(jar_path), config.tlc.java_class]
|
|
@@ -49,14 +53,17 @@ def tlc(
|
|
|
49
53
|
pass
|
|
50
54
|
config = load_config()
|
|
51
55
|
|
|
52
|
-
# Check Java version before proceeding
|
|
53
56
|
check_java_version(config.java.min_version)
|
|
54
57
|
|
|
55
|
-
#
|
|
56
|
-
|
|
58
|
+
# Fallback chain: pinned version → legacy jar
|
|
59
|
+
pinned_dir = get_pinned_version_dir()
|
|
60
|
+
pinned_jar = pinned_dir / "tla2tools.jar" if pinned_dir else None
|
|
61
|
+
legacy = cache_dir() / "tla2tools.jar"
|
|
62
|
+
jar_path = pinned_jar if (pinned_jar and pinned_jar.exists()) else legacy
|
|
63
|
+
|
|
57
64
|
if not jar_path.exists():
|
|
58
|
-
typer.echo(
|
|
59
|
-
typer.echo("Run 'tla
|
|
65
|
+
typer.echo("Error: tla2tools.jar not found.", err=True)
|
|
66
|
+
typer.echo("Run 'tla tools install' first.", err=True)
|
|
60
67
|
raise typer.Exit(1)
|
|
61
68
|
|
|
62
69
|
ws_root = workspace_root()
|