@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.
- package/dist/scripts/cli.js +2 -3
- package/dist/scripts/cli.js.map +1 -1
- package/dist/scripts/generate-doc.js +8 -10
- package/dist/scripts/generate-doc.js.map +1 -1
- package/dist/scripts/generate-pr-checklist.js +1 -2
- package/dist/scripts/generate-pr-checklist.js.map +1 -1
- package/dist/scripts/precommit-check.d.ts.map +1 -1
- package/dist/scripts/precommit-check.js +15 -25
- package/dist/scripts/precommit-check.js.map +1 -1
- package/dist/scripts/utils/file-checker.d.ts.map +1 -1
- package/dist/scripts/utils/file-checker.js +1 -2
- package/dist/scripts/utils/file-checker.js.map +1 -1
- package/dist/scripts/utils/report-generator.d.ts.map +1 -1
- package/dist/scripts/utils/report-generator.js +5 -7
- package/dist/scripts/utils/report-generator.js.map +1 -1
- package/dist/scripts/utils/solution-examples.js +2 -2
- package/package.json +13 -121
- package/scripts/cli.ts +3 -4
- package/scripts/generate-doc.ts +4 -3
- package/scripts/generate-pr-checklist.ts +2 -3
- package/scripts/precommit-check.ts +4 -15
- package/scripts/utils/file-checker.ts +1 -2
- package/scripts/utils/report-generator.ts +5 -7
- package/scripts/utils/solution-examples.ts +2 -2
|
@@ -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 =
|
|
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
|
-
|
|
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
|
-
|
|
360
|
+
spawnSync('open', [filePath], { stdio: 'pipe' });
|
|
363
361
|
} else if (platform === 'linux') {
|
|
364
|
-
|
|
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.
|
|
368
|
-
+ fetch('https://api.
|
|
367
|
+
- fetch('http://api.placeholder.test/data');
|
|
368
|
+
+ fetch('https://api.placeholder.test/data');
|
|
369
369
|
\`\`\`
|
|
370
370
|
`,
|
|
371
371
|
|