tlaplus-cli 0.7.0__tar.gz → 0.8.3__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.
Files changed (75) hide show
  1. tlaplus_cli-0.8.3/PKG-INFO +41 -0
  2. tlaplus_cli-0.8.3/README.md +17 -0
  3. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/pyproject.toml +8 -15
  4. tlaplus_cli-0.8.3/src/tlaplus_cli/__init__.py +1 -0
  5. tlaplus_cli-0.8.3/src/tlaplus_cli/cli.py +16 -0
  6. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/PKG-INFO +41 -0
  7. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/SOURCES.txt +12 -0
  8. tlaplus_cli-0.8.3/src/tlaplus_cli.egg-info/requires.txt +1 -0
  9. tlaplus_cli-0.7.0/MANIFEST.in +0 -4
  10. tlaplus_cli-0.7.0/PKG-INFO +0 -51
  11. tlaplus_cli-0.7.0/README.md +0 -21
  12. tlaplus_cli-0.7.0/src/tlaplus_cli/__init__.py +0 -6
  13. tlaplus_cli-0.7.0/src/tlaplus_cli/cache/__init__.py +0 -0
  14. tlaplus_cli-0.7.0/src/tlaplus_cli/cache/github.py +0 -28
  15. tlaplus_cli-0.7.0/src/tlaplus_cli/cli.py +0 -60
  16. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/__init__.py +0 -0
  17. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/check_java.py +0 -19
  18. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/config/__init__.py +0 -6
  19. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/config/edit.py +0 -34
  20. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/config/list.py +0 -16
  21. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/fetch_cache/__init__.py +0 -5
  22. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/fetch_cache/clear.py +0 -11
  23. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/modules/__init__.py +0 -16
  24. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/modules/add.py +0 -138
  25. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/modules/list.py +0 -45
  26. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/modules/path.py +0 -68
  27. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/modules/remove.py +0 -20
  28. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tlc.py +0 -261
  29. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/__init__.py +0 -8
  30. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/dir.py +0 -16
  31. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/install.py +0 -79
  32. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/list.py +0 -80
  33. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/meta/__init__.py +0 -5
  34. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/meta/sync.py +0 -34
  35. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/path.py +0 -33
  36. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/pin.py +0 -31
  37. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/uninstall.py +0 -104
  38. tlaplus_cli-0.7.0/src/tlaplus_cli/cmd/tools/upgrade.py +0 -76
  39. tlaplus_cli-0.7.0/src/tlaplus_cli/config/__init__.py +0 -0
  40. tlaplus_cli-0.7.0/src/tlaplus_cli/config/loader.py +0 -87
  41. tlaplus_cli-0.7.0/src/tlaplus_cli/config/schema.py +0 -52
  42. tlaplus_cli-0.7.0/src/tlaplus_cli/java/__init__.py +0 -7
  43. tlaplus_cli-0.7.0/src/tlaplus_cli/java/classpath.py +0 -197
  44. tlaplus_cli-0.7.0/src/tlaplus_cli/java/inspector.py +0 -86
  45. tlaplus_cli-0.7.0/src/tlaplus_cli/project/__init__.py +0 -3
  46. tlaplus_cli-0.7.0/src/tlaplus_cli/project/core.py +0 -31
  47. tlaplus_cli-0.7.0/src/tlaplus_cli/resources/__init__.py +0 -1
  48. tlaplus_cli-0.7.0/src/tlaplus_cli/resources/default_config.yaml +0 -28
  49. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/__init__.py +0 -0
  50. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/codes.py +0 -314
  51. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/compiler.py +0 -12
  52. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/components.py +0 -287
  53. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/formatter.py +0 -348
  54. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/models.py +0 -132
  55. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/parser.py +0 -258
  56. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/runner.py +0 -227
  57. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/sany.py +0 -94
  58. tlaplus_cli-0.7.0/src/tlaplus_cli/tlc/values.py +0 -186
  59. tlaplus_cli-0.7.0/src/tlaplus_cli/ui.py +0 -21
  60. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/__init__.py +0 -53
  61. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/api.py +0 -113
  62. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/downloader.py +0 -90
  63. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/metadata.py +0 -92
  64. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/paths.py +0 -89
  65. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/resolver.py +0 -92
  66. tlaplus_cli-0.7.0/src/tlaplus_cli/versioning/schema.py +0 -27
  67. tlaplus_cli-0.7.0/src/tlaplus_cli.egg-info/PKG-INFO +0 -51
  68. tlaplus_cli-0.7.0/src/tlaplus_cli.egg-info/SOURCES.txt +0 -66
  69. tlaplus_cli-0.7.0/src/tlaplus_cli.egg-info/requires.txt +0 -7
  70. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/LICENSE +0 -0
  71. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/setup.cfg +0 -0
  72. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/src/tlaplus_cli/py.typed +0 -0
  73. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/dependency_links.txt +0 -0
  74. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/entry_points.txt +0 -0
  75. {tlaplus_cli-0.7.0 → tlaplus_cli-0.8.3}/src/tlaplus_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: tlaplus-cli
