cicy-code 0.1.1 → 0.1.2

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/cicy-code.js CHANGED
@@ -7,14 +7,24 @@ const https = require('https');
7
7
  const pkg = require('../package.json');
8
8
  const binPath = path.join(__dirname, 'cicy-code');
9
9
 
10
+ const cn = process.argv.includes('--cn') || process.env.CN_MIRROR === '1';
11
+
10
12
  if (process.argv.includes('--cn')) {
11
13
  process.env.CN_MIRROR = '1';
12
14
  }
13
15
 
16
+ if (cn) {
17
+ console.log(' [mirror] Using Chinese mirrors (npm + GitHub proxy)');
18
+ }
19
+
14
20
  // Check for updates
15
21
  function checkUpdate() {
22
+ const registry = cn
23
+ ? 'https://registry.npmmirror.com/cicy-code/latest'
24
+ : 'https://registry.npmjs.org/cicy-code/latest';
25
+ if (cn) console.log(` [mirror] Registry: registry.npmmirror.com`);
16
26
  return new Promise((resolve) => {
17
- https.get('https://registry.npmjs.org/cicy-code/latest', (res) => {
27
+ https.get(registry, (res) => {
18
28
  let data = '';
19
29
  res.on('data', (c) => data += c);
20
30
  res.on('end', () => {
@@ -42,7 +52,10 @@ async function main() {
42
52
  console.log(`\n Update available: ${pkg.version} → ${latest}`);
43
53
  console.log(` Updating...\n`);
44
54
  try {
45
- execSync(`npm install -g cicy-code@${latest}`, { stdio: 'inherit' });
55
+ const npmCmd = cn
56
+ ? `npm install -g cicy-code@${latest} --registry=https://registry.npmmirror.com`
57
+ : `npm install -g cicy-code@${latest}`;
58
+ execSync(npmCmd, { stdio: 'inherit' });
46
59
  console.log(`\n Updated to ${latest}! Restarting...\n`);
47
60
  // Re-exec with new version
48
61
  const child = spawn('cicy-code', process.argv.slice(2), { stdio: 'inherit', env: process.env });
@@ -59,7 +72,10 @@ async function main() {
59
72
  } catch {
60
73
  console.log(' Installing cicy-code globally...');
61
74
  try {
62
- execSync('npm install -g cicy-code', { stdio: 'inherit' });
75
+ const npmCmd = cn
76
+ ? 'npm install -g cicy-code --registry=https://registry.npmmirror.com'
77
+ : 'npm install -g cicy-code';
78
+ execSync(npmCmd, { stdio: 'inherit' });
63
79
  console.log(' Installed! You can now run: cicy-code\n');
64
80
  } catch {}
65
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-code",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CiCy Code - AI-powered development environment",
5
5
  "bin": {
6
6
  "cicy-code": "bin/cicy-code.js"
@@ -2,7 +2,7 @@ const https = require('https');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
5
- const VERSION = '0.1.1';
5
+ const VERSION = '0.1.2';
6
6
  const GH_URL = `https://github.com/cicy-ai/cicy-code/releases/download/v${VERSION}`;
7
7
  const CN_URL = `https://gh-proxy.com/https://github.com/cicy-ai/cicy-code/releases/download/v${VERSION}`;
8
8
 
@@ -28,7 +28,8 @@ const binDir = path.join(__dirname, '..', 'bin');
28
28
  const binPath = path.join(binDir, 'cicy-code');
29
29
  const url = `${BASE_URL}/${binName}`;
30
30
 
31
- console.log(`Downloading ${binName}${cn ? ' (CN mirror)' : ''}...`);
31
+ console.log(`Downloading ${binName}${cn ? ' (CN mirror: gh-proxy.com)' : ''}...`);
32
+ console.log(` URL: ${url}`);
32
33
 
33
34
  function download(url, dest, redirects = 5) {
34
35
  return new Promise((resolve, reject) => {