igel-qe-core 1.0.9 → 1.0.10

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/dist/cli/index.js CHANGED
@@ -18,8 +18,8 @@ program
18
18
  function getSystemPython() {
19
19
  for (const cmd of ["python3", "python", "py"]) {
20
20
  try {
21
- const res = spawnSync(cmd, ["--version"], { stdio: "ignore" });
22
- if (res.status === 0 || res.status === null) {
21
+ const res = spawnSync(cmd, ["-c", "import sys; print(sys.version)"], { encoding: "utf-8" });
22
+ if (!res.error && res.status === 0 && res.stdout.includes("3.")) {
23
23
  return cmd;
24
24
  }
25
25
  }
@@ -29,12 +29,20 @@ function getSystemPython() {
29
29
  }
30
30
  return "python3";
31
31
  }
32
- function getPythonBin() {
32
+ function getPythonBin(workspaceRoot) {
33
+ const root = workspaceRoot || process.cwd();
33
34
  const isWin = process.platform === "win32";
34
- const venv = isWin
35
+ const localVenv = isWin
36
+ ? join(root, ".venv", "Scripts", "python.exe")
37
+ : join(root, ".venv", "bin", "python");
38
+ if (existsSync(localVenv))
39
+ return localVenv;
40
+ const globalVenv = isWin
35
41
  ? join(PROJECT_ROOT, ".venv", "Scripts", "python.exe")
36
42
  : join(PROJECT_ROOT, ".venv", "bin", "python");
37
- return existsSync(venv) ? venv : getSystemPython();
43
+ if (existsSync(globalVenv))
44
+ return globalVenv;
45
+ return getSystemPython();
38
46
  }
39
47
  function resolveRequirementsPath() {
40
48
  const primary = join(PROJECT_ROOT, "requirements.txt");
@@ -325,7 +333,8 @@ function scaffoldGithubAgents(targetDir) {
325
333
  */
326
334
  function runWorkflow(action, args) {
327
335
  return new Promise((resolve, reject) => {
328
- const py = getPythonBin();
336
+ const workspaceRoot = process.cwd();
337
+ const py = getPythonBin(workspaceRoot);
329
338
  const proc = spawn(py, ["-m", "src.cli.workflow_cli", "--action", action, "--args", JSON.stringify(args)], { cwd: PROJECT_ROOT, env: process.env, stdio: ["ignore", "pipe", "pipe"] });
330
339
  let stdout = "";
331
340
  let stderr = "";
@@ -358,11 +367,11 @@ program
358
367
  const workspaceRoot = process.cwd();
359
368
  console.log(chalk.blue("\nInitializing IGEL QE AI Platform…\n"));
360
369
  // Step 1 — venv + pip
361
- const venvPath = join(PROJECT_ROOT, ".venv");
370
+ const venvPath = join(workspaceRoot, ".venv");
362
371
  if (!existsSync(venvPath)) {
363
- console.log(chalk.yellow("1. Creating virtual environment…"));
372
+ console.log(chalk.yellow("1. Creating virtual environment in workspace…"));
364
373
  try {
365
- execSync(`${getSystemPython()} -m venv .venv`, { cwd: PROJECT_ROOT, stdio: "inherit" });
374
+ execSync(`${getSystemPython()} -m venv .venv`, { cwd: workspaceRoot, stdio: "inherit" });
366
375
  console.log(chalk.green(" ✓ venv created"));
367
376
  }
368
377
  catch (e) {
@@ -379,8 +388,8 @@ program
379
388
  }
380
389
  else {
381
390
  try {
382
- execSync(`${getPythonBin()} -m pip install -q -r \"${reqPath}\"`, {
383
- cwd: PROJECT_ROOT, stdio: "inherit",
391
+ execSync(`${getPythonBin(workspaceRoot)} -m pip install -q -r \"${reqPath}\"`, {
392
+ cwd: workspaceRoot, stdio: "inherit",
384
393
  });
385
394
  console.log(chalk.green(" ✓ Dependencies installed"));
386
395
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igel-qe-core",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "IGEL QE Developer Experience Layer (CLI & MCP)",
5
5
  "type": "module",
6
6
  "publishConfig": {
package/src/cli/index.ts CHANGED
@@ -24,8 +24,8 @@ program
24
24
  function getSystemPython(): string {
25
25
  for (const cmd of ["python3", "python", "py"]) {
26
26
  try {
27
- const res = spawnSync(cmd, ["--version"], { stdio: "ignore" });
28
- if (res.status === 0 || res.status === null) {
27
+ const res = spawnSync(cmd, ["-c", "import sys; print(sys.version)"], { encoding: "utf-8" });
28
+ if (!res.error && res.status === 0 && res.stdout.includes("3.")) {
29
29
  return cmd;
30
30
  }
31
31
  } catch {
@@ -35,12 +35,21 @@ function getSystemPython(): string {
35
35
  return "python3";
36
36
  }
37
37
 
38
- function getPythonBin(): string {
38
+ function getPythonBin(workspaceRoot?: string): string {
39
+ const root = workspaceRoot || process.cwd();
39
40
  const isWin = process.platform === "win32";
40
- const venv = isWin
41
+
42
+ const localVenv = isWin
43
+ ? join(root, ".venv", "Scripts", "python.exe")
44
+ : join(root, ".venv", "bin", "python");
45
+ if (existsSync(localVenv)) return localVenv;
46
+
47
+ const globalVenv = isWin
41
48
  ? join(PROJECT_ROOT, ".venv", "Scripts", "python.exe")
42
49
  : join(PROJECT_ROOT, ".venv", "bin", "python");
43
- return existsSync(venv) ? venv : getSystemPython();
50
+ if (existsSync(globalVenv)) return globalVenv;
51
+
52
+ return getSystemPython();
44
53
  }
45
54
 
46
55
  function resolveRequirementsPath(): string | null {
@@ -351,7 +360,8 @@ function scaffoldGithubAgents(targetDir: string): string[] {
351
360
  */
352
361
  function runWorkflow(action: string, args: Record<string, unknown>): Promise<unknown> {
353
362
  return new Promise((resolve, reject) => {
354
- const py = getPythonBin();
363
+ const workspaceRoot = process.cwd();
364
+ const py = getPythonBin(workspaceRoot);
355
365
  const proc = spawn(
356
366
  py,
357
367
  ["-m", "src.cli.workflow_cli", "--action", action, "--args", JSON.stringify(args)],
@@ -389,11 +399,11 @@ program
389
399
  console.log(chalk.blue("\nInitializing IGEL QE AI Platform…\n"));
390
400
 
391
401
  // Step 1 — venv + pip
392
- const venvPath = join(PROJECT_ROOT, ".venv");
402
+ const venvPath = join(workspaceRoot, ".venv");
393
403
  if (!existsSync(venvPath)) {
394
- console.log(chalk.yellow("1. Creating virtual environment…"));
404
+ console.log(chalk.yellow("1. Creating virtual environment in workspace…"));
395
405
  try {
396
- execSync(`${getSystemPython()} -m venv .venv`, { cwd: PROJECT_ROOT, stdio: "inherit" });
406
+ execSync(`${getSystemPython()} -m venv .venv`, { cwd: workspaceRoot, stdio: "inherit" });
397
407
  console.log(chalk.green(" ✓ venv created"));
398
408
  } catch (e: unknown) {
399
409
  console.log(chalk.yellow(` ⚠ venv setup skipped: ${e instanceof Error ? e.message : String(e)}`));
@@ -408,8 +418,8 @@ program
408
418
  console.log(chalk.yellow(" ⚠ requirements file not found; skipping Python dependency install"));
409
419
  } else {
410
420
  try {
411
- execSync(`${getPythonBin()} -m pip install -q -r \"${reqPath}\"`, {
412
- cwd: PROJECT_ROOT, stdio: "inherit",
421
+ execSync(`${getPythonBin(workspaceRoot)} -m pip install -q -r \"${reqPath}\"`, {
422
+ cwd: workspaceRoot, stdio: "inherit",
413
423
  });
414
424
  console.log(chalk.green(" ✓ Dependencies installed"));
415
425
  } catch (e: unknown) {