okstra 0.162.1 → 0.162.2
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.
package/package.json
CHANGED
package/runtime/BUILD.json
CHANGED
|
@@ -55,3 +55,31 @@ except ResolverError as exc:
|
|
|
55
55
|
sys.exit(1)
|
|
56
56
|
PY
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
# `okstra setup` 이 이미 기록한 값을 다시 묻지 않기 위한 자동 채움. 프로젝트
|
|
60
|
+
# 안에서 실행하는 한 project-id 와 project-root 는 물어볼 것이 아니라 읽을 것이다.
|
|
61
|
+
autofill_from_project_json() {
|
|
62
|
+
[[ -n "$PROJECT_ID" && -n "$PROJECT_ROOT" ]] && return 0
|
|
63
|
+
local resolved
|
|
64
|
+
resolved="$(python3 - "$OKSTRA_PYTHONPATH" "$PROJECT_ROOT_OVERRIDE" <<'PY' || true
|
|
65
|
+
import json, sys
|
|
66
|
+
from pathlib import Path
|
|
67
|
+
sys.path.insert(0, sys.argv[1])
|
|
68
|
+
from okstra_project import project_json_path
|
|
69
|
+
from okstra_project.resolver import resolve_project_root
|
|
70
|
+
try:
|
|
71
|
+
root = resolve_project_root(explicit_root=sys.argv[2] or "")
|
|
72
|
+
except Exception:
|
|
73
|
+
sys.exit(0)
|
|
74
|
+
path = project_json_path(Path(root))
|
|
75
|
+
if not path.is_file():
|
|
76
|
+
sys.exit(0)
|
|
77
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
78
|
+
print(f"{data.get('projectId', '')}\t{root}")
|
|
79
|
+
PY
|
|
80
|
+
)"
|
|
81
|
+
[[ -z "$resolved" ]] && return 0
|
|
82
|
+
[[ -z "$PROJECT_ID" ]] && PROJECT_ID="${resolved%%$'\t'*}"
|
|
83
|
+
[[ -z "$PROJECT_ROOT" ]] && PROJECT_ROOT="${resolved##*$'\t'}"
|
|
84
|
+
return 0
|
|
85
|
+
}
|