@mockingbird_konwlage_cli/cli 1.2.3 → 1.2.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/index.js +5 -26
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -5,13 +5,14 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const axios = require('axios');
|
|
7
7
|
const chalk = require('chalk');
|
|
8
|
+
const os = require('os');
|
|
8
9
|
|
|
9
10
|
const program = new Command();
|
|
10
11
|
|
|
11
12
|
program
|
|
12
13
|
.name('mockingbird-cli')
|
|
13
14
|
.description('Installs and manages AI skills for various coding clients')
|
|
14
|
-
.version('1.2.
|
|
15
|
+
.version('1.2.4');
|
|
15
16
|
|
|
16
17
|
program
|
|
17
18
|
.command('add <slug>')
|
|
@@ -29,40 +30,18 @@ program
|
|
|
29
30
|
let apiBaseUrl = process.env.MOCKINGBIRD_API_URL;
|
|
30
31
|
|
|
31
32
|
if (!apiBaseUrl) {
|
|
32
|
-
// Priority 1:
|
|
33
|
-
const rcPath = path.join(
|
|
33
|
+
// Priority 1: ~/.mockingbirdrc (Global config)
|
|
34
|
+
const rcPath = path.join(os.homedir(), '.mockingbirdrc');
|
|
34
35
|
if (fs.existsSync(rcPath)) {
|
|
35
36
|
try {
|
|
36
37
|
const rc = JSON.parse(fs.readFileSync(rcPath, 'utf8'));
|
|
37
38
|
apiBaseUrl = isRemote ? rc.RemoteApiBaseUrl : rc.ApiBaseUrl;
|
|
38
39
|
} catch (e) {
|
|
39
|
-
console.warn(chalk.yellow(`[Warning] Failed to parse
|
|
40
|
+
console.warn(chalk.yellow(`[Warning] Failed to parse ~/.mockingbirdrc: ${e.message}`));
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
if (!apiBaseUrl) {
|
|
45
|
-
// Priority 2: appsettings.Production.json (useful for server environments)
|
|
46
|
-
const prodSettingsPath = path.join(process.cwd(), 'appsettings.Production.json');
|
|
47
|
-
if (fs.existsSync(prodSettingsPath)) {
|
|
48
|
-
try {
|
|
49
|
-
const settings = JSON.parse(fs.readFileSync(prodSettingsPath, 'utf8'));
|
|
50
|
-
apiBaseUrl = settings.ApiBaseUrl;
|
|
51
|
-
} catch (e) { }
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!apiBaseUrl) {
|
|
56
|
-
// Priority 3: appsettings.json
|
|
57
|
-
const appSettingsPath = path.join(process.cwd(), 'appsettings.json');
|
|
58
|
-
if (fs.existsSync(appSettingsPath)) {
|
|
59
|
-
try {
|
|
60
|
-
const settings = JSON.parse(fs.readFileSync(appSettingsPath, 'utf8'));
|
|
61
|
-
apiBaseUrl = settings.ApiBaseUrl;
|
|
62
|
-
} catch (e) { }
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
45
|
// Final fallback to production API
|
|
67
46
|
const API_BASE_URL = apiBaseUrl || 'https://api.aigcclub.com.cn';
|
|
68
47
|
const apiUrl = `${API_BASE_URL}/api/public/skills/raw/${slug}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mockingbird_konwlage_cli/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Mockingbird AI Developer Client CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
"chalk": "^4.1.2",
|
|
20
20
|
"commander": "^14.0.3"
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
}
|