cli4ai 1.1.4 → 1.1.5
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/package.json +1 -1
- package/src/commands/add.ts +1 -5
package/package.json
CHANGED
package/src/commands/add.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* cli4ai add - Install packages
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { existsSync, symlinkSync, mkdirSync, cpSync, rmSync } from 'fs';
|
|
5
|
+
import { existsSync, symlinkSync, mkdirSync, cpSync, rmSync, readdirSync, statSync, unlinkSync, lstatSync } from 'fs';
|
|
6
6
|
import { resolve, dirname, join, basename, normalize } from 'path';
|
|
7
7
|
import { createInterface } from 'readline';
|
|
8
8
|
import { tmpdir } from 'os';
|
|
@@ -107,8 +107,6 @@ async function confirm(message: string): Promise<boolean> {
|
|
|
107
107
|
* Validate extracted tarball paths to prevent path traversal attacks
|
|
108
108
|
*/
|
|
109
109
|
function validateTarballPaths(extractedDir: string): boolean {
|
|
110
|
-
const { readdirSync, statSync } = require('fs');
|
|
111
|
-
|
|
112
110
|
function checkPath(dir: string): boolean {
|
|
113
111
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
114
112
|
for (const entry of entries) {
|
|
@@ -160,7 +158,6 @@ async function downloadFromNpm(packageName: string, targetDir: string): Promise<
|
|
|
160
158
|
}
|
|
161
159
|
|
|
162
160
|
// Find the tarball (it will be named like cli4ai-slack-1.0.2.tgz)
|
|
163
|
-
const { readdirSync } = await import('fs');
|
|
164
161
|
const files = readdirSync(tmpDir);
|
|
165
162
|
const tarball = files.find(f => f.endsWith('.tgz'));
|
|
166
163
|
|
|
@@ -533,7 +530,6 @@ async function installPackage(
|
|
|
533
530
|
// Remove existing if present
|
|
534
531
|
if (existsSync(pkgDir)) {
|
|
535
532
|
try {
|
|
536
|
-
const { unlinkSync, rmSync, lstatSync } = await import('fs');
|
|
537
533
|
const stat = lstatSync(pkgDir);
|
|
538
534
|
if (stat.isSymbolicLink()) {
|
|
539
535
|
unlinkSync(pkgDir);
|