@pmate/cli 0.44.7 → 0.44.8
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.
|
@@ -11,8 +11,8 @@ function createAgentRuntime({ platform = process.platform, home = homedir(), exe
|
|
|
11
11
|
execFile(file, args, { cwd, timeout: 600000, maxBuffer: 1024 * 1024, env: { ...environment, PATH: [path.join(home,'.local/bin'),path.join(home,'.bun/bin'),environment.PNPM_HOME,path.join(home,'Library/pnpm'),path.join(home,'.local/share/pnpm'),'/opt/homebrew/bin','/usr/local/bin',environment.PATH].filter(Boolean).join(':'), GIT_TERMINAL_PROMPT: '0' } }, (error, stdout) => error ? reject(new Error(`${path.basename(file)} 执行失败,请检查本地安装和仓库访问权限`)) : resolve(stdout.trim()))
|
|
12
12
|
}))
|
|
13
13
|
const installed = async () => {
|
|
14
|
-
if(existsSync(path.join(root,'packages/
|
|
15
|
-
try{await run('
|
|
14
|
+
if(existsSync(path.join(root,'packages/merry-runtime/src/runtime-cli.ts'))){try{await run('bun',['packages/merry-runtime/src/runtime-cli.ts','--help'],root);await run('bun',['packages/merry-runtime/src/plugin.ts','--help'],root);return true}catch{return false}}
|
|
15
|
+
try{await run('merry-runtime',['--help']);await run('merry-plugin',['--help']);return true}catch{return false}
|
|
16
16
|
}
|
|
17
17
|
const check = async () => {
|
|
18
18
|
const checks = [{ id:'macos', name:'macOS', ready:platform==='darwin', required:true }]
|
|
@@ -35,12 +35,15 @@ function createAgentRuntime({ platform = process.platform, home = homedir(), exe
|
|
|
35
35
|
const missing=environment.checks.filter(c=>!c.ready).map(c=>c.name)
|
|
36
36
|
if(missing.length)throw new Error(`请先安装 ${missing.join('、')},然后重新检测`)
|
|
37
37
|
if(environment.installed&&!existsSync(root)){progress={phase:'ready',message:'已检测到现有 Runtime'};return progress}
|
|
38
|
-
if(existsSync(root)&&!existsSync(path.join(root,'packages/
|
|
38
|
+
if(existsSync(root)&&!existsSync(path.join(root,'packages/merry-runtime/src/runtime-cli.ts')))throw new Error('安装目录不是当前 Runtime 源码,请先保留本地改动并更新仓库后重试;不会覆盖现有文件')
|
|
39
39
|
if(!existsSync(root)){mkdirSync(path.dirname(root),{recursive:true,mode:0o700});progress={phase:'downloading',message:'正在获取 Runtime 源码'};await run('git',['clone','https://github.com/parrot-mate/pmate-agents.git',root])}
|
|
40
40
|
progress={phase:'installing',message:'正在安装依赖'}
|
|
41
41
|
await run('pnpm',['install','--frozen-lockfile','--ignore-scripts'],root)
|
|
42
42
|
progress={phase:'verifying',message:'正在验证 Runtime'}
|
|
43
|
-
await run('bun',['packages/
|
|
43
|
+
await run('bun',['packages/merry-runtime/src/runtime-cli.ts','--help'],root)
|
|
44
|
+
await run('bun',['packages/merry-runtime/src/plugin.ts','--help'],root)
|
|
45
|
+
await run('bun',['packages/merry-runtime/src/setup.ts'],root)
|
|
46
|
+
await run('bun',['packages/merry-runtime/src/plugin.ts','install'],root)
|
|
44
47
|
progress={phase:'ready',message:'Runtime 已安装'}
|
|
45
48
|
return progress
|
|
46
49
|
}catch(error){progress={phase:'error',error:error.message};throw error}finally{installation=undefined}
|