@lisa.ai/agent 1.1.10 → 1.1.12

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.
@@ -46,10 +46,9 @@ async function coverageCommand(command, modelProvider, attempt = 1, maxRetries =
46
46
  let executionPassed = true;
47
47
  const runSilentlyAndIntercept = (cmd, printProgress = false) => {
48
48
  return new Promise((resolve, reject) => {
49
- const parts = cmd.split(' ');
50
- const childTarget = process.platform === 'win32' ? `${parts[0]}.cmd` : parts[0];
51
- const childArgs = parts.slice(1);
52
- const child = (0, child_process_1.spawn)(parts[0], childArgs, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
49
+ // Node 21+ Deprecation Fix: When shell is true, pass the entire raw command string
50
+ // rather than explicitly escaping array arguments to bypass DEP0190.
51
+ const child = (0, child_process_1.spawn)(cmd, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
53
52
  child.stdout?.on('data', (data) => {
54
53
  const text = data.toString();
55
54
  if (printProgress) {
@@ -44,30 +44,59 @@ const telemetry_service_1 = require("../services/telemetry.service");
44
44
  function isolateTestCommand(globalCommand, targetFile) {
45
45
  const cmd = globalCommand.toLowerCase();
46
46
  const parsed = path.parse(targetFile);
47
- // Karma requires generic glob matching, it frequently fails on direct absolute OS paths from node
47
+ // 1. Explicit Frameworks
48
48
  if (cmd.includes('ng test') || cmd.includes('karma')) {
49
49
  return `${globalCommand} --include **/${parsed.base}`;
50
50
  }
51
- // Jest/Vitest/Playwright
52
51
  if (cmd.includes('jest') || cmd.includes('vitest') || cmd.includes('playwright')) {
53
52
  return `${globalCommand} ${targetFile}`;
54
53
  }
55
- // Cypress
56
54
  if (cmd.includes('cypress')) {
57
55
  return `${globalCommand} --spec ${targetFile}`;
58
56
  }
57
+ // 2. Generic Package Manager Scripts (npm run test, yarn test)
58
+ if (cmd.includes('npm') || cmd.includes('yarn') || cmd.includes('pnpm')) {
59
+ try {
60
+ const packageJsonPath = path.resolve(process.cwd(), 'package.json');
61
+ if (fs.existsSync(packageJsonPath)) {
62
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
63
+ let scriptName = 'test';
64
+ if (cmd.includes('npm run ')) {
65
+ scriptName = cmd.split('npm run ')[1].split(' ')[0];
66
+ }
67
+ else if (cmd.includes('yarn ')) {
68
+ scriptName = cmd.split('yarn ')[1].split(' ')[0];
69
+ }
70
+ else if (cmd.includes('pnpm ')) {
71
+ scriptName = cmd.split('pnpm ')[1].split(' ')[0];
72
+ }
73
+ const testScript = pkg.scripts?.[scriptName]?.toLowerCase() || '';
74
+ const dashDash = cmd.includes('npm') ? ' --' : '';
75
+ // Deducing underlying framework from package manager translation
76
+ if (testScript.includes('ng test') || testScript.includes('karma')) {
77
+ return `${globalCommand}${dashDash} --include **/${parsed.base}`;
78
+ }
79
+ if (testScript.includes('jest') || testScript.includes('vitest') || testScript.includes('playwright')) {
80
+ return `${globalCommand}${dashDash} ${targetFile}`;
81
+ }
82
+ }
83
+ }
84
+ catch (e) {
85
+ // Silently fallback if package.json is inaccessible
86
+ }
87
+ // 3. Ultimate Fallback: Assume it behaves like standard generic node environments
88
+ const dashDash = cmd.includes('npm') ? ' --' : '';
89
+ return `${globalCommand}${dashDash} ${targetFile}`;
90
+ }
59
91
  return globalCommand;
60
92
  }
61
93
  async function healCommand(command, modelProvider, attempt = 1, healedFilePath = null, maxRetries = 3, projectId = 'local', lastFixDetails, apiKey, skipLedger = [], consecutiveFails = 0, failTracker = {}) {
62
94
  console.log(`\n[Lisa.ai Executing] ${command} (Global Engine) Using Model: ${modelProvider}`);
63
95
  const runSilentlyAndIntercept = (cmd, printProgress = false) => {
64
96
  return new Promise((resolve, reject) => {
65
- // Split command correctly for cross-platform spawn
66
- const parts = cmd.split(' ');
67
- const childTarget = process.platform === 'win32' ? `${parts[0]}.cmd` : parts[0];
68
- const childArgs = parts.slice(1);
69
- // If the command doesn't have .cmd but we are on Windows and it fails, wrap it in a shell
70
- const child = (0, child_process_1.spawn)(parts[0], childArgs, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
97
+ // Node 21+ Deprecation Fix: When shell is true, pass the entire raw command string
98
+ // rather than explicitly escaping array arguments to bypass DEP0190.
99
+ const child = (0, child_process_1.spawn)(cmd, { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
71
100
  let stdoutData = '';
72
101
  let stderrData = '';
73
102
  child.stdout?.on('data', (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lisa.ai/agent",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "Lisa.ai Autonomous CI/CD Worker Agent",
5
5
  "main": "dist/index.js",
6
6
  "bin": {