elva-cli 0.0.1__py3-none-any.whl

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.
elva_cli/__init__.py ADDED
@@ -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__"]
elva_cli/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from elva_cli.main import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
elva_cli/_version.py ADDED
@@ -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."""
elva_cli/context.py ADDED
@@ -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."""
elva_cli/errors.py ADDED
@@ -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."""
elva_cli/logging.py ADDED
@@ -0,0 +1 @@
1
+ """Library logging to stderr, at a level chosen by -v repetition."""
elva_cli/main.py ADDED
@@ -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()
elva_cli/registry.py ADDED
@@ -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."""
elva_cli/telemetry.py ADDED
@@ -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."""
elva_cli/ui/prompts.py ADDED
@@ -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."""
elva_cli/update.py ADDED
@@ -0,0 +1 @@
1
+ """Stale-version notifier."""
@@ -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,25 @@
1
+ elva_cli/__init__.py,sha256=Bj7nUzAI-YsVpubyK_BYZDcGmRfw1MaIEPreL6eCvAI,244
2
+ elva_cli/__main__.py,sha256=22xZiL1z0CSRzOBe_dXuIeObKeInImcPlAqjiQ2a6Jw,70
3
+ elva_cli/_version.py,sha256=8OsTLsIVB9D0HdPTmt5rVwyVUBe9xTVGkRslXicxzkM,520
4
+ elva_cli/context.py,sha256=gualsuA6X3MczDkUh_oMrpAmdSo26xyeIhkH4gguPV8,305
5
+ elva_cli/errors.py,sha256=GlJnqR9NKbXx1tUsOQIsrVuRKfD0XRoIUdR7eRnvl6s,449
6
+ elva_cli/logging.py,sha256=bveQ-ULrgM0wg5GPTFO5AA6UfFeVAoV3mgL-QPX9nHA,69
7
+ elva_cli/main.py,sha256=cs5JPaDYqPYxA2qVkSg-U87clQiWfCMXrIG5pgKHEX8,1216
8
+ elva_cli/registry.py,sha256=Pw1GZDGXv3hmjj_BBDtdr7lsDOiISLHXJzFSPVMvUHU,245
9
+ elva_cli/telemetry.py,sha256=fJWGMbMb36f_D9XdpFAiFglFlE_h2--2tEeGnPhX5Qc,79
10
+ elva_cli/update.py,sha256=DsUCBF61TPIkthK70nP6xKscFtzZQNHgsRIZmTZsAf4,30
11
+ elva_cli/auth/__init__.py,sha256=khFOTzl6mJyv2hd9Y1Yl1OV7_xOLyPwPZocY69lyW-U,378
12
+ elva_cli/commands/__init__.py,sha256=R95HhKM2s1BqdhuMgS6QT5ZAmCxXuBsqU_te3rzSe9s,213
13
+ elva_cli/core/__init__.py,sha256=KotlLaueRU-7B34bLBGIXGwWcSFB2_opTVSVIv_Za-I,211
14
+ elva_cli/core/api/__init__.py,sha256=s9WzwIOsIgA4lJk1XbaiEq-xjUqpKc_w6iwr9eoRyJ0,223
15
+ elva_cli/core/services/__init__.py,sha256=G84vUGpwZET7e4xRH9u34N5u5gJSGId0UO45lwoXlfc,192
16
+ elva_cli/core/spec/__init__.py,sha256=MzDtit5PHljy3dyAN2_r2CzSdQwhiwwREv1oRv8KvTo,46
17
+ elva_cli/settings/__init__.py,sha256=bQ3pDMx4-ikTQwT4zsJPJBrratkuem0hX8n7-XYU27Y,282
18
+ elva_cli/ui/__init__.py,sha256=BziJdFvNO7InnbUOgN_CGZYkaXnFOck9NITfBSIamrg,220
19
+ elva_cli/ui/prompts.py,sha256=FQlQ0lobLWQ2lB0b5NNySWpcEZVbfwmtP-Da971Ja28,377
20
+ elva_cli/ui/renderables/__init__.py,sha256=Zt4OWsxoSgW0Wv2C8N4npRlB7vO3fdJwj7Hfo-auLqo,198
21
+ elva_cli/ui/views/__init__.py,sha256=iRcmc4uq4a6W3pChzbtdnO6iyrp0W2UQ1IN31L5RGf4,75
22
+ elva_cli-0.0.1.dist-info/METADATA,sha256=4X2LlboM6z5xdo6GGV1Euh0F0WDSEgfuJjA_nr6OHJc,2268
23
+ elva_cli-0.0.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
24
+ elva_cli-0.0.1.dist-info/entry_points.txt,sha256=M3VIGtg24aEhUgTrNGwh4b6uHjDGok4_8dHWQ56RQw4,74
25
+ elva_cli-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ elva = elva_cli.main:main
3
+ elva-cli = elva_cli.main:main