@haolin-ai/skillman 1.0.2 → 1.0.4
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/cli.js +2 -1
- package/src/downloader.js +5 -4
- package/src/history.js +11 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import fs from 'fs/promises';
|
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import { select, confirm, input, Separator, checkbox } from '@inquirer/prompts';
|
|
9
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
9
10
|
import { scanSkills } from './scanner.js';
|
|
10
11
|
import { installSkill } from './installer.js';
|
|
11
12
|
import { loadAgents } from './config.js';
|
|
@@ -14,7 +15,7 @@ import { loadHistory, addWorkspace, saveLastUsed } from './history.js';
|
|
|
14
15
|
import { downloadSkill, parseUrl, cleanupDownloads } from './downloader.js';
|
|
15
16
|
|
|
16
17
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
-
const VERSION = '1.0.0';
|
|
18
|
+
const VERSION = pkg.version || '1.0.0';
|
|
18
19
|
|
|
19
20
|
// ANSI colors
|
|
20
21
|
const c = {
|
package/src/downloader.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Supports GitHub shorthand, full URLs, and git URLs
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { execFileSync } from 'child_process';
|
|
7
7
|
import fs from 'fs/promises';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import os from 'os';
|
|
@@ -73,10 +73,11 @@ export async function downloadSkill(inputUrl) {
|
|
|
73
73
|
const downloadDir = path.join(TEMP_DIR, `${repoName}-${timestamp}`);
|
|
74
74
|
|
|
75
75
|
try {
|
|
76
|
-
// Clone repository
|
|
77
|
-
|
|
76
|
+
// Clone repository using execFileSync for better security
|
|
77
|
+
execFileSync('git', ['clone', '--depth', '1', parsed.url, downloadDir], {
|
|
78
78
|
stdio: 'pipe',
|
|
79
|
-
timeout: 60000
|
|
79
|
+
timeout: 60000,
|
|
80
|
+
windowsHide: true // Hide console window on Windows
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
// If subPath specified, return that subdirectory
|
package/src/history.js
CHANGED
|
@@ -7,7 +7,17 @@ import fs from 'fs/promises';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import os from 'os';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// Get config directory based on platform
|
|
11
|
+
function getConfigDir() {
|
|
12
|
+
if (process.platform === 'win32') {
|
|
13
|
+
// Windows: %APPDATA%/skillman
|
|
14
|
+
return path.join(process.env.APPDATA || os.homedir(), 'skillman');
|
|
15
|
+
}
|
|
16
|
+
// macOS/Linux: ~/.config/skillman (XDG)
|
|
17
|
+
return path.join(os.homedir(), '.config', 'skillman');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const HISTORY_FILE = path.join(getConfigDir(), 'history.json');
|
|
11
21
|
const MAX_HISTORY_SIZE = 10;
|
|
12
22
|
|
|
13
23
|
async function ensureDir() {
|