@haolin-ai/skillman 1.0.3 → 1.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haolin-ai/skillman",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A CLI tool to install AI agent skills across multiple platforms",
5
5
  "type": "module",
6
6
  "bin": {
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,17 +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
-
18
- // Read version from package.json
19
- let VERSION = '1.0.0';
20
- try {
21
- const pkgPath = path.join(__dirname, '..', 'package.json');
22
- const pkgContent = await fs.readFile(pkgPath, 'utf8');
23
- const pkg = JSON.parse(pkgContent);
24
- VERSION = pkg.version || '1.0.0';
25
- } catch {
26
- // Fallback to default version
27
- }
18
+ const VERSION = pkg.version || '1.0.0';
28
19
 
29
20
  // ANSI colors
30
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 { execSync } from 'child_process';
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';
@@ -41,8 +41,8 @@ export function parseUrl(url) {
41
41
  };
42
42
  }
43
43
 
44
- // Regular git URLs
45
- if (url.startsWith('https://') || url.startsWith('git@') || url.startsWith('http://')) {
44
+ // Regular git URLs (https, http, git@, ssh://)
45
+ if (url.startsWith('https://') || url.startsWith('git@') || url.startsWith('http://') || url.startsWith('ssh://')) {
46
46
  // Remove .git suffix if present for consistency
47
47
  const cleanUrl = url.replace(/\.git$/, '');
48
48
  return { type: 'git', url: cleanUrl + '.git', subPath: null };
@@ -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
- execSync(`git clone --depth 1 "${parsed.url}" "${downloadDir}"`, {
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
- const HISTORY_FILE = path.join(os.homedir(), '.config', 'skillman', 'history.json');
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() {