@kmlckj/licos-ai-cli 0.0.55 → 0.0.57

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.
@@ -27,6 +27,9 @@ 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
30
33
  if [ -x "$PROJECT_DIR/.venv/bin/python" ]; then
31
34
  PYTHON_BIN="$PROJECT_DIR/.venv/bin/python"
32
35
  fi
@@ -16,18 +16,61 @@ EOF
16
16
 
17
17
  ensure_pip_config
18
18
 
19
- PIP_ARGS=(--no-cache-dir)
20
- if python -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
21
- PIP_ARGS+=(--break-system-packages)
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
- if [ -n "${PIP_TARGET:-}" ]; then
24
- PIP_ARGS+=(--target "$PIP_TARGET")
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" ] \
34
+ && "$venv_dir/bin/python" -m pip --version >/dev/null 2>&1 \
35
+ && grep -Eq '^include-system-site-packages[[:space:]]*=[[:space:]]*true$' "$venv_dir/pyvenv.cfg" 2>/dev/null; then
36
+ PIP_PYTHON="$venv_dir/bin/python"
37
+ return
38
+ fi
39
+
40
+ rm -rf "$venv_dir"
41
+ echo "[setup] Creating project virtualenv at $venv_dir"
42
+ if ! "$PYTHON_BIN" -m venv --system-site-packages "$venv_dir" >/dev/null 2>&1; then
43
+ echo "[setup] python -m venv unavailable; installing virtualenv fallback"
44
+ "$PYTHON_BIN" -m pip install "${GLOBAL_PIP_ARGS[@]}" virtualenv
45
+ "$PYTHON_BIN" -m virtualenv --system-site-packages "$venv_dir"
46
+ fi
47
+
48
+ PIP_PYTHON="$venv_dir/bin/python"
49
+ "$PIP_PYTHON" -m pip --version >/dev/null
50
+ }
51
+
52
+ PIP_ARGS=()
53
+ refresh_pip_args() {
54
+ PIP_ARGS=(--no-cache-dir)
55
+ if "$PIP_PYTHON" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
56
+ PIP_ARGS+=(--break-system-packages)
57
+ fi
58
+ if [ -n "${PIP_TARGET:-}" ]; then
59
+ PIP_ARGS+=(--target "$PIP_TARGET")
60
+ fi
61
+ }
62
+
63
+ refresh_pip_args
64
+
27
65
  install_pyproject_dependencies_with_pip() {
66
+ if [ -z "${PIP_TARGET:-}" ]; then
67
+ ensure_project_venv
68
+ fi
69
+ refresh_pip_args
70
+
28
71
  local deps_file
29
72
  deps_file="$(mktemp)"
30
- python - "$deps_file" <<'PY'
73
+ "$PIP_PYTHON" - "$deps_file" <<'PY'
31
74
  import sys
32
75
  import tomllib
33
76
  from pathlib import Path
@@ -48,7 +91,7 @@ PY
48
91
  if [ -s "$deps_file" ]; then
49
92
  echo "[setup] Pip mode: installing dependencies from pyproject.toml"
50
93
  local status=0
51
- python -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
94
+ "$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
52
95
  rm -f "$deps_file"
53
96
  return "$status"
54
97
  else
@@ -73,8 +116,12 @@ if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
73
116
  elif [ -f "pyproject.toml" ]; then
74
117
  install_pyproject_dependencies_with_pip
75
118
  elif [ -f "requirements.txt" ]; then
119
+ if [ -z "${PIP_TARGET:-}" ]; then
120
+ ensure_project_venv
121
+ fi
122
+ refresh_pip_args
76
123
  echo "[setup] Fallback mode (pip): installing from requirements.txt"
77
- python -m pip install "${PIP_ARGS[@]}" -r requirements.txt
124
+ "$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r requirements.txt
78
125
  else
79
126
  echo "[setup] no pyproject.toml or requirements.txt found, skipping install"
80
127
  fi
@@ -27,6 +27,9 @@ 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
30
33
  if [ -x "$PROJECT_DIR/.venv/bin/python" ]; then
31
34
  PYTHON_BIN="$PROJECT_DIR/.venv/bin/python"
32
35
  fi
@@ -16,18 +16,61 @@ EOF
16
16
 
17
17
  ensure_pip_config
18
18
 
19
- PIP_ARGS=(--no-cache-dir)
20
- if python -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
21
- PIP_ARGS+=(--break-system-packages)
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
- if [ -n "${PIP_TARGET:-}" ]; then
24
- PIP_ARGS+=(--target "$PIP_TARGET")
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" ] \
34
+ && "$venv_dir/bin/python" -m pip --version >/dev/null 2>&1 \
35
+ && grep -Eq '^include-system-site-packages[[:space:]]*=[[:space:]]*true$' "$venv_dir/pyvenv.cfg" 2>/dev/null; then
36
+ PIP_PYTHON="$venv_dir/bin/python"
37
+ return
38
+ fi
39
+
40
+ rm -rf "$venv_dir"
41
+ echo "[setup] Creating project virtualenv at $venv_dir"
42
+ if ! "$PYTHON_BIN" -m venv --system-site-packages "$venv_dir" >/dev/null 2>&1; then
43
+ echo "[setup] python -m venv unavailable; installing virtualenv fallback"
44
+ "$PYTHON_BIN" -m pip install "${GLOBAL_PIP_ARGS[@]}" virtualenv
45
+ "$PYTHON_BIN" -m virtualenv --system-site-packages "$venv_dir"
46
+ fi
47
+
48
+ PIP_PYTHON="$venv_dir/bin/python"
49
+ "$PIP_PYTHON" -m pip --version >/dev/null
50
+ }
51
+
52
+ PIP_ARGS=()
53
+ refresh_pip_args() {
54
+ PIP_ARGS=(--no-cache-dir)
55
+ if "$PIP_PYTHON" -m pip install --help 2>/dev/null | grep -q -- "--break-system-packages"; then
56
+ PIP_ARGS+=(--break-system-packages)
57
+ fi
58
+ if [ -n "${PIP_TARGET:-}" ]; then
59
+ PIP_ARGS+=(--target "$PIP_TARGET")
60
+ fi
61
+ }
62
+
63
+ refresh_pip_args
64
+
27
65
  install_pyproject_dependencies_with_pip() {
66
+ if [ -z "${PIP_TARGET:-}" ]; then
67
+ ensure_project_venv
68
+ fi
69
+ refresh_pip_args
70
+
28
71
  local deps_file
29
72
  deps_file="$(mktemp)"
30
- python - "$deps_file" <<'PY'
73
+ "$PIP_PYTHON" - "$deps_file" <<'PY'
31
74
  import sys
32
75
  import tomllib
33
76
  from pathlib import Path
@@ -48,7 +91,7 @@ PY
48
91
  if [ -s "$deps_file" ]; then
49
92
  echo "[setup] Pip mode: installing dependencies from pyproject.toml"
50
93
  local status=0
51
- python -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
94
+ "$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r "$deps_file" || status=$?
52
95
  rm -f "$deps_file"
53
96
  return "$status"
54
97
  else
@@ -73,8 +116,12 @@ if command -v uv >/dev/null 2>&1 && [ -f "pyproject.toml" ]; then
73
116
  elif [ -f "pyproject.toml" ]; then
74
117
  install_pyproject_dependencies_with_pip
75
118
  elif [ -f "requirements.txt" ]; then
119
+ if [ -z "${PIP_TARGET:-}" ]; then
120
+ ensure_project_venv
121
+ fi
122
+ refresh_pip_args
76
123
  echo "[setup] Fallback mode (pip): installing from requirements.txt"
77
- python -m pip install "${PIP_ARGS[@]}" -r requirements.txt
124
+ "$PIP_PYTHON" -m pip install "${PIP_ARGS[@]}" -r requirements.txt
78
125
  else
79
126
  echo "[setup] no pyproject.toml or requirements.txt found, skipping install"
80
127
  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.55";
2112
+ var version = "0.0.57";
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmlckj/licos-ai-cli",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "description": "LICOS AI coding workspace CLI - project template engine and dev tools",
5
5
  "license": "MIT",
6
6
  "author": "kmlckj",