3
+ Version: 0.8.3
4
+ Summary: Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it.
5
+ Author-email: Denis Nikolskiy <nikolskiy@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nikolskiy/tlaup
8
+ Project-URL: Repository, https://github.com/nikolskiy/tlaup
9
+ Project-URL: Old repository, https://github.com/nikolskiy/tlaplus-cli
10
+ Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 7 - Inactive
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: tlaup>=0.8.2
23
+ Dynamic: license-file
24
+
25
+ # tlaplus-cli has moved to tlaup
26
+
27
+ This project is now **tlaup**.
28
+
29
+ * Repository: https://github.com/nikolskiy/tlaup
30
+ * PyPI: https://pypi.org/project/tlaup/
31
+
32
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
33
+
34
+ ## Switching
35
+
36
+ ```bash
37
+ uv tool uninstall tlaplus-cli
38
+ uv tool install tlaup
39
+ ```
40
+
41
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -0,0 +1,17 @@
1
+ # tlaplus-cli has moved to tlaup
2
+
3
+ This project is now **tlaup**.
4
+
5
+ * Repository: https://github.com/nikolskiy/tlaup
6
+ * PyPI: https://pypi.org/project/tlaup/
7
+
8
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
9
+
10
+ ## Switching
11
+
12
+ ```bash
13
+ uv tool uninstall tlaplus-cli
14
+ uv tool install tlaup
15
+ ```
16
+
17
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -4,25 +4,19 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tlaplus-cli"
7
- version = "0.7.0"
8
- description = "TLA+ tools: download TLC, compile custom modules, run model checker"
7
+ version = "0.8.3"
8
+ description = "Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
  dependencies = [
12
- "typer>=0.22.0,<1.0.0",
13
- "requests>=2.31.0,<3.0.0",
14
- "pyyaml>=6.0,<7.0",
15
- "platformdirs>=4.0,<5.0",
16
- "pydantic>=2.12.5,<3.0.0",
17
- "truststore>=0.9.0,<1.0.0",
18
- "rich>=13.7.0,<14.0.0",
12
+ "tlaup>=0.8.2",
19
13
  ]
20
14
  authors = [
21
- {name = "Denis Nikolskiy", email = "codeomatics@gmail.com"}
15
+ {name = "Denis Nikolskiy", email = "nikolskiy@users.noreply.github.com"}
22
16
  ]
23
17
  license = "MIT"
