@xcanwin/manyoyo 4.2.6 → 4.2.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.
package/bin/manyoyo.js CHANGED
@@ -642,10 +642,18 @@ function installManyoyo(name) {
642
642
 
643
643
  function updateManyoyo() {
644
644
  let isLocalFileInstall = false;
645
+ let currentVersion = 'unknown';
646
+
645
647
  try {
646
648
  const listOutput = runCmd('npm', ['ls', '-g', '@xcanwin/manyoyo', '--json', '--long'], { stdio: 'pipe' });
647
649
  const listJson = JSON.parse(listOutput || '{}');
648
650
  const dep = listJson && listJson.dependencies && listJson.dependencies['@xcanwin/manyoyo'];
651
+
652
+ // 获取当前版本
653
+ if (dep && dep.version) {
654
+ currentVersion = dep.version;
655
+ }
656
+
649
657
  const resolved = dep && typeof dep.resolved === 'string' ? dep.resolved : '';
650
658
  const depPath = dep && typeof dep.path === 'string' ? dep.path : '';
651
659
 
@@ -664,9 +672,28 @@ function updateManyoyo() {
664
672
  return;
665
673
  }
666
674
 
675
+ console.log(`${CYAN}🔄 当前版本: ${currentVersion}${NC}`);
667
676
  console.log(`${CYAN}🔄 正在更新 ${MANYOYO_NAME} 到最新版本...${NC}`);
668
677
  runCmd('npm', ['update', '-g', '@xcanwin/manyoyo'], { stdio: 'inherit' });
669
- console.log(`${GREEN}✅ 更新完成,请重新执行 ${MANYOYO_NAME} --version 确认版本。${NC}`);
678
+
679
+ // 升级后获取新版本
680
+ let newVersion = 'unknown';
681
+ try {
682
+ const listOutput = runCmd('npm', ['ls', '-g', '@xcanwin/manyoyo', '--json'], { stdio: 'pipe' });
683
+ const listJson = JSON.parse(listOutput || '{}');
684
+ const dep = listJson && listJson.dependencies && listJson.dependencies['@xcanwin/manyoyo'];
685
+ if (dep && dep.version) {
686
+ newVersion = dep.version;
687
+ }
688
+ } catch (e) {
689
+ // ignore
690
+ }
691
+
692
+ if (currentVersion === newVersion) {
693
+ console.log(`${GREEN}✅ 已是最新版本 ${newVersion}${NC}`);
694
+ } else {
695
+ console.log(`${GREEN}✅ 更新完成: ${currentVersion} → ${newVersion}${NC}`);
696
+ }
670
697
  }
671
698
 
672
699
  function getContList() {
@@ -301,10 +301,6 @@ function buildBuildkitRunArgs(ctx, dockerfilePath, fullImageTag, imageBuildArgs)
301
301
  const args = [
302
302
  'run', '--rm', '--privileged',
303
303
  '--network', `host`,
304
- '-e', `HTTP_PROXY=$HTTP_PROXY`,
305
- '-e', `HTTPS_PROXY=$HTTPS_PROXY`,
306
- '-e', `ALL_PROXY=$ALL_PROXY`,
307
- '-e', `NO_PROXY=$NO_PROXY`,
308
304
  '--volume', `${ctx.rootDir}:/workspace`,
309
305
  '--entrypoint', 'buildctl-daemonless.sh',
310
306
  'docker.io/moby/buildkit:latest',
@@ -314,10 +310,10 @@ function buildBuildkitRunArgs(ctx, dockerfilePath, fullImageTag, imageBuildArgs)
314
310
  '--local', 'dockerfile=/workspace',
315
311
  '--opt', `filename=${dockerfileRelativePath}`,
316
312
  '--opt', 'network=host',
317
- '--opt', `build-arg:HTTP_PROXY=$HTTP_PROXY`,
318
- '--opt', `build-arg:HTTPS_PROXY=$HTTPS_PROXY`,
319
- '--opt', `build-arg:ALL_PROXY=$ALL_PROXY`,
320
- '--opt', `build-arg:NO_PROXY=$NO_PROXY`
313
+ '--opt', `build-arg:HTTP_PROXY=${process.env.HTTP_PROXY}`,
314
+ '--opt', `build-arg:HTTPS_PROXY=${process.env.HTTPS_PROXY}`,
315
+ '--opt', `build-arg:ALL_PROXY=${process.env.ALL_PROXY}`,
316
+ '--opt', `build-arg:NO_PROXY=${process.env.NO_PROXY}`
321
317
  ];
322
318
 
323
319
  for (const value of buildArgs) {
@@ -433,6 +429,9 @@ async function buildImage(options = {}) {
433
429
 
434
430
  await prepareBuildCache(ctx, imageTool);
435
431
 
432
+ // 记录构建开始时间
433
+ const buildStartTime = Date.now();
434
+
436
435
  const dockerfilePath = path.join(ctx.rootDir, 'docker', 'manyoyo.Dockerfile');
437
436
  if (!fs.existsSync(dockerfilePath)) {
438
437
  ctx.error(`${RED}错误: 找不到 Dockerfile: ${dockerfilePath}${NC}`);
@@ -452,7 +451,9 @@ async function buildImage(options = {}) {
452
451
  const buildkitRunArgs = buildBuildkitRunArgs(ctx, dockerfilePath, fullImageTag, imageBuildArgs);
453
452
 
454
453
  function logBuildSuccess() {
454
+ const buildDuration = ((Date.now() - buildStartTime) / 1000).toFixed(1);
455
455
  ctx.log(`\n${GREEN}✅ 镜像构建成功: ${fullImageTag}${NC}`);
456
+ ctx.log(`${GREEN}⏱️ 构建耗时: ${buildDuration} 秒${NC}`);
456
457
  ctx.log(`${BLUE}使用镜像:${NC}`);
457
458
  ctx.log(` ${ctx.manyoyoName} -n test --in ${ctx.imageName} --iv ${version}-${imageTool} -y c`);
458
459
  ctx.pruneDanglingImages();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xcanwin/manyoyo",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "imageVersion": "1.8.0-common",
5
5
  "description": "AI Agent CLI Security Sandbox for Docker and Podman",
6
6
  "keywords": [