jarvis-agent-factory 2.1.2 → 2.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/install.js +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jarvis-agent-factory",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Jarvis Agent Factory CLI — 跨平台多智能体 AI 编程助手配置安装器 | Multi-agent AI coding assistant config installer for Claude Code / OpenCode / Codex",
5
5
  "keywords": [
6
6
  "jarvis",
package/src/install.js CHANGED
@@ -1,8 +1,13 @@
1
+ import { fileURLToPath } from 'node:url';
1
2
  import { resolve, join, dirname } from 'node:path';
2
- import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync, readFileSync, writeFileSync, appendFileSync } from 'node:fs';
3
+ import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync, readFileSync, appendFileSync } from 'node:fs';
3
4
  import { homedir } from 'node:os';
4
5
  import { createInterface } from 'node:readline';
5
6
 
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ const TEMPLATES_DIR = resolve(__dirname, 'templates');
10
+
6
11
  const INSTALL_BUCKETS = ['agents', 'commands', 'skills'];
7
12
  const SKIP_FILES = new Set(['settings.json', 'settings.local.json', 'node_modules', '.git']);
8
13
 
@@ -71,7 +76,7 @@ function installMcp(platform, target, force) {
71
76
  const t = MCP_TEMPLATES[platform];
72
77
  if (!t) return;
73
78
 
74
- const src = resolve(dirname(fileURLToPath(import.meta.url)), 'templates', t.tmpl);
79
+ const src = resolve(TEMPLATES_DIR, t.tmpl);
75
80
  if (!existsSync(src)) return;
76
81
 
77
82
  const dest = target ? resolve(target, t.file) : mcpGlobalDest(platform);
@@ -108,8 +113,6 @@ function installMcp(platform, target, force) {
108
113
  }
109
114
  }
110
115
 
111
- function fileURLToPath(url) { return url.replace('file:///', '').replace(/^\/(\w:)/, '$1/'); }
112
-
113
116
  function mergeDir(src, dest) {
114
117
  let files = 0, dirs = 0;
115
118
  if (!existsSync(dest)) mkdirSync(dest, { recursive: true });