24
18
  classifiers = [
25
- "Development Status :: 3 - Alpha",
19
+ "Development Status :: 7 - Inactive",
26
20
  "Programming Language :: Python :: 3",
27
21
  "Programming Language :: Python :: 3.11",
28
22
  "Programming Language :: Python :: 3.12",
@@ -33,9 +27,9 @@ classifiers = [
33
27
  ]
34
28
 
35
29
  [project.urls]
36
- Homepage = "https://github.com/nikolskiy/tlaplus-cli"
37
- Repository = "https://github.com/nikolskiy/tlaplus-cli"
38
- Issues = "https://github.com/nikolskiy/tlaplus-cli/issues"
30
+ Homepage = "https://github.com/nikolskiy/tlaup"
31
+ Repository = "https://github.com/nikolskiy/tlaup"
32
+ "Old repository" = "https://github.com/nikolskiy/tlaplus-cli"
39
33
  Changelog = "https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md"
40
34
 
41
35
  [project.scripts]
@@ -47,7 +41,6 @@ include = ["tlaplus_cli*"]
47
41
 
48
42
  [tool.setuptools.package-data]
49
43
  tlaplus_cli = ["py.typed"]
50
- "tlaplus_cli.resources" = ["*.yaml"]
51
44
 
52
45
  [dependency-groups]
53
46
  dev = [
@@ -0,0 +1 @@
1
+ """tlaplus-cli was renamed to tlaup. This package only forwards the old ``tla`` command to tlaup."""
@@ -0,0 +1,16 @@
1
+ """The ``tla`` command: print a notice, then run the same command through tlaup."""
2
+
3
+ import sys
4
+
5
+ NOTICE = (
6
+ "Notice: tlaplus-cli is now called tlaup and is no longer maintained. "
7
+ "Switch with 'uv tool uninstall tlaplus-cli && uv tool install tlaup', then use 'tlaup' instead of 'tla'."
8
+ )
9
+
10
+
11
+ def main() -> None:
12
+ """Entry point for [project.scripts]."""
13
+ print(NOTICE, file=sys.stderr)
14
+ from tlaup.cli import main as tlaup_main # noqa: PLC0415
15
+
16
+ tlaup_main()
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: tlaplus-cli
3
+ Version: 0.8.3
4
+ Summary: Renamed to tlaup. This package only installs tlaup and forwards the old tla command to it.
5
+ Author-email: Denis Nikolskiy <nikolskiy@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nikolskiy/tlaup
8
+ Project-URL: Repository, https://github.com/nikolskiy/tlaup
9
+ Project-URL: Old repository, https://github.com/nikolskiy/tlaplus-cli
10
+ Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
+ Classifier: Development Status :: 7 - Inactive
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: tlaup>=0.8.2
23
+ Dynamic: license-file
24
+
25
+ # tlaplus-cli has moved to tlaup
26
+
27
+ This project is now **tlaup**.
28
+
29
+ * Repository: https://github.com/nikolskiy/tlaup
30
+ * PyPI: https://pypi.org/project/tlaup/
31
+
32
+ `tlaplus-cli` is no longer maintained, and this repository is archived. The last release, 0.8.3, contains no code of its own: it installs `tlaup` and keeps the old `tla` command working by printing a notice and running the same command through `tlaup`.
33
+
34
+ ## Switching
35
+
36
+ ```bash
37
+ uv tool uninstall tlaplus-cli
38
+ uv tool install tlaup
39
+ ```
40
+
41
+ Then use `tlaup` wherever you used `tla`, for example `tlaup tools install` and `tlaup tlc MySpec`. Installed toolsets, custom modules and the config file stay where they are, so nothing needs to be reinstalled.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/tlaplus_cli/__init__.py
5
+ src/tlaplus_cli/cli.py
6
+ src/tlaplus_cli/py.typed
7
+ src/tlaplus_cli.egg-info/PKG-INFO
8
+ src/tlaplus_cli.egg-info/SOURCES.txt
9
+ src/tlaplus_cli.egg-info/dependency_links.txt
10
+ src/tlaplus_cli.egg-info/entry_points.txt
11
+ src/tlaplus_cli.egg-info/requires.txt
12
+ src/tlaplus_cli.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ tlaup>=0.8.2
@@ -1,4 +0,0 @@
1
- include LICENSE
2
- include README.md
3
- recursive-include src/tlaplus_cli/resources *.yaml
4
- include src/tlaplus_cli/py.typed
@@ -1,51 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: tlaplus-cli
3
- Version: 0.7.0
4
- Summary: TLA+ tools: download TLC, compile custom modules, run model checker
5
- Author-email: Denis Nikolskiy <codeomatics@gmail.com>
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/nikolskiy/tlaplus-cli
8
- Project-URL: Repository, https://github.com/nikolskiy/tlaplus-cli
9
- Project-URL: Issues, https://github.com/nikolskiy/tlaplus-cli/issues
10
- Project-URL: Changelog, https://github.com/nikolskiy/tlaplus-cli/blob/main/CHANGELOG.md
11
- Classifier: Development Status :: 3 - Alpha
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Topic :: Software Development :: Build Tools
18
- Classifier: Topic :: Utilities
19
- Requires-Python: >=3.11
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
- Requires-Dist: typer<1.0.0,>=0.22.0
23
- Requires-Dist: requests<3.0.0,>=2.31.0
24
- Requires-Dist: pyyaml<7.0,>=6.0
25
- Requires-Dist: platformdirs<5.0,>=4.0
26
- Requires-Dist: pydantic<3.0.0,>=2.12.5
27
- Requires-Dist: truststore<1.0.0,>=0.9.0
28
- Requires-Dist: rich<14.0.0,>=13.7.0
29
- Dynamic: license-file
30
-
31
- # TLA+ CLI
32
-
33
- Command-line tool for working with TLA+ specifications and the TLC model checker.
34
-
35
- ## Project goals
36
-
37
- 1. Simplify managing TLA+ tools such as TLC, community modules, custom modules, etc.
38
- 2. Run TLA tools in a single CLI interface.
39
- 3. Manage and display the tools outputs.
40
-
41
- ## Features
42
-
43
- * [Managing TLA+ Tools](docs/managing-tlaplus-tools/managing-tla2tools.md): Verify Java requirements, manage/pin `tla2tools.jar` versions, and handle cache settings.
44
- * [Running TLC](docs/tlc/tlc.md): Run the TLC model checker, inspect commands, and execute model checking with custom modules.
45
- * [Custom Java Modules](docs/java-modules-for-tlc/README.md): Compile, register, and manage custom Java operator overrides for TLC using automated CLI commands.
46
-
47
- ## Installation
48
-
49
- For detailed installation instructions, please refer to:
50
- * [Installation via uv tool](docs/installation/uv-tool.md)
51
- * [Nix Flakes Installation & Development](docs/installation/nix.md)
@@ -1,21 +0,0 @@
1
- # TLA+ CLI
2
-
3
- Command-line tool for working with TLA+ specifications and the TLC model checker.
4
-
5
- ## Project goals
6
-
7
- 1. Simplify managing TLA+ tools such as TLC, community modules, custom modules, etc.
8
- 2. Run TLA tools in a single CLI interface.
9
- 3. Manage and display the tools outputs.
10
-
11
- ## Features
12
-
13
- * [Managing TLA+ Tools](docs/managing-tlaplus-tools/managing-tla2tools.md): Verify Java requirements, manage/pin `tla2tools.jar` versions, and handle cache settings.
14
- * [Running TLC](docs/tlc/tlc.md): Run the TLC model checker, inspect commands, and execute model checking with custom modules.
15
- * [Custom Java Modules](docs/java-modules-for-tlc/README.md): Compile, register, and manage custom Java operator overrides for TLC using automated CLI commands.
16
-
17
- ## Installation
18
-
19
- For detailed installation instructions, please refer to:
20
- * [Installation via uv tool](docs/installation/uv-tool.md)
21
- * [Nix Flakes Installation & Development](docs/installation/nix.md)
@@ -1,6 +0,0 @@
1
- import truststore
2
-
3
- # Inject truststore as early as possible so that all standard library
4
- # and third-party tools relying on `ssl` (such as `requests` and `urllib3`)
5
- # utilize the native OS trust store.
6
- truststore.inject_into_ssl()
File without changes
@@ -1,28 +0,0 @@
1
- import json
2
- from dataclasses import asdict
3
- from pathlib import Path
4
-
5
- from tlaplus_cli.ui import warn
6
- from tlaplus_cli.versioning.schema import RemoteVersion
7
-
8
-
9
- def load_github_cache(cache_file: Path) -> list[RemoteVersion] | None:
10
- """Load the remote versions cache from disk."""
11
- if cache_file.exists():
12
- try:
13
- with cache_file.open("r", encoding="utf-8") as f:
14
- data = json.load(f)
15
- return [RemoteVersion(**item) for item in data]
16
- except (json.JSONDecodeError, OSError, KeyError, TypeError) as e:
17
- warn(f"Failed to read cache: {e}")
18
- return None
19
-
20
-
21
- def save_github_cache(cache_file: Path, versions: list[RemoteVersion]) -> None:
22
- """Save the remote versions cache to disk."""
23
- try:
24
- cache_file.parent.mkdir(parents=True, exist_ok=True)
25
- with cache_file.open("w", encoding="utf-8") as f:
26
- json.dump([asdict(v) for v in versions], f)
27
- except OSError as e:
28
- warn(f"Failed to save cache: {e}")
@@ -1,60 +0,0 @@
1
- """TLA+ CLI tool - entry point."""
2
-
3
- import importlib.metadata
4
-
5
- import typer
6
-
7
- from tlaplus_cli.cmd.check_java import check_java
8
- from tlaplus_cli.cmd.config import app as config_app
9
- from tlaplus_cli.cmd.fetch_cache import app as fetch_cache_app
10
- from tlaplus_cli.cmd.modules import app as modules_app
11
- from tlaplus_cli.cmd.tlc import tlc as run_tlc_cmd
12
- from tlaplus_cli.cmd.tools import app as tools_app
13
- from tlaplus_cli.config.loader import load_config
14
-
15
- app = typer.Typer(
16
- name="tla",
17
- help="TLA+ tools: download TLA+ toolset distribution, compile custom modules, run model checker.",
18
- no_args_is_help=True,
19
- add_completion=False,
20
- )
21
-
22
-
23
- def version_callback(value: bool) -> None:
24
- if value:
25
- meta = importlib.metadata.metadata("tlaplus-cli")
26
- typer.echo(f"{meta['Name']} v{meta['Version']}")
27
- typer.echo(meta["Summary"])
28
- raise typer.Exit()
29
-
30
-
31
- @app.callback()
32
- def root(
33
- _: bool = typer.Option(
34
- None,
35
- "--version",
36
- "-v",
37
- help="Show the application's version and exit.",
38
- callback=version_callback,
39
- is_eager=True,
40
- ),
41
- ) -> None:
42
- """TLA+ CLI tool."""
43
- # Load config early to trigger first-run copy
44
- load_config()
45
-
46
-
47
- # --- Subcommands ---
48
-
49
- app.add_typer(modules_app, name="modules")
50
- app.add_typer(tools_app, name="tools")
51
- app.add_typer(fetch_cache_app, name="fetch-cache")
52
- app.add_typer(config_app, name="config")
53
-
54
- app.command(name="tlc")(run_tlc_cmd)
55
- app.command(name="check-java")(check_java)
56
-
57
-
58
- def main() -> None:
59
- """Entry point for [project.scripts]."""
60
- app()
File without changes
@@ -1,19 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.config.loader import load_config
4
- from tlaplus_cli.java import get_java_version, validate_java_version
5
-
6
-
7
- def check_java() -> None:
8
- """Check if Java is installed and meets the minimum version requirement."""
9
- config = load_config()
10
- version = get_java_version()
11
- if version:
12
- typer.echo(f"Detected Java version: {version}")
13
-
14
- try:
15
- validate_java_version(config.java.min_version)
16
- typer.echo(f"Java version is compatible (>= {config.java.min_version}).")
17
- except RuntimeError as e:
18
- typer.echo(f"Error: {e}", err=True)
19
- raise typer.Exit(1) from None
@@ -1,6 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="config", help="Manage application configuration.", no_args_is_help=True)
4
-
5
- from . import edit # noqa: F401, E402
6
- from . import list as list_cmd # noqa: F401, E402
@@ -1,34 +0,0 @@
1
- import os
2
- import shutil
3
- import subprocess
4
-
5
- import typer
6
-
7
- from tlaplus_cli.cmd.config import app
8
- from tlaplus_cli.config.loader import config_path, load_config
9
-
10
-
11
- @app.command(name="edit")
12
- def edit_config(
13
- editor: str | None = typer.Argument(None, help="The editor to use (defaults to $EDITOR or 'vim')."),
14
- ) -> None:
15
- """Open the configuration file in an editor."""
16
- cp = config_path()
17
-
18
- # Ensure config exists by loading it
19
- load_config()
20
-
21
- if not editor:
22
- editor = os.environ.get("EDITOR", "vim")
23
-
24
- editor_path = shutil.which(editor)
25
- if not editor_path:
26
- typer.echo(f"Error: Editor '{editor}' not found in PATH.", err=True)
27
- raise typer.Exit(1)
28
-
29
- typer.echo(f"Opening {cp} with {editor} ...")
30
- try:
31
- subprocess.run([editor_path, str(cp)], check=True)
32
- except subprocess.CalledProcessError as e:
33
- typer.echo(f"Editor exited with error: {e}", err=True)
34
- raise typer.Exit(1) from None
@@ -1,16 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.cmd.config import app
4
- from tlaplus_cli.config.loader import config_path
5
-
6
-
7
- @app.command(name="list")
8
- def list_config() -> None:
9
- """Display the current configuration file content."""
10
- cp = config_path()
11
- if not cp.exists():
12
- typer.echo("Configuration file not found.", err=True)
13
- raise typer.Exit(1)
14
-
15
- with cp.open(encoding="utf-8") as f:
16
- typer.echo(f.read())
@@ -1,5 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="fetch-cache", help="Manage API fetch cache.", no_args_is_help=True)
4
-
5
- from . import clear # noqa: F401, E402
@@ -1,11 +0,0 @@
1
- import typer
2
-
3
- from tlaplus_cli.cmd.fetch_cache import app
4
- from tlaplus_cli.versioning import clear_cache
5
-
6
-
7
- @app.command(name="clear")
8
- def cmd_clear_cache() -> None:
9
- """Clear the local cache of remote GitHub versions."""
10
- clear_cache()
11
- typer.echo("GitHub versions cache cleared.")
@@ -1,16 +0,0 @@
1
- import typer
2
-
3
- app = typer.Typer(name="modules", help="Manage TLA+ Java modules.", no_args_is_help=True)
4
-
5
-
6
- # Import functions for new commands
7
- from .add import add_module # noqa: E402
8
- from .list import list_modules # noqa: E402
9
- from .path import show_modules_path # noqa: E402
10
- from .remove import remove_module # noqa: E402
11
-
12
- # Register new commands with the typer app
13
- app.command(name="add")(add_module)
14
- app.command(name="list")(list_modules)
15
- app.command(name="remove")(remove_module)
16
- app.command(name="path")(show_modules_path)
@@ -1,138 +0,0 @@
1
- import datetime
2
- import json
3
- import os
4
- import re
5
- import shutil
6
- import subprocess
7
- from pathlib import Path
8
-
9
- import typer
10
-
11
- from tlaplus_cli.config.loader import load_config
12
- from tlaplus_cli.java.classpath import ClasspathResolver, ResolveMode
13
- from tlaplus_cli.tlc.compiler import get_tlc_jar_path
14
- from tlaplus_cli.versioning.paths import get_modules_dir
15
-
16
-
17
- def find_override_classes(java_files: list[Path]) -> list[str]:
18
- """Find all class names implementing ITLCOverrides in Java files."""
19
- override_classes = []
20
- package_pattern = re.compile(r"package\s+([a-zA-Z0-9_.]+)\s*;")
21
- class_pattern = re.compile(
22
- r"\bclass\s+([a-zA-Z0-9_]+)\b[^{]*\bimplements\b[^{]*\b(tlc2\.overrides\.)?ITLCOverrides\b"
23
- )
24
-
25
- for jf in java_files:
26
- try:
27
- content = jf.read_text(encoding="utf-8", errors="ignore")
28
- except OSError:
29
- continue
30
-
31
- # Strip comments to prevent false matches
32
- content_no_comments = re.sub(r"//.*", "", content)
33
- content_no_comments = re.sub(r"/\*.*?\*/", "", content_no_comments, flags=re.DOTALL)
34
-
35
- package_match = package_pattern.search(content_no_comments)
36
- package_name = package_match.group(1) if package_match else ""
37
-
38
- for match in class_pattern.finditer(content_no_comments):
39
- class_name = match.group(1)
40
- full_class_name = f"{package_name}.{class_name}" if package_name else class_name
41
- override_classes.append(full_class_name)
42
-
43
- return override_classes
44
-
45
-
46
- def add_module( # noqa: PLR0912, PLR0915
47
- path: str = typer.Argument(..., help="Path to the module directory to add."),
48
- ) -> None:
49
- """Compile custom Java overrides and add/update the module in the cache."""
50
- source_dir = Path(path).resolve()
51
- if not source_dir.is_dir():
52
- typer.echo(f"Error: Path does not exist or is not a directory: {source_dir}", err=True)
53
- raise typer.Exit(1)
54
-
55
- config = load_config()
56
- module_name = source_dir.name
57
- target_dir = get_modules_dir() / module_name
58
-
59
- # Overwrite if exists
60
- if target_dir.exists():
61
- shutil.rmtree(target_dir)
62
- target_dir.mkdir(parents=True, exist_ok=True)
63
-
64
- # 1. Copy directories (lib, modules, tlc2, and test/tests)
65
- def copy_subfolder(subname: str) -> None:
66
- src = source_dir / subname
67
- if src.is_dir():
68
- shutil.copytree(src, target_dir / subname)
69
-
70
- typer.echo("Copying subfolders (lib, modules, test, tlc2)...")
71
- copy_subfolder("lib")
72
- copy_subfolder("modules")
73
- copy_subfolder("tlc2")
74
-
75
- if (source_dir / "test").is_dir():
76
- copy_subfolder("test")
77
- elif (source_dir / "tests").is_dir():
78
- copy_subfolder("tests")
79
-
80
- # 2. Compile Java overrides in cached version if tlc2/overrides exists
81
- java_files = []
82
- for candidate in [target_dir / "modules" / "tlc2" / "overrides", target_dir / "tlc2" / "overrides"]:
83
- if candidate.is_dir():
84
- java_files.extend(list(candidate.rglob("*.java")))
85
-
86
- if java_files:
87
- # Build classpath including tool_jar and local libs from the cached folder
88
- cached_lib = target_dir / "lib"
89
- extra_libs = []
90
- if cached_lib.is_dir():
91
- extra_libs.extend([str(j.absolute()) for j in cached_lib.glob("*.jar")])
92
-
93
- tool_jar = get_tlc_jar_path()
94
- if not tool_jar.exists():
95
- typer.echo("Error: tla2tools.jar not found. Run 'tla tools install' first.", err=True)
96
- shutil.rmtree(target_dir, ignore_errors=True)
97
- raise typer.Exit(1)
98
-
99
- resolver = ClasspathResolver(config, project_root=None, tool_jar=tool_jar, extra_libs=extra_libs)
100
- classpath = os.pathsep.join(resolver.resolve(ResolveMode.COMPILE))
101
-
102
- classes_dir = target_dir / "classes"
103
- classes_dir.mkdir(parents=True, exist_ok=True)
104
-
105
- cmd = ["javac", "-cp", classpath, "-d", str(classes_dir), *[str(f) for f in java_files]]
106
- typer.echo("Compiling Java files in cached tlc2/overrides...")
107
- try:
108
- subprocess.run(cmd, check=True, capture_output=True, text=True)
109
- except FileNotFoundError as err:
110
- typer.echo("Error: 'javac' not found. Ensure JDK is installed.", err=True)
111
- shutil.rmtree(target_dir, ignore_errors=True)
112
- raise typer.Exit(1) from err
113
- except subprocess.CalledProcessError as err:
114
- typer.echo("Compilation failed!", err=True)
115
- typer.echo(err.stdout, err=True)
116
- typer.echo(err.stderr, err=True)
117
- shutil.rmtree(target_dir, ignore_errors=True)
118
- raise typer.Exit(1) from err
119
-
120
- # Write service file
121
- meta_inf = classes_dir / "META-INF" / "services"
122
- meta_inf.mkdir(parents=True, exist_ok=True)
123
- service_file = meta_inf / "tlc2.overrides.ITLCOverrides"
124
-
125
- override_classes = find_override_classes(java_files)
126
- if not override_classes:
127
- override_classes = [config.tlc.overrides_class]
128
-
129
- with service_file.open("w") as f:
130
- for cls in override_classes:
131
- f.write(f"{cls}\n")
132
-
133
- # 3. Create metadata.json
134
- metadata = {"name": module_name, "built_at": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
135
- with (target_dir / "metadata.json").open("w") as f:
136
- json.dump(metadata, f, indent=2)
137
-
138
- typer.echo(f"Module '{module_name}' successfully added to cache.")