forest-cli 0.1.0__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.
- forest/__init__.py +16 -0
- forest/analytics.py +29 -0
- forest/checkout.py +992 -0
- forest/cli.py +2747 -0
- forest/config.py +286 -0
- forest/flags.py +20 -0
- forest/flow.py +157 -0
- forest/fsutil.py +36 -0
- forest/logger.py +197 -0
- forest/manifest.py +112 -0
- forest/metrics.py +67 -0
- forest/monitoring.py +138 -0
- forest/paths.py +192 -0
- forest/rclone.py +561 -0
- forest/resilience.py +122 -0
- forest/sync_state.py +182 -0
- forest_cli-0.1.0.dist-info/METADATA +233 -0
- forest_cli-0.1.0.dist-info/RECORD +22 -0
- forest_cli-0.1.0.dist-info/WHEEL +5 -0
- forest_cli-0.1.0.dist-info/entry_points.txt +2 -0
- forest_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
- forest_cli-0.1.0.dist-info/top_level.txt +1 -0
forest/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""forest — git-like data management for arbitrary data trees.
|
|
2
|
+
|
|
3
|
+
Forest is a self-contained, domain-agnostic data-sync engine: workspace
|
|
4
|
+
initialization, named checkouts (focus), remotes, local bindings,
|
|
5
|
+
push/pull/status/ls, and sync state. It knows nothing about what the data
|
|
6
|
+
means — it syncs and inspects whatever files live in a unit.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version("forest")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
__version__ = "0.0.0"
|
forest/analytics.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Opt-in local usage analytics for forest commands.
|
|
2
|
+
|
|
3
|
+
No-op unless ``FOREST_ANALYTICS_FILE`` is set; events are appended as JSON
|
|
4
|
+
lines to that local file only — nothing leaves the machine. Eager options
|
|
5
|
+
(``--help``/``--version``) exit during parsing and are not recorded.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from datetime import datetime, timezone
|
|
11
|
+
|
|
12
|
+
from forest import __version__
|
|
13
|
+
from forest.logger import get_run_id
|
|
14
|
+
from forest.metrics import append_jsonl
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def record_command(command: str, *, duration_seconds: float, status: str) -> None:
|
|
18
|
+
"""Append one command-usage event. Never raises."""
|
|
19
|
+
append_jsonl(
|
|
20
|
+
"FOREST_ANALYTICS_FILE",
|
|
21
|
+
{
|
|
22
|
+
"ts": datetime.now(tz=timezone.utc).isoformat(),
|
|
23
|
+
"command": command,
|
|
24
|
+
"duration_seconds": round(duration_seconds, 3),
|
|
25
|
+
"status": status, # "success" | "error"
|
|
26
|
+
"run_id": get_run_id(),
|
|
27
|
+
"version": __version__,
|
|
28
|
+
},
|
|
29
|
+
)
|