@hatem427/code-guard-ci 3.5.1 → 3.5.3

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.
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as fs from 'fs';
12
12
  import * as path from 'path';
13
- import { execSync } from 'child_process';
13
+ import { execSync, spawnSync } from 'child_process';
14
14
 
15
15
  // ── Types ───────────────────────────────────────────────────────────────────
16
16
 
@@ -71,7 +71,6 @@ export function getCommitMessage(): string {
71
71
  }
72
72
 
73
73
  // Fallback: try getting the last commit message (for post-commit uses)
74
- const { spawnSync } = require('child_process');
75
74
  const r = spawnSync('git', ['log', '-1', '--pretty=%B'], { encoding: 'utf-8' });
76
75
  return r.status === 0 ? (r.stdout as string).trim() : '';
77
76
  } catch {
@@ -12,6 +12,7 @@
12
12
 
13
13
  import * as fs from 'fs';
14
14
  import * as path from 'path';
15
+ import { spawnSync } from 'child_process';
15
16
  import { RuleEngineReport, Violation } from './rule-engine';
16
17
  import { getSolutionExample } from './solution-examples';
17
18
 
@@ -326,7 +327,6 @@ function detectCurrentEditor(): 'cursor' | 'code' | null {
326
327
  */
327
328
  function openInEditor(filePath: string): void {
328
329
  try {
329
- const { execSync } = require('child_process');
330
330
 
331
331
  const currentEditor = detectCurrentEditor();
332
332
 
@@ -342,14 +342,12 @@ function openInEditor(filePath: string): void {
342
342
  { cmd: 'cursor', args: `"${filePath}"` },
343
343
  ];
344
344
 
345
- const { spawnSync: spawnEditor } = require('child_process');
346
345
  for (const editor of editors) {
347
346
  try {
348
- const which = spawnEditor('which', [editor.cmd], { stdio: 'pipe' });
347
+ const which = spawnSync('which', [editor.cmd], { stdio: 'pipe' });
349
348
  if (which.status !== 0) continue;
350
- // Split pre-computed args string into array to avoid shell invocation
351
349
  const editorArgs = editor.args.replace(/"/g, '').trim().split(/\s+/).filter(Boolean);
352
- spawnEditor(editor.cmd, editorArgs, { stdio: 'pipe' });
350
+ spawnSync(editor.cmd, editorArgs, { stdio: 'pipe' });
353
351
  return;
354
352
  } catch {
355
353
  // This editor not available, try next
@@ -359,9 +357,9 @@ function openInEditor(filePath: string): void {
359
357
  // Fallback: try xdg-open on Linux, open on macOS
360
358
  const platform = process.platform;
361
359
  if (platform === 'darwin') {
362
- spawnEditor('open', [filePath], { stdio: 'pipe' });
360
+ spawnSync('open', [filePath], { stdio: 'pipe' });
363
361
  } else if (platform === 'linux') {
364
- spawnEditor('xdg-open', [filePath], { stdio: 'pipe' });
362
+ spawnSync('xdg-open', [filePath], { stdio: 'pipe' });
365
363
  }
366
364
  // On Windows: do nothing extra; user will see the path in console
367
365
  } catch {
@@ -364,8 +364,8 @@ Add real values to \`.env.local\` (gitignored).
364
364
  **Why:** HTTP traffic can be intercepted (man-in-the-middle attacks).
365
365
 
366
366
  \`\`\`diff
367
- - fetch('http://api.example.com/data');
368
- + fetch('https://api.example.com/data');
367
+ - fetch('http://api.placeholder.test/data');
368
+ + fetch('https://api.placeholder.test/data');
369
369
  \`\`\`
370
370
  `,
371
371