mirrorneuron-cli 1.1.4__tar.gz → 1.1.9__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.
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/.github/workflows/ci.yml +2 -3
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/.github/workflows/release.yml +2 -13
- mirrorneuron_cli-1.1.9/AGENTS.md +9 -0
- mirrorneuron_cli-1.1.9/PKG-INFO +52 -0
- mirrorneuron_cli-1.1.9/README.md +38 -0
- mirrorneuron_cli-1.1.9/mirrorneuron_cli.egg-info/PKG-INFO +52 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mirrorneuron_cli.egg-info/SOURCES.txt +18 -0
- mirrorneuron_cli-1.1.9/mn_cli/banner.py +13 -0
- mirrorneuron_cli-1.1.9/mn_cli/config.py +106 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/error_handler.py +19 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/backup_cmds.py +562 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/blueprint_cmds.py +1172 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/libs/blueprint_observability.py +44 -14
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/libs/blueprint_repository.py +1 -1
- mirrorneuron_cli-1.1.9/mn_cli/libs/blueprint_resources.py +895 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/deployment_cmds.py +144 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/event_relay.py +43 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/job_cmds.py +461 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/resource_cmds.py +138 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/run_cmds.py +2920 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/libs/run_logs.py +34 -2
- mirrorneuron_cli-1.1.9/mn_cli/libs/run_manifest.py +522 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/schedule_cmds.py +224 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/service_cmds.py +115 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/sys_cmds.py +146 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/ui.py +551 -0
- mirrorneuron_cli-1.1.9/mn_cli/libs/workflow_progress.py +131 -0
- mirrorneuron_cli-1.1.9/mn_cli/main.py +101 -0
- mirrorneuron_cli-1.1.9/mn_cli/server_cmds.py +1929 -0
- mirrorneuron_cli-1.1.9/mn_cli/shared.py +45 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/update_cmds.py +24 -6
- mirrorneuron_cli-1.1.9/tests/test_backup_cmds.py +156 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/tests/test_blueprint_cmds.py +327 -45
- mirrorneuron_cli-1.1.9/tests/test_blueprint_resources.py +251 -0
- mirrorneuron_cli-1.1.9/tests/test_deployment_cmds.py +63 -0
- mirrorneuron_cli-1.1.9/tests/test_job_cmds.py +507 -0
- mirrorneuron_cli-1.1.9/tests/test_main.py +58 -0
- mirrorneuron_cli-1.1.9/tests/test_run_cmds.py +1842 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/tests/test_run_helpers.py +137 -1
- mirrorneuron_cli-1.1.9/tests/test_schedule_cmds.py +78 -0
- mirrorneuron_cli-1.1.9/tests/test_server_cmds.py +1310 -0
- mirrorneuron_cli-1.1.9/tests/test_service_cmds.py +73 -0
- mirrorneuron_cli-1.1.9/tests/test_shared.py +121 -0
- mirrorneuron_cli-1.1.9/tests/test_sys_cmds.py +178 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/tests/test_update_cmds.py +40 -2
- mirrorneuron_cli-1.1.9/uv.lock +204 -0
- mirrorneuron_cli-1.1.4/PKG-INFO +0 -202
- mirrorneuron_cli-1.1.4/README.md +0 -188
- mirrorneuron_cli-1.1.4/mirrorneuron_cli.egg-info/PKG-INFO +0 -202
- mirrorneuron_cli-1.1.4/mn_cli/config.py +0 -43
- mirrorneuron_cli-1.1.4/mn_cli/libs/blueprint_cmds.py +0 -569
- mirrorneuron_cli-1.1.4/mn_cli/libs/job_cmds.py +0 -225
- mirrorneuron_cli-1.1.4/mn_cli/libs/run_cmds.py +0 -541
- mirrorneuron_cli-1.1.4/mn_cli/libs/run_manifest.py +0 -253
- mirrorneuron_cli-1.1.4/mn_cli/libs/sys_cmds.py +0 -51
- mirrorneuron_cli-1.1.4/mn_cli/libs/ui.py +0 -162
- mirrorneuron_cli-1.1.4/mn_cli/main.py +0 -43
- mirrorneuron_cli-1.1.4/mn_cli/server_cmds.py +0 -344
- mirrorneuron_cli-1.1.4/mn_cli/shared.py +0 -13
- mirrorneuron_cli-1.1.4/tests/test_job_cmds.py +0 -225
- mirrorneuron_cli-1.1.4/tests/test_run_cmds.py +0 -446
- mirrorneuron_cli-1.1.4/tests/test_server_cmds.py +0 -291
- mirrorneuron_cli-1.1.4/tests/test_sys_cmds.py +0 -89
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/.gitignore +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/LICENSE +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/RELEASE.md +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mirrorneuron_cli.egg-info/dependency_links.txt +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mirrorneuron_cli.egg-info/entry_points.txt +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mirrorneuron_cli.egg-info/requires.txt +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mirrorneuron_cli.egg-info/top_level.txt +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/__init__.py +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/libs/__init__.py +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/mn_cli/logging_config.py +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/pyproject.toml +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/scripts/check-release-artifacts.sh +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/scripts/make-release-zip.sh +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/scripts/validate-version-tag.sh +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/setup.cfg +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/tests/conftest.py +0 -0
- {mirrorneuron_cli-1.1.4 → mirrorneuron_cli-1.1.9}/tests/test_blueprint_repository.py +0 -0
|
@@ -3,13 +3,7 @@ name: Release
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
tags:
|
|
6
|
-
- "v
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
inputs:
|
|
9
|
-
tag:
|
|
10
|
-
description: "Existing release tag to publish, such as v1.0.1 or v1.0.1-rc.1"
|
|
11
|
-
required: true
|
|
12
|
-
type: string
|
|
6
|
+
- "v[0-9]*.[0-9]*.[0-9]*"
|
|
13
7
|
|
|
14
8
|
permissions:
|
|
15
9
|
contents: read
|
|
@@ -31,19 +25,14 @@ jobs:
|
|
|
31
25
|
uses: actions/checkout@v4
|
|
32
26
|
with:
|
|
33
27
|
fetch-depth: 0
|
|
34
|
-
ref: ${{ github.
|
|
28
|
+
ref: ${{ github.ref }}
|
|
35
29
|
|
|
36
30
|
- name: Validate release tag
|
|
37
31
|
id: version
|
|
38
32
|
shell: bash
|
|
39
|
-
env:
|
|
40
|
-
INPUT_TAG: ${{ inputs.tag }}
|
|
41
33
|
run: |
|
|
42
34
|
set -euo pipefail
|
|
43
35
|
tag="$GITHUB_REF_NAME"
|
|
44
|
-
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
|
|
45
|
-
tag="$INPUT_TAG"
|
|
46
|
-
fi
|
|
47
36
|
scripts/validate-version-tag.sh "$tag"
|
|
48
37
|
|
|
49
38
|
- name: Detect project type
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for future coding agents working in this repository.
|
|
4
|
+
|
|
5
|
+
## Issue Fixing Policy
|
|
6
|
+
|
|
7
|
+
- Unless the user explicitly asks for a temporary workaround, fix the root cause in the intended layer or contract.
|
|
8
|
+
- Avoid adding fallback paths, compatibility shims, feature flags, or temp solutions that mask a broken primary path.
|
|
9
|
+
- If fallback behavior is already product-specified, keep it narrow, documented, and tested; do not use it to avoid fixing the primary path.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirrorneuron-cli
|
|
3
|
+
Version: 1.1.9
|
|
4
|
+
Summary: MirrorNeuron CLI
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: mirrorneuron-python-sdk
|
|
11
|
+
Requires-Dist: typer>=0.9.0
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# MirrorNeuron CLI
|
|
16
|
+
|
|
17
|
+
`mn-cli` provides the `mn` command for validating and running blueprints,
|
|
18
|
+
inspecting runtime state, managing jobs, exporting artifacts, and starting local
|
|
19
|
+
services installed by `mn-deploy`.
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
Install locally and run tests:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 -m venv .venv
|
|
27
|
+
. .venv/bin/activate
|
|
28
|
+
python3 -m pip install -e .
|
|
29
|
+
python3 -m pytest -q
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Try the CLI:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mn --version
|
|
36
|
+
mn node list
|
|
37
|
+
mn blueprint run message_routing_trace
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Details
|
|
41
|
+
|
|
42
|
+
- [MirrorNeuron Component Guide](../mn-docs/component-guide.md#cli)
|
|
43
|
+
- [CLI Reference](../mn-docs/cli.md)
|
|
44
|
+
- [Environment Variables](../mn-docs/env_variables.md)
|
|
45
|
+
- [Monitor Guide](../mn-docs/monitor.md)
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- A running MirrorNeuron core is required for live runtime commands.
|
|
50
|
+
- The default gRPC target comes from `MN_GRPC_TARGET`, then local deployment
|
|
51
|
+
settings, then `localhost:55051`.
|
|
52
|
+
- Use `mn blueprint validate` before `mn blueprint run --folder` when checking a local bundle.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# MirrorNeuron CLI
|
|
2
|
+
|
|
3
|
+
`mn-cli` provides the `mn` command for validating and running blueprints,
|
|
4
|
+
inspecting runtime state, managing jobs, exporting artifacts, and starting local
|
|
5
|
+
services installed by `mn-deploy`.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
Install locally and run tests:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
python3 -m venv .venv
|
|
13
|
+
. .venv/bin/activate
|
|
14
|
+
python3 -m pip install -e .
|
|
15
|
+
python3 -m pytest -q
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Try the CLI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
mn --version
|
|
22
|
+
mn node list
|
|
23
|
+
mn blueprint run message_routing_trace
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Details
|
|
27
|
+
|
|
28
|
+
- [MirrorNeuron Component Guide](../mn-docs/component-guide.md#cli)
|
|
29
|
+
- [CLI Reference](../mn-docs/cli.md)
|
|
30
|
+
- [Environment Variables](../mn-docs/env_variables.md)
|
|
31
|
+
- [Monitor Guide](../mn-docs/monitor.md)
|
|
32
|
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
- A running MirrorNeuron core is required for live runtime commands.
|
|
36
|
+
- The default gRPC target comes from `MN_GRPC_TARGET`, then local deployment
|
|
37
|
+
settings, then `localhost:55051`.
|
|
38
|
+
- Use `mn blueprint validate` before `mn blueprint run --folder` when checking a local bundle.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mirrorneuron-cli
|
|
3
|
+
Version: 1.1.9
|
|
4
|
+
Summary: MirrorNeuron CLI
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: mirrorneuron-python-sdk
|
|
11
|
+
Requires-Dist: typer>=0.9.0
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# MirrorNeuron CLI
|
|
16
|
+
|
|
17
|
+
`mn-cli` provides the `mn` command for validating and running blueprints,
|
|
18
|
+
inspecting runtime state, managing jobs, exporting artifacts, and starting local
|
|
19
|
+
services installed by `mn-deploy`.
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
Install locally and run tests:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 -m venv .venv
|
|
27
|
+
. .venv/bin/activate
|
|
28
|
+
python3 -m pip install -e .
|
|
29
|
+
python3 -m pytest -q
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Try the CLI:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mn --version
|
|
36
|
+
mn node list
|
|
37
|
+
mn blueprint run message_routing_trace
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Details
|
|
41
|
+
|
|
42
|
+
- [MirrorNeuron Component Guide](../mn-docs/component-guide.md#cli)
|
|
43
|
+
- [CLI Reference](../mn-docs/cli.md)
|
|
44
|
+
- [Environment Variables](../mn-docs/env_variables.md)
|
|
45
|
+
- [Monitor Guide](../mn-docs/monitor.md)
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- A running MirrorNeuron core is required for live runtime commands.
|
|
50
|
+
- The default gRPC target comes from `MN_GRPC_TARGET`, then local deployment
|
|
51
|
+
settings, then `localhost:55051`.
|
|
52
|
+
- Use `mn blueprint validate` before `mn blueprint run --folder` when checking a local bundle.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
.gitignore
|
|
2
|
+
AGENTS.md
|
|
2
3
|
LICENSE
|
|
3
4
|
README.md
|
|
4
5
|
RELEASE.md
|
|
5
6
|
pyproject.toml
|
|
7
|
+
uv.lock
|
|
6
8
|
.github/workflows/ci.yml
|
|
7
9
|
.github/workflows/release.yml
|
|
8
10
|
mirrorneuron_cli.egg-info/PKG-INFO
|
|
@@ -12,6 +14,7 @@ mirrorneuron_cli.egg-info/entry_points.txt
|
|
|
12
14
|
mirrorneuron_cli.egg-info/requires.txt
|
|
13
15
|
mirrorneuron_cli.egg-info/top_level.txt
|
|
14
16
|
mn_cli/__init__.py
|
|
17
|
+
mn_cli/banner.py
|
|
15
18
|
mn_cli/config.py
|
|
16
19
|
mn_cli/error_handler.py
|
|
17
20
|
mn_cli/logging_config.py
|
|
@@ -20,24 +23,39 @@ mn_cli/server_cmds.py
|
|
|
20
23
|
mn_cli/shared.py
|
|
21
24
|
mn_cli/update_cmds.py
|
|
22
25
|
mn_cli/libs/__init__.py
|
|
26
|
+
mn_cli/libs/backup_cmds.py
|
|
23
27
|
mn_cli/libs/blueprint_cmds.py
|
|
24
28
|
mn_cli/libs/blueprint_observability.py
|
|
25
29
|
mn_cli/libs/blueprint_repository.py
|
|
30
|
+
mn_cli/libs/blueprint_resources.py
|
|
31
|
+
mn_cli/libs/deployment_cmds.py
|
|
32
|
+
mn_cli/libs/event_relay.py
|
|
26
33
|
mn_cli/libs/job_cmds.py
|
|
34
|
+
mn_cli/libs/resource_cmds.py
|
|
27
35
|
mn_cli/libs/run_cmds.py
|
|
28
36
|
mn_cli/libs/run_logs.py
|
|
29
37
|
mn_cli/libs/run_manifest.py
|
|
38
|
+
mn_cli/libs/schedule_cmds.py
|
|
39
|
+
mn_cli/libs/service_cmds.py
|
|
30
40
|
mn_cli/libs/sys_cmds.py
|
|
31
41
|
mn_cli/libs/ui.py
|
|
42
|
+
mn_cli/libs/workflow_progress.py
|
|
32
43
|
scripts/check-release-artifacts.sh
|
|
33
44
|
scripts/make-release-zip.sh
|
|
34
45
|
scripts/validate-version-tag.sh
|
|
35
46
|
tests/conftest.py
|
|
47
|
+
tests/test_backup_cmds.py
|
|
36
48
|
tests/test_blueprint_cmds.py
|
|
37
49
|
tests/test_blueprint_repository.py
|
|
50
|
+
tests/test_blueprint_resources.py
|
|
51
|
+
tests/test_deployment_cmds.py
|
|
38
52
|
tests/test_job_cmds.py
|
|
53
|
+
tests/test_main.py
|
|
39
54
|
tests/test_run_cmds.py
|
|
40
55
|
tests/test_run_helpers.py
|
|
56
|
+
tests/test_schedule_cmds.py
|
|
41
57
|
tests/test_server_cmds.py
|
|
58
|
+
tests/test_service_cmds.py
|
|
59
|
+
tests/test_shared.py
|
|
42
60
|
tests/test_sys_cmds.py
|
|
43
61
|
tests/test_update_cmds.py
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
MN_ASCII_ART = r"""
|
|
2
|
+
__ __ _ _ _
|
|
3
|
+
| \/ (_)_ __ _ __ ___ _ __| \ | | ___ _ _ _ __ ___ _ __
|
|
4
|
+
| |\/| | | '__| '__/ _ \| '__| \| |/ _ \ | | | '__/ _ \| '_ \
|
|
5
|
+
| | | | | | | | | (_) | | | |\ | __/ |_| | | | (_) | | | |
|
|
6
|
+
|_| |_|_|_| |_| \___/|_| |_| \_|\___|\__,_|_| \___/|_| |_|
|
|
7
|
+
""".strip("\n")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def format_banner(title: str | None = None) -> str:
|
|
11
|
+
if not title:
|
|
12
|
+
return MN_ASCII_ART
|
|
13
|
+
return f"{MN_ASCII_ART}\n\n => {title}"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class CliConfig:
|
|
10
|
+
grpc_target: str = "localhost:55051"
|
|
11
|
+
grpc_timeout_seconds: float | None = 10.0
|
|
12
|
+
grpc_auth_token: str = ""
|
|
13
|
+
grpc_admin_token: str = ""
|
|
14
|
+
log_path: Path = Path.home() / ".mn" / "logs" / "cli.log"
|
|
15
|
+
output_mode: str = "rich"
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def from_env(cls) -> "CliConfig":
|
|
19
|
+
runtime_env = _read_env_file(_mn_home() / "docker-compose.env")
|
|
20
|
+
core_host = os.getenv("MN_CORE_HOST") or runtime_env.get("MN_CORE_HOST") or "localhost"
|
|
21
|
+
grpc_port = os.getenv("MN_GRPC_PORT") or runtime_env.get("MN_GRPC_PORT") or "55051"
|
|
22
|
+
return cls(
|
|
23
|
+
grpc_target=os.getenv(
|
|
24
|
+
"MN_GRPC_TARGET",
|
|
25
|
+
os.getenv(
|
|
26
|
+
"MN_CORE_GRPC_TARGET",
|
|
27
|
+
runtime_env.get("MN_GRPC_TARGET")
|
|
28
|
+
or runtime_env.get("MN_CORE_GRPC_TARGET")
|
|
29
|
+
or f"{core_host}:{grpc_port}",
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
grpc_timeout_seconds=_timeout(),
|
|
33
|
+
grpc_auth_token=_grpc_auth_token(runtime_env),
|
|
34
|
+
grpc_admin_token=_grpc_admin_token(runtime_env),
|
|
35
|
+
log_path=Path(
|
|
36
|
+
os.getenv(
|
|
37
|
+
"MN_CLI_LOG_PATH",
|
|
38
|
+
str(Path.home() / ".mn" / "logs" / "cli.log"),
|
|
39
|
+
)
|
|
40
|
+
).expanduser(),
|
|
41
|
+
output_mode=os.getenv("MN_CLI_OUTPUT", "rich"),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _mn_home() -> Path:
|
|
46
|
+
configured_home = os.getenv("MN_HOME") or os.getenv("MIRROR_NEURON_HOME")
|
|
47
|
+
return Path(configured_home).expanduser() if configured_home else Path.home() / ".mn"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _read_env_file(path: Path) -> dict[str, str]:
|
|
51
|
+
try:
|
|
52
|
+
lines = path.read_text(encoding="utf-8").splitlines()
|
|
53
|
+
except OSError:
|
|
54
|
+
return {}
|
|
55
|
+
|
|
56
|
+
values: dict[str, str] = {}
|
|
57
|
+
for line in lines:
|
|
58
|
+
stripped = line.strip()
|
|
59
|
+
if not stripped or stripped.startswith("#") or "=" not in stripped:
|
|
60
|
+
continue
|
|
61
|
+
key, value = stripped.split("=", 1)
|
|
62
|
+
values[key] = value
|
|
63
|
+
return values
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _timeout() -> float | None:
|
|
67
|
+
value = os.getenv("MN_GRPC_TIMEOUT_SECONDS", "10")
|
|
68
|
+
if value.lower() in {"", "none", "0"}:
|
|
69
|
+
return None
|
|
70
|
+
try:
|
|
71
|
+
return float(value)
|
|
72
|
+
except ValueError as exc:
|
|
73
|
+
raise ValueError("MN_GRPC_TIMEOUT_SECONDS must be a number, 0, or none") from exc
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _grpc_auth_token(runtime_env: dict[str, str] | None = None) -> str:
|
|
77
|
+
token = os.getenv("MN_GRPC_AUTH_TOKEN")
|
|
78
|
+
if token:
|
|
79
|
+
return token
|
|
80
|
+
token = (runtime_env or {}).get("MN_GRPC_AUTH_TOKEN", "")
|
|
81
|
+
if token:
|
|
82
|
+
return token
|
|
83
|
+
|
|
84
|
+
return _read_token_file("grpc_auth.token")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _grpc_admin_token(runtime_env: dict[str, str] | None = None) -> str:
|
|
88
|
+
token = os.getenv("MN_MIRROR_NEURON_GRPC_ADMIN_TOKEN")
|
|
89
|
+
if token:
|
|
90
|
+
return token
|
|
91
|
+
token = (runtime_env or {}).get("MN_MIRROR_NEURON_GRPC_ADMIN_TOKEN", "")
|
|
92
|
+
if token:
|
|
93
|
+
return token
|
|
94
|
+
|
|
95
|
+
return _read_token_file("grpc_admin.token")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _read_token_file(name: str) -> str:
|
|
99
|
+
for token_file in (_mn_home() / name, Path.home() / ".mirror_neuron" / name):
|
|
100
|
+
try:
|
|
101
|
+
token = token_file.read_text().strip()
|
|
102
|
+
except OSError:
|
|
103
|
+
continue
|
|
104
|
+
if token:
|
|
105
|
+
return token
|
|
106
|
+
return ""
|
|
@@ -14,8 +14,27 @@ CONTEXT_MESSAGES = {
|
|
|
14
14
|
"cancel": "Error cancelling job",
|
|
15
15
|
"pause": "Error pausing job",
|
|
16
16
|
"resume": "Error resuming job",
|
|
17
|
+
"backup": "Error backing up job",
|
|
18
|
+
"restore": "Error restoring job",
|
|
17
19
|
"nodes": "Error fetching nodes",
|
|
20
|
+
"reconcile-node": "Error reconciling node",
|
|
21
|
+
"drain-node": "Error draining node",
|
|
22
|
+
"undrain-node": "Error cancelling node drain",
|
|
23
|
+
"maintenance-node": "Error changing node maintenance",
|
|
18
24
|
"metrics": "Error fetching metrics",
|
|
25
|
+
"resource list": "Error fetching resources",
|
|
26
|
+
"resource set": "Error setting resource limits",
|
|
27
|
+
"service list": "Error listing services",
|
|
28
|
+
"service resolve": "Error resolving service",
|
|
29
|
+
"service check": "Service validation failed",
|
|
30
|
+
"deploy": "Error deploying bundle",
|
|
31
|
+
"deployment list": "Error listing deployments",
|
|
32
|
+
"deployment status": "Error fetching deployment",
|
|
33
|
+
"deployment promote": "Error promoting deployment",
|
|
34
|
+
"deployment rollback": "Error rolling back deployment",
|
|
35
|
+
"deployment pause": "Error pausing deployment",
|
|
36
|
+
"deployment resume": "Error resuming deployment",
|
|
37
|
+
"deployment fail": "Error failing deployment",
|
|
19
38
|
"dead_letters": "Error listing dead letters",
|
|
20
39
|
"run bundle": "Error running bundle",
|
|
21
40
|
"monitor stream": "Error fetching job",
|