@kmlckj/licos-ai-cli 0.0.54 → 0.0.56
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/lib/__templates__/agent/pyproject.toml +1 -1
- package/lib/__templates__/agent/scripts/http_run.sh +9 -1
- package/lib/__templates__/agent/scripts/setup.sh +88 -7
- package/lib/__templates__/workflow/pyproject.toml +1 -1
- package/lib/__templates__/workflow/scripts/http_run.sh +9 -1
- package/lib/__templates__/workflow/scripts/setup.sh +88 -7
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -26,4 +26,12 @@ cd "$PROJECT_DIR"
|
|
|
26
26
|
export LICOS_PROJECT_PATH="$PROJECT_DIR"
|
|
27
27
|
export AGENT_PROJECT_TYPE="${AGENT_PROJECT_TYPE:-AGENT}"
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
PYTHON_BIN="${PYTHON_BIN:-python}"
|
|
30
|
+
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1; then
|
|
31
|
+
PYTHON_BIN=python3
|
|
32
|
+
fi
|
|
33
|
+
if [ -x "$PROJECT_DIR/.venv/bin/python" ]; then
|
|
34
|
+
PYTHON_BIN="$PROJECT_DIR/.venv/bin/python"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
exec "$PYTHON_BIN" -m licos_agent_runtime --mode http --host "$HOST" --port "$PORT"
|
|
@@ -16,18 +16,93 @@ EOF
|
|
|
16
16
|
|
|
17
17
|
ensure_pip_config
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
if
|
|
21
|
-
|
|
19
|
+
PYTHON_BIN="${PYTHON_BIN:-python}"
|
|
20
|
+
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1; then
|
|
21
|
+
PYTHON_BIN=python3
|
|
22
22
|
fi
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
PIP_PYTHON="$PYTHON_BIN"
|
|
24
|
+
|
|
25
|
+
GLOBAL_PIP_ARGS=(--no-cache-dir)
|
|
26
|
+
if "$PYTHON_BIN" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
|
|
27
|
+
GLOBAL_PIP_ARGS+=(--break-system-packages)
|
|
25
28
|
fi
|
|
26
29
|
|
|
30
|
+
ensure_project_venv() {
|
|
31
|
+
local venv_dir="$PROJECT_DIR/.venv"
|
|
32
|
+
|
|
33
|
+
if [ -x "$venv_dir/bin/python" ] && "$venv_dir/bin/python" -m pip --version >/dev/null 2>&1; then
|
|
34
|
+
PIP_PYTHON="$venv_dir/bin/python"
|
|
35
|
+
return
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
rm -rf "$venv_dir"
|
|
39
|
+
echo "[setup] Creating project virtualenv at $venv_dir"
|
|
40
|
+
if ! "$PYTHON_BIN" -m venv "$venv_dir" >/dev/null 2>&1; then
|
|
41
|
+
echo "[setup] python -m venv unavailable; installing virtualenv fallback"
|
|
42
|
+
"$PYTHON_BIN" -m pip install "${GLOBAL_PIP_ARGS[@]}" virtualenv
|
|
43
|
+
"$PYTHON_BIN" -m virtualenv "$venv_dir"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
PIP_PYTHON="$venv_dir/bin/python"
|
|
47
|
+
"$PIP_PYTHON" -m pip --version >/dev/null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
PIP_ARGS=()
|
|
51
|
+
refresh_pip_args() {
|
|
52
|
+
PIP_ARGS=(--no-cache-dir)
|
|
53
|
+
if "$PIP_PYTHON" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
|
|
54
|
+
PIP_ARGS+=(--break-system-packages)
|
|
55
|
+
fi
|
|
56
|
+
if [ -n "${PIP_TARGET:-}" ]; then
|
|
57
|
+
PIP_ARGS+=(--target "$PIP_TARGET")
|
|
58
|
+
fi
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
refresh_pip_args
|
|
62
|
+
|
|
63
|
+
install_pyproject_dependencies_with_pip() {
|
|
64
|
+
if [ -z "${PIP_TARGET:-}" ]; then
|
|
65
|
+
ensure_project_venv
|
|
66
|
+
fi
|
|
67
|
+
refresh_pip_args
|
|
68
|
+
|
|
69
|
+
local deps_file
|
|
70
|
+
deps_file="$(mktemp)"
|
|
71
|
+
"$PIP_PYTHON" - "$deps_file" <<'PY'
|
|
72
|
+
import sys
|
|
73
|
+
import tomllib
|
|
74
|
+
from pathlib import Path
|
|
75
|
+
|
|
76
|
+
deps_path = Path(sys.argv[1])
|
|
77
|
+
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
|
|
78
|
+
dependencies = data.get("project", {}).get("dependencies", [])
|
|
79
|
+
lines = []
|
|
80
|
+
if isinstance(dependencies, list):
|
|
81
|
+
lines = [
|
|
82
|
+
item.strip()
|
|
83
|
+
for item in dependencies
|
|
84
|
+
if isinstance(item, str) and item.strip()
|
|
85
|
+
]
|
|
86
|
+
deps_path.write_text("\n".join(lines) + ("\n" if lines else ""), encoding="utf-8")
|
|
87
|
+
PY
|
|
88
|
+
|
|
89
|
+
if [ -s "$deps_file" ]; then
|
|
90
|
+
echo "[setup] Pip mode: installing dependencies from pyproject.toml"
|
|
91
|
+
local status=0
|
|
92
|
+
"$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
|
|
93
|
+
rm -f "$deps_file"
|
|
94
|
+
return "$status"
|
|
95
|
+
else
|
|
96
|
+
echo "[setup] pyproject.toml has no project.dependencies, skipping install"
|
|
97
|
+
fi
|
|
98
|
+
rm -f "$deps_file"
|
|
99
|
+
}
|
|
100
|
+
|
|
27
101
|
if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
|
|
28
102
|
if [ -n "${PIP_TARGET:-}" ]; then
|
|
29
103
|
echo "[setup] Deploy mode (uv): installing to PIP_TARGET=$PIP_TARGET"
|
|
30
|
-
uv export --frozen --no-hashes --no-dev | uv pip install --no-cache --target "$PIP_TARGET" -r -
|
|
104
|
+
uv export --frozen --no-hashes --no-dev | uv pip install --no-cache --target "$PIP_TARGET" -r - \
|
|
105
|
+
|| install_pyproject_dependencies_with_pip
|
|
31
106
|
else
|
|
32
107
|
echo "[setup] Dev mode (uv): syncing .venv"
|
|
33
108
|
if [ -f "uv.lock" ]; then
|
|
@@ -36,9 +111,15 @@ if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
|
|
|
36
111
|
uv sync
|
|
37
112
|
fi
|
|
38
113
|
fi
|
|
114
|
+
elif [ -f "pyproject.toml" ]; then
|
|
115
|
+
install_pyproject_dependencies_with_pip
|
|
39
116
|
elif [ -f "requirements.txt" ]; then
|
|
117
|
+
if [ -z "${PIP_TARGET:-}" ]; then
|
|
118
|
+
ensure_project_venv
|
|
119
|
+
fi
|
|
120
|
+
refresh_pip_args
|
|
40
121
|
echo "[setup] Fallback mode (pip): installing from requirements.txt"
|
|
41
|
-
|
|
122
|
+
"$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r requirements.txt
|
|
42
123
|
else
|
|
43
124
|
echo "[setup] no pyproject.toml or requirements.txt found, skipping install"
|
|
44
125
|
fi
|
|
@@ -26,4 +26,12 @@ cd "$PROJECT_DIR"
|
|
|
26
26
|
export LICOS_PROJECT_PATH="$PROJECT_DIR"
|
|
27
27
|
export AGENT_PROJECT_TYPE="${AGENT_PROJECT_TYPE:-WORKFLOW}"
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
PYTHON_BIN="${PYTHON_BIN:-python}"
|
|
30
|
+
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1; then
|
|
31
|
+
PYTHON_BIN=python3
|
|
32
|
+
fi
|
|
33
|
+
if [ -x "$PROJECT_DIR/.venv/bin/python" ]; then
|
|
34
|
+
PYTHON_BIN="$PROJECT_DIR/.venv/bin/python"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
exec "$PYTHON_BIN" -m licos_agent_runtime --mode http --host "$HOST" --port "$PORT"
|
|
@@ -16,18 +16,93 @@ EOF
|
|
|
16
16
|
|
|
17
17
|
ensure_pip_config
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
if
|
|
21
|
-
|
|
19
|
+
PYTHON_BIN="${PYTHON_BIN:-python}"
|
|
20
|
+
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1; then
|
|
21
|
+
PYTHON_BIN=python3
|
|
22
22
|
fi
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
PIP_PYTHON="$PYTHON_BIN"
|
|
24
|
+
|
|
25
|
+
GLOBAL_PIP_ARGS=(--no-cache-dir)
|
|
26
|
+
if "$PYTHON_BIN" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
|
|
27
|
+
GLOBAL_PIP_ARGS+=(--break-system-packages)
|
|
25
28
|
fi
|
|
26
29
|
|
|
30
|
+
ensure_project_venv() {
|
|
31
|
+
local venv_dir="$PROJECT_DIR/.venv"
|
|
32
|
+
|
|
33
|
+
if [ -x "$venv_dir/bin/python" ] && "$venv_dir/bin/python" -m pip --version >/dev/null 2>&1; then
|
|
34
|
+
PIP_PYTHON="$venv_dir/bin/python"
|
|
35
|
+
return
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
rm -rf "$venv_dir"
|
|
39
|
+
echo "[setup] Creating project virtualenv at $venv_dir"
|
|
40
|
+
if ! "$PYTHON_BIN" -m venv "$venv_dir" >/dev/null 2>&1; then
|
|
41
|
+
echo "[setup] python -m venv unavailable; installing virtualenv fallback"
|
|
42
|
+
"$PYTHON_BIN" -m pip install "${GLOBAL_PIP_ARGS[@]}" virtualenv
|
|
43
|
+
"$PYTHON_BIN" -m virtualenv "$venv_dir"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
PIP_PYTHON="$venv_dir/bin/python"
|
|
47
|
+
"$PIP_PYTHON" -m pip --version >/dev/null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
PIP_ARGS=()
|
|
51
|
+
refresh_pip_args() {
|
|
52
|
+
PIP_ARGS=(--no-cache-dir)
|
|
53
|
+
if "$PIP_PYTHON" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
|
|
54
|
+
PIP_ARGS+=(--break-system-packages)
|
|
55
|
+
fi
|
|
56
|
+
if [ -n "${PIP_TARGET:-}" ]; then
|
|
57
|
+
PIP_ARGS+=(--target "$PIP_TARGET")
|
|
58
|
+
fi
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
refresh_pip_args
|
|
62
|
+
|
|
63
|
+
install_pyproject_dependencies_with_pip() {
|
|
64
|
+
if [ -z "${PIP_TARGET:-}" ]; then
|
|
65
|
+
ensure_project_venv
|
|
66
|
+
fi
|
|
67
|
+
refresh_pip_args
|
|
68
|
+
|
|
69
|
+
local deps_file
|
|
70
|
+
deps_file="$(mktemp)"
|
|
71
|
+
"$PIP_PYTHON" - "$deps_file" <<'PY'
|
|
72
|
+
import sys
|
|
73
|
+
import tomllib
|
|
74
|
+
from pathlib import Path
|
|
75
|
+
|
|
76
|
+
deps_path = Path(sys.argv[1])
|
|
77
|
+
data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
|
|
78
|
+
dependencies = data.get("project", {}).get("dependencies", [])
|
|
79
|
+
lines = []
|
|
80
|
+
if isinstance(dependencies, list):
|
|
81
|
+
lines = [
|
|
82
|
+
item.strip()
|
|
83
|
+
for item in dependencies
|
|
84
|
+
if isinstance(item, str) and item.strip()
|
|
85
|
+
]
|
|
86
|
+
deps_path.write_text("\n".join(lines) + ("\n" if lines else ""), encoding="utf-8")
|
|
87
|
+
PY
|
|
88
|
+
|
|
89
|
+
if [ -s "$deps_file" ]; then
|
|
90
|
+
echo "[setup] Pip mode: installing dependencies from pyproject.toml"
|
|
91
|
+
local status=0
|
|
92
|
+
"$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
|
|
93
|
+
rm -f "$deps_file"
|
|
94
|
+
return "$status"
|
|
95
|
+
else
|
|
96
|
+
echo "[setup] pyproject.toml has no project.dependencies, skipping install"
|
|
97
|
+
fi
|
|
98
|
+
rm -f "$deps_file"
|
|
99
|
+
}
|
|
100
|
+
|
|
27
101
|
if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
|
|
28
102
|
if [ -n "${PIP_TARGET:-}" ]; then
|
|
29
103
|
echo "[setup] Deploy mode (uv): installing to PIP_TARGET=$PIP_TARGET"
|
|
30
|
-
uv export --frozen --no-hashes --no-dev | uv pip install --no-cache --target "$PIP_TARGET" -r -
|
|
104
|
+
uv export --frozen --no-hashes --no-dev | uv pip install --no-cache --target "$PIP_TARGET" -r - \
|
|
105
|
+
|| install_pyproject_dependencies_with_pip
|
|
31
106
|
else
|
|
32
107
|
echo "[setup] Dev mode (uv): syncing .venv"
|
|
33
108
|
if [ -f "uv.lock" ]; then
|
|
@@ -36,9 +111,15 @@ if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
|
|
|
36
111
|
uv sync
|
|
37
112
|
fi
|
|
38
113
|
fi
|
|
114
|
+
elif [ -f "pyproject.toml" ]; then
|
|
115
|
+
install_pyproject_dependencies_with_pip
|
|
39
116
|
elif [ -f "requirements.txt" ]; then
|
|
117
|
+
if [ -z "${PIP_TARGET:-}" ]; then
|
|
118
|
+
ensure_project_venv
|
|
119
|
+
fi
|
|
120
|
+
refresh_pip_args
|
|
40
121
|
echo "[setup] Fallback mode (pip): installing from requirements.txt"
|
|
41
|
-
|
|
122
|
+
"$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r requirements.txt
|
|
42
123
|
else
|
|
43
124
|
echo "[setup] no pyproject.toml or requirements.txt found, skipping install"
|
|
44
125
|
fi
|
package/lib/cli.js
CHANGED
|
@@ -2109,7 +2109,7 @@ const EventBuilder = {
|
|
|
2109
2109
|
};
|
|
2110
2110
|
|
|
2111
2111
|
var name = "@kmlckj/licos-ai-cli";
|
|
2112
|
-
var version = "0.0.
|
|
2112
|
+
var version = "0.0.56";
|
|
2113
2113
|
var description = "LICOS AI coding workspace CLI - project template engine and dev tools";
|
|
2114
2114
|
var license = "MIT";
|
|
2115
2115
|
var author = "kmlckj";
|