elva-cli 0.0.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.
@@ -0,0 +1,223 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # Elva
221
+ .venv/
222
+ src/elva_cli/_version.py
223
+ .ruff_cache/
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: elva-cli
3
+ Version: 0.0.1
4
+ Summary: Elva - CLI for Theneo Elva
5
+ Project-URL: Homepage, https://getelva.ai
6
+ Project-URL: Source, https://github.com/Theneo-Inc/theneo-elva-cli
7
+ Project-URL: Issues, https://github.com/Theneo-Inc/theneo-elva-cli/issues
8
+ Author-email: Theneo <support@theneo.io>
9
+ Keywords: api,cli,documentation,elva,openapi,theneo
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Software Development :: Documentation
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: typer<1.0,>=0.15
20
+ Provides-Extra: dev
21
+ Requires-Dist: mypy>=1.11; extra == 'dev'
22
+ Requires-Dist: pytest>=8.2; extra == 'dev'
23
+ Requires-Dist: ruff>=0.6; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Elva CLI
27
+
28
+ CLI for Theneo Editor
29
+
30
+ ...i will update soon
31
+
32
+ ## Quick start
33
+
34
+ Requires Python 3.11 or newer.
35
+
36
+ ```bash
37
+ git clone https://github.com/Theneo-Inc/theneo-elva-cli.git
38
+ cd theneo-elva-cli
39
+
40
+ python3 -m venv .venv
41
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
42
+ pip install -e ".[dev]"
43
+ ```
44
+
45
+ `-e` installs in editable mode, so your source edits take effect immediately with
46
+ no reinstall.
47
+
48
+ Run it:
49
+
50
+ ```bash
51
+ elva --version
52
+ elva --help
53
+ ```
54
+
55
+ ```
56
+ $ elva --version
57
+ elva 0.1.0 (python 3.12.3, linux-x86_64)
58
+ ```
59
+
60
+ `python -m elva_cli --version` runs the same entry point, if you prefer that form.
61
+
62
+
63
+ ### With uv (faster)
64
+
65
+ If you have [uv](https://docs.astral.sh/uv/), it replaces the venv and pip steps:
66
+
67
+ ```bash
68
+ uv sync --extra dev
69
+ uv run elva --version
70
+ ```
71
+
72
+ #### Running `elva` from any directory (development)
73
+
74
+ To activate everywhere locally:
75
+
76
+ ```bash
77
+ uv tool install --editable ~/Desktop/theneo-elva-cli
78
+ ```
79
+
80
+ ### Checks
81
+
82
+ ```bash
83
+ ruff check . # lint
84
+ ruff format . # format
85
+ mypy # types, strict
86
+ ```
87
+
88
+ ### Version numbers
89
+
90
+ The version comes from the git tag via `hatch-vcs` — there is nothing to bump by hand. An untagged checkout reports something like
91
+ `0.0.post1.dev1+g5aaf07a.d20260812`; tag a release and it becomes clean:
92
+
93
+ ```bash
94
+ git tag v0.1.0
95
+ ```
96
+
@@ -0,0 +1,71 @@
1
+ # Elva CLI
2
+
3
+ CLI for Theneo Editor
4
+
5
+ ...i will update soon
6
+
7
+ ## Quick start
8
+
9
+ Requires Python 3.11 or newer.
10
+
11
+ ```bash
12
+ git clone https://github.com/Theneo-Inc/theneo-elva-cli.git
13
+ cd theneo-elva-cli
14
+
15
+ python3 -m venv .venv
16
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
17
+ pip install -e ".[dev]"
18
+ ```
19
+
20
+ `-e` installs in editable mode, so your source edits take effect immediately with
21
+ no reinstall.
22
+
23
+ Run it:
24
+
25
+ ```bash
26
+ elva --version
27
+ elva --help
28
+ ```
29
+
30
+ ```
31
+ $ elva --version
32
+ elva 0.1.0 (python 3.12.3, linux-x86_64)
33
+ ```
34
+
35
+ `python -m elva_cli --version` runs the same entry point, if you prefer that form.
36
+
37
+
38
+ ### With uv (faster)
39
+
40
+ If you have [uv](https://docs.astral.sh/uv/), it replaces the venv and pip steps:
41
+
42
+ ```bash
43
+ uv sync --extra dev
44
+ uv run elva --version
45
+ ```
46
+
47
+ #### Running `elva` from any directory (development)
48
+
49
+ To activate everywhere locally:
50
+
51
+ ```bash
52
+ uv tool install --editable ~/Desktop/theneo-elva-cli
53
+ ```
54
+
55
+ ### Checks
56
+
57
+ ```bash
58
+ ruff check . # lint
59
+ ruff format . # format
60
+ mypy # types, strict
61
+ ```
62
+
63
+ ### Version numbers
64
+
65
+ The version comes from the git tag via `hatch-vcs` — there is nothing to bump by hand. An untagged checkout reports something like
66
+ `0.0.post1.dev1+g5aaf07a.d20260812`; tag a release and it becomes clean:
67
+
68
+ ```bash
69
+ git tag v0.1.0
70
+ ```
71
+
@@ -0,0 +1,106 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.24", "hatch-vcs>=0.4"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "elva-cli"
7
+ dynamic = ["version"]
8
+ description = "Elva - CLI for Theneo Elva"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ authors = [{ name = "Theneo", email = "support@theneo.io" }]
12
+ keywords = ["openapi", "api", "documentation", "cli", "elva", "theneo"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Software Development :: Documentation",
21
+ "Typing :: Typed",
22
+ ]
23
+
24
+ dependencies = [
25
+ "typer>=0.15,<1.0",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "ruff>=0.6",
31
+ "mypy>=1.11",
32
+ "pytest>=8.2",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://getelva.ai"
37
+ Source = "https://github.com/Theneo-Inc/theneo-elva-cli"
38
+ Issues = "https://github.com/Theneo-Inc/theneo-elva-cli/issues"
39
+
40
+ [project.scripts]
41
+ elva = "elva_cli.main:main"
42
+ elva-cli = "elva_cli.main:main"
43
+
44
+
45
+ [tool.hatch.version]
46
+ source = "vcs"
47
+ raw-options = { version_scheme = "no-guess-dev" }
48
+
49
+ [tool.hatch.build.hooks.vcs]
50
+ version-file = "src/elva_cli/_version.py"
51
+
52
+ [tool.hatch.build.targets.wheel]
53
+ packages = ["src/elva_cli"]
54
+
55
+ [tool.hatch.build.targets.sdist]
56
+ include = ["src", "tests", "README.md", "CHANGELOG.md"]
57
+
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py311"
62
+ src = ["src", "tests"]
63
+
64
+ [tool.ruff.lint]
65
+ select = [
66
+ "E", "F", "W", # pycodestyle, pyflakes
67
+ "I", # isort
68
+ "N", # pep8-naming
69
+ "UP", # pyupgrade
70
+ "B", # bugbear
71
+ "A", # builtin shadowing
72
+ "C4", # comprehensions
73
+ "SIM", # simplify
74
+ "PTH", # use pathlib
75
+ "RET", # return
76
+ "TC", # move type-only imports into TYPE_CHECKING
77
+ "TID", # tidy imports
78
+ "RUF",
79
+ ]
80
+ ignore = [
81
+ "B008", # typer relies on function calls in argument defaults
82
+ ]
83
+
84
+ [tool.ruff.lint.per-file-ignores]
85
+ "tests/*" = ["A002"]
86
+
87
+ [tool.ruff.lint.flake8-tidy-imports]
88
+ ban-relative-imports = "all"
89
+
90
+
91
+ [tool.mypy]
92
+ python_version = "3.11"
93
+ strict = true
94
+ files = ["src"]
95
+ warn_unreachable = true
96
+ enable_error_code = ["ignore-without-code", "redundant-expr"]
97
+
98
+ [[tool.mypy.overrides]]
99
+ module = ["questionary.*", "trogon.*"]
100
+ ignore_missing_imports = true
101
+
102
+
103
+ [tool.pytest.ini_options]
104
+ testpaths = ["tests"]
105
+ addopts = "-q --strict-markers --strict-config"
106
+ xfail_strict = true
@@ -0,0 +1,8 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ try:
4
+ __version__ = version("elva-cli")
5
+ except PackageNotFoundError: # pragma: no cover - running from a source tree
6
+ __version__ = "0.0.0+unknown"
7
+
8
+ __all__ = ["__version__"]
@@ -0,0 +1,4 @@
1
+ from elva_cli.main import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.0.1'
22
+ __version_tuple__ = version_tuple = (0, 0, 1)
23
+
24
+ __commit_id__ = commit_id = None
@@ -0,0 +1,8 @@
1
+ """Credentials and the login flow.
2
+
3
+ Token storage sits behind a Protocol (keyring, with a 0600 file fallback for
4
+ headless Linux and containers). ELVA_TOKEN overrides both in CI.
5
+
6
+ The browser handoff needs a /auth/cli endpoint on the JWT side of the backend.
7
+ The cookie-session auth used by the catalog and GitHub routes is deliberately
8
+ out of scope: a CLI has no cookie jar."""
@@ -0,0 +1,4 @@
1
+ """Command modules: one per top-level command.
2
+
3
+ Each module owns a `typer.Typer` app named `app`, parses its own arguments, calls
4
+ exactly one service, and hands the returned Result to `ctx.out`. No logic here."""
@@ -0,0 +1,5 @@
1
+ """The Ctx object, built once in the root callback and injected into every command.
2
+
3
+ Carries resolved settings, the API client, output and logging. Commands never
4
+ import global state, which is what makes them testable. Everything expensive is a
5
+ cached_property so `elva --version` pays for none of it."""
@@ -0,0 +1,4 @@
1
+ """Domain logic. Nothing in this package may print, prompt, or exit.
2
+
3
+ Pure and injectable, so it is unit-testable without a terminal. The rule is
4
+ enforced by tests/test_boundary.py rather than by convention."""
@@ -0,0 +1,5 @@
1
+ """The Elva API client.
2
+
3
+ `generated/` holds openapi-python-client output built from the backend's
4
+ /api/docs and is regenerated in CI. `client.py` wraps it with auth, retry,
5
+ timeouts and HTTP-status-to-ElvaError mapping."""
@@ -0,0 +1,4 @@
1
+ """Use cases: one function per thing the CLI can do.
2
+
3
+ Each returns a frozen dataclass (a "Result"). Results are plain data and know
4
+ nothing about Rich; rendering happens in ui/renderables."""
@@ -0,0 +1 @@
1
+ """OpenAPI handling: load, validate, diff."""
@@ -0,0 +1,9 @@
1
+ """Error taxonomy and the exit-code contract.
2
+
3
+ Exit codes are a public API that pipelines branch on: 0 ok, 1 unexpected, 2 usage,
4
+ 3 auth, 4 spec failed validation, 5 network/API, 130 interrupted. Never renumber a
5
+ shipped code, and never collapse 4 into 1 -- callers rely on the difference
6
+ between "your spec is wrong" and "the tool broke".
7
+
8
+ Every ElvaError carries a stable machine code, a message, and where one exists,
9
+ the next action to take."""
@@ -0,0 +1 @@
1
+ """Library logging to stderr, at a level chosen by -v repetition."""
@@ -0,0 +1,55 @@
1
+ """Typer root and the single error boundary.
2
+
3
+ Nothing here does work. It resolves global options into a Ctx, dispatches, and
4
+ turns whatever comes back into an exit code. Every user-visible failure path in
5
+ the CLI funnels through here.
6
+
7
+ Currently wired: --version and --help. Global flags, the Ctx and the error
8
+ boundary land next.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import platform
14
+
15
+ import typer
16
+
17
+ app = typer.Typer(
18
+ name="elva",
19
+ help="Elva - CLI for Theneo Elva.",
20
+ no_args_is_help=True,
21
+ pretty_exceptions_enable=False,
22
+ context_settings={"help_option_names": ["-h", "--help"]},
23
+ )
24
+
25
+
26
+ def _version_callback(value: bool) -> None:
27
+ if not value:
28
+ return
29
+ from elva_cli import __version__
30
+
31
+ machine = f"{platform.system().lower()}-{platform.machine()}"
32
+ typer.echo(f"elva {__version__} (python {platform.python_version()}, {machine})")
33
+ raise typer.Exit(0)
34
+
35
+
36
+ @app.callback()
37
+ def root(
38
+ version: bool = typer.Option(
39
+ False,
40
+ "--version",
41
+ "-V",
42
+ callback=_version_callback,
43
+ is_eager=True,
44
+ help="Show the current build version.",
45
+ ),
46
+ ) -> None:
47
+ pass
48
+
49
+
50
+ def main() -> None:
51
+ app()
52
+
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,5 @@
1
+ """Lazy command dispatch.
2
+
3
+ Maps command name to module path so that the command a user typed is the only
4
+ command module imported. Declaring a command here is the only way to add one, so
5
+ the startup cost of the tree stays visible in one file."""
@@ -0,0 +1,5 @@
1
+ """Configuration schema and precedence resolution.
2
+
3
+ Order, highest first: command flags, ELVA_* environment, project elva.toml, user
4
+ config.toml, defaults. Resolved once in the root callback and frozen onto the Ctx;
5
+ nothing downstream re-reads the environment or the filesystem."""
@@ -0,0 +1 @@
1
+ """Opt-out usage telemetry. Off until the privacy note lands in the README."""
@@ -0,0 +1,4 @@
1
+ """The only package permitted to write to a stream or read from stdin.
2
+
3
+ Holds the Rich consoles (data on stdout, chrome on stderr), the human/JSON output
4
+ chokepoint, prompt wrappers, the theme, and the Textual views."""
@@ -0,0 +1,9 @@
1
+ """Prompts that always have a non-interactive equivalent.
2
+
3
+ Every helper takes the flag value first. If it was supplied, no question is ever
4
+ asked. If it was not and there is no TTY, the result is a usage error rather than
5
+ a hang -- a CLI that blocks waiting for input in CI is the worst failure mode
6
+ there is.
7
+
8
+ These live in ui/ so that nothing under core/ can reach them.
9
+ """
@@ -0,0 +1,4 @@
1
+ """Rich renderers for Result objects, dispatched on type.
2
+
3
+ Keeping the data-to-presentation mapping here is what stops --json from drifting
4
+ from human output: both start from the same dataclass."""
@@ -0,0 +1 @@
1
+ """Full-screen Textual apps. Async; everything else in the CLI is sync."""
@@ -0,0 +1 @@
1
+ """Stale-version notifier."""