contree-cli 0.9.3__tar.gz → 0.9.4__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.
- {contree_cli-0.9.3 → contree_cli-0.9.4}/PKG-INFO +2 -2
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/auth.py +4 -3
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/cd.py +2 -2
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/images.py +2 -2
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/ls.py +1 -1
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/operation.py +5 -5
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/run.py +5 -11
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/session.py +3 -1
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_from.py +3 -3
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/repl.py +3 -3
- {contree_cli-0.9.3 → contree_cli-0.9.4}/pyproject.toml +2 -2
- {contree_cli-0.9.3 → contree_cli-0.9.4}/pyproject.toml.orig +2 -2
- {contree_cli-0.9.3 → contree_cli-0.9.4}/LICENSE +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/README.md +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/__init__.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/__main__.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/agent.md +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/arguments.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/__init__.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/agent.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/build.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/cat.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/cp.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/env.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/export.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/file.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/grep.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/show.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/skill.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/tag.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/cli/use.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/client.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/config.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/__init__.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/context.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/dockerignore.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/keyword.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_add.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_arg.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_copy.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_env.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_run.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_skipped.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_user.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/kw_workdir.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/local_context.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/parser.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/docker/url_fetch.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/log.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/man.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/manual.md +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/mapped_file.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/migrations.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/output.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/pty_utils.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/py.typed +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/refs.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/session.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/__init__.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/argmap.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/argspec.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/cache.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/completer.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/history.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/parser.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/sources.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/shell/trie.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/skill.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/skill_body.md +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/types.py +0 -0
- {contree_cli-0.9.3 → contree_cli-0.9.4}/contree_cli/update_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: contree-cli
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.4
|
|
4
4
|
Summary: CLI client for the ConTree sandbox platform
|
|
5
5
|
Keywords: sandbox,cli,vm,ai-agent,contree
|
|
6
6
|
Author: Dmitry Orlov
|
|
@@ -197,7 +197,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
197
197
|
Classifier: Topic :: Software Development :: Build Tools
|
|
198
198
|
Classifier: Topic :: System :: Shells
|
|
199
199
|
Classifier: Typing :: Typed
|
|
200
|
-
Requires-Dist: contree-client
|
|
200
|
+
Requires-Dist: contree-client~=0.4.0
|
|
201
201
|
Requires-Python: >=3.10
|
|
202
202
|
Project-URL: Homepage, https://contree.dev
|
|
203
203
|
Project-URL: Documentation, https://docs.contree.dev/cli/
|
|
@@ -31,7 +31,7 @@ import os
|
|
|
31
31
|
from dataclasses import dataclass
|
|
32
32
|
from multiprocessing.pool import ThreadPool
|
|
33
33
|
|
|
34
|
-
from contree_client.exceptions import
|
|
34
|
+
from contree_client.exceptions import APIStatusError
|
|
35
35
|
from contree_client.models import WhoAmIResponse
|
|
36
36
|
|
|
37
37
|
from contree_cli import FORMATTER, ArgumentsProtocol, SetupResult
|
|
@@ -263,12 +263,13 @@ def cmd_auth(args: AuthArgs) -> int | None:
|
|
|
263
263
|
try:
|
|
264
264
|
with client:
|
|
265
265
|
whoami = client.whoami()
|
|
266
|
-
except
|
|
266
|
+
except (APIStatusError, ValueError) as exc:
|
|
267
|
+
# ValueError covers parse_whoami's own non-2xx status check.
|
|
267
268
|
# Logs the API error message, not the token itself.
|
|
268
269
|
# nosemgrep: python-logger-credential-disclosure
|
|
269
270
|
logger.error("Token verification failed: %s. Profile not changed.", exc)
|
|
270
271
|
return 1
|
|
271
|
-
except (KeyError, TypeError
|
|
272
|
+
except (KeyError, TypeError) as exc:
|
|
272
273
|
# Strict contree-client models raise TypeError (missing required
|
|
273
274
|
# field) or KeyError (parse_fields lookup) on incomplete payloads.
|
|
274
275
|
logger.error("Could not parse /v1/whoami response: %s", exc)
|
|
@@ -14,7 +14,7 @@ import logging
|
|
|
14
14
|
import posixpath
|
|
15
15
|
from dataclasses import dataclass
|
|
16
16
|
|
|
17
|
-
from contree_client.exceptions import
|
|
17
|
+
from contree_client.exceptions import APIStatusError
|
|
18
18
|
|
|
19
19
|
from contree_cli import CLIENT, SESSION_STORE, ArgumentsProtocol, SetupResult
|
|
20
20
|
|
|
@@ -64,7 +64,7 @@ def cmd_cd(args: CdArgs) -> int | None:
|
|
|
64
64
|
client = CLIENT.get()
|
|
65
65
|
uuid = client.resolve_image(session.current_image)
|
|
66
66
|
client.inspect_image_list(uuid, new_cwd)
|
|
67
|
-
except
|
|
67
|
+
except APIStatusError as exc:
|
|
68
68
|
if exc.status == 404:
|
|
69
69
|
logger.error("cd: %s: no such directory", new_cwd)
|
|
70
70
|
return 1
|
|
@@ -16,7 +16,7 @@ import time
|
|
|
16
16
|
from dataclasses import dataclass, field
|
|
17
17
|
from datetime import datetime
|
|
18
18
|
|
|
19
|
-
from contree_client.exceptions import
|
|
19
|
+
from contree_client.exceptions import APIStatusError
|
|
20
20
|
from contree_client.models import (
|
|
21
21
|
TERMINAL_STATUSES,
|
|
22
22
|
ImageImportRegistry,
|
|
@@ -393,7 +393,7 @@ def cmd_import(args: ImportArgs) -> int | None:
|
|
|
393
393
|
try:
|
|
394
394
|
client.cancel_operation(op_uuid)
|
|
395
395
|
logger.info("Cancelled operation %s", op_uuid)
|
|
396
|
-
except (
|
|
396
|
+
except (APIStatusError, KeyboardInterrupt, OSError):
|
|
397
397
|
pass
|
|
398
398
|
raise
|
|
399
399
|
|
|
@@ -21,7 +21,7 @@ from dataclasses import dataclass, field
|
|
|
21
21
|
from datetime import datetime
|
|
22
22
|
from typing import Any
|
|
23
23
|
|
|
24
|
-
from contree_client.exceptions import
|
|
24
|
+
from contree_client.exceptions import APIStatusError
|
|
25
25
|
from contree_client.models import ACTIVE_STATUSES, TERMINAL_STATUSES
|
|
26
26
|
|
|
27
27
|
from contree_cli import CLIENT, FORMATTER, SESSION_STORE, ArgumentsProtocol, SetupResult
|
|
@@ -460,7 +460,7 @@ def cmd_show_multi(args: ShowMultiArgs) -> int | None:
|
|
|
460
460
|
for uuid in args.uuids:
|
|
461
461
|
try:
|
|
462
462
|
result = cmd_show(ShowArgs(uuid=uuid, raw=args.raw))
|
|
463
|
-
except
|
|
463
|
+
except APIStatusError as exc:
|
|
464
464
|
logger.error("Failed to fetch %s: %s", uuid, exc)
|
|
465
465
|
exit_code = max(exit_code, 1)
|
|
466
466
|
continue
|
|
@@ -490,7 +490,7 @@ def cmd_cancel(args: CancelArgs) -> int | None:
|
|
|
490
490
|
try:
|
|
491
491
|
client.cancel_operation(uuid)
|
|
492
492
|
logger.info("Cancelled operation %s", uuid)
|
|
493
|
-
except
|
|
493
|
+
except APIStatusError as exc:
|
|
494
494
|
logger.error("Failed to cancel %s: %s", uuid, exc)
|
|
495
495
|
failed += 1
|
|
496
496
|
return 1 if failed else None
|
|
@@ -506,7 +506,7 @@ def cmd_events(args: EventsArgs) -> int | None:
|
|
|
506
506
|
try:
|
|
507
507
|
for ev in client.iter_operation_events(uuid, follow=False):
|
|
508
508
|
formatter(uuid=uuid, **ev.to_dict())
|
|
509
|
-
except
|
|
509
|
+
except APIStatusError as exc:
|
|
510
510
|
logger.error("Failed to fetch events for %s: %s", uuid, exc)
|
|
511
511
|
exit_code = 1
|
|
512
512
|
formatter.flush()
|
|
@@ -592,7 +592,7 @@ def cmd_wait(args: WaitArgs) -> int | None:
|
|
|
592
592
|
for uuid in sorted(pending):
|
|
593
593
|
try:
|
|
594
594
|
op = client.get_operation_status(uuid).to_dict()
|
|
595
|
-
except
|
|
595
|
+
except APIStatusError as exc:
|
|
596
596
|
logger.error("Failed to fetch %s: %s", uuid, exc)
|
|
597
597
|
continue
|
|
598
598
|
formatter(**{**op, "timed_out": True})
|
|
@@ -65,7 +65,7 @@ from dataclasses import dataclass, field
|
|
|
65
65
|
from multiprocessing.pool import ThreadPool
|
|
66
66
|
from typing import Any
|
|
67
67
|
|
|
68
|
-
from contree_client.exceptions import
|
|
68
|
+
from contree_client.exceptions import APIStatusError, ContreeError
|
|
69
69
|
from contree_client.models import (
|
|
70
70
|
TERMINAL_STATUSES,
|
|
71
71
|
ClosableStreamRepr,
|
|
@@ -94,14 +94,8 @@ from contree_cli.types import FLAGS
|
|
|
94
94
|
|
|
95
95
|
logger = logging.getLogger(__name__)
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
SIGNAL_ERRORS: tuple[type[BaseException], ...] = (
|
|
100
|
-
ContreeAPIError,
|
|
101
|
-
OSError,
|
|
102
|
-
*CliClient.retryable_errors,
|
|
103
|
-
*CliClient.nonretryable_errors,
|
|
104
|
-
)
|
|
97
|
+
# ContreeError covers APIConnectionError from any transport backend.
|
|
98
|
+
SIGNAL_ERRORS: tuple[type[BaseException], ...] = (ContreeError, OSError)
|
|
105
99
|
|
|
106
100
|
EPILOG = """\
|
|
107
101
|
examples:
|
|
@@ -688,7 +682,7 @@ def stream_events_until_close(
|
|
|
688
682
|
# payload the caller would otherwise build from `completion`.
|
|
689
683
|
try:
|
|
690
684
|
op = client.get_operation_status(op_uuid).to_dict()
|
|
691
|
-
except
|
|
685
|
+
except APIStatusError as exc:
|
|
692
686
|
logger.debug("terminal op fetch failed: %s", exc)
|
|
693
687
|
return summary
|
|
694
688
|
if op.get("status") in TERMINAL_STATUSES:
|
|
@@ -1027,7 +1021,7 @@ def cmd_run(args: RunArgs) -> int | None:
|
|
|
1027
1021
|
# so callers see the SIGPIPE convention (128 + 13).
|
|
1028
1022
|
if forwarder is not None:
|
|
1029
1023
|
forwarder.abandon()
|
|
1030
|
-
with contextlib.suppress(
|
|
1024
|
+
with contextlib.suppress(APIStatusError, OSError):
|
|
1031
1025
|
client.cancel_operation(op_uuid)
|
|
1032
1026
|
with contextlib.suppress(OSError):
|
|
1033
1027
|
devnull = os.open(os.devnull, os.O_WRONLY)
|
|
@@ -664,7 +664,9 @@ def cmd_wait(args: WaitArgs) -> int | None:
|
|
|
664
664
|
RequestSpec(method="GET", path="/operations", idempotent=True)
|
|
665
665
|
)
|
|
666
666
|
if response.status != 200:
|
|
667
|
-
raise error_for_response(
|
|
667
|
+
raise error_for_response(
|
|
668
|
+
response.status, response.headers, response.body
|
|
669
|
+
)
|
|
668
670
|
operations = json.loads(response.body)
|
|
669
671
|
api_op_ids: list[str] = []
|
|
670
672
|
for op in operations:
|
|
@@ -8,7 +8,7 @@ import logging
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
9
|
from typing import ClassVar
|
|
10
10
|
|
|
11
|
-
from contree_client.exceptions import
|
|
11
|
+
from contree_client.exceptions import APIStatusError
|
|
12
12
|
from contree_client.models import ImageImportRegistry
|
|
13
13
|
|
|
14
14
|
from contree_cli.cli.images import normalize_registry_url
|
|
@@ -110,7 +110,7 @@ def resolve_or_import(ctx: BuildContext, ref: str) -> str:
|
|
|
110
110
|
"""Resolve ``ref`` to a UUID, importing from a registry on miss."""
|
|
111
111
|
try:
|
|
112
112
|
return ctx.client.resolve_image(ref)
|
|
113
|
-
except
|
|
113
|
+
except APIStatusError as exc:
|
|
114
114
|
if exc.status != 404:
|
|
115
115
|
raise
|
|
116
116
|
|
|
@@ -127,7 +127,7 @@ def resolve_or_import(ctx: BuildContext, ref: str) -> str:
|
|
|
127
127
|
try:
|
|
128
128
|
return wait_import(ctx, op_uuid, tag)
|
|
129
129
|
except KeyboardInterrupt:
|
|
130
|
-
with contextlib.suppress(
|
|
130
|
+
with contextlib.suppress(APIStatusError, OSError):
|
|
131
131
|
ctx.client.cancel_operation(op_uuid)
|
|
132
132
|
raise
|
|
133
133
|
|
|
@@ -11,7 +11,7 @@ import sys
|
|
|
11
11
|
from dataclasses import dataclass
|
|
12
12
|
from functools import cached_property
|
|
13
13
|
|
|
14
|
-
from contree_client.exceptions import
|
|
14
|
+
from contree_client.exceptions import APIStatusError
|
|
15
15
|
|
|
16
16
|
from contree_cli import FORMATTER, IN_SHELL, PROFILE, SESSION_STORE, ArgumentsProtocol
|
|
17
17
|
from contree_cli.output import FORMATTERS, OutputFormatter
|
|
@@ -519,7 +519,7 @@ class ContreeShell:
|
|
|
519
519
|
before = self.session_snapshot()
|
|
520
520
|
try:
|
|
521
521
|
handler(loader.from_args(ns))
|
|
522
|
-
except
|
|
522
|
+
except APIStatusError as exc:
|
|
523
523
|
print(f"API error: {exc}", file=sys.stderr)
|
|
524
524
|
except KeyboardInterrupt:
|
|
525
525
|
print()
|
|
@@ -558,7 +558,7 @@ class ContreeShell:
|
|
|
558
558
|
before = self.session_snapshot()
|
|
559
559
|
try:
|
|
560
560
|
cmd_run(args)
|
|
561
|
-
except
|
|
561
|
+
except APIStatusError as exc:
|
|
562
562
|
print(f"API error: {exc}", file=sys.stderr)
|
|
563
563
|
except KeyboardInterrupt:
|
|
564
564
|
print()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "contree-cli"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.4"
|
|
4
4
|
description = "CLI client for the ConTree sandbox platform"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -28,7 +28,7 @@ classifiers = [
|
|
|
28
28
|
"Topic :: System :: Shells",
|
|
29
29
|
"Typing :: Typed",
|
|
30
30
|
]
|
|
31
|
-
dependencies = ["contree-client
|
|
31
|
+
dependencies = ["contree-client~=0.4.0"]
|
|
32
32
|
|
|
33
33
|
[project.license]
|
|
34
34
|
file = "LICENSE"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "contree-cli"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.4"
|
|
4
4
|
description = "CLI client for the ConTree sandbox platform"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -27,7 +27,7 @@ classifiers = [
|
|
|
27
27
|
"Typing :: Typed",
|
|
28
28
|
]
|
|
29
29
|
dependencies = [
|
|
30
|
-
"contree-client
|
|
30
|
+
"contree-client~=0.4.0",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|