openclawmp 0.1.0 → 0.1.1
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/lib/config.js +29 -13
- package/lib/help.js +1 -1
- package/package.json +2 -2
- package/LICENSE +0 -21
package/lib/config.js
CHANGED
|
@@ -13,6 +13,7 @@ const os = require('os');
|
|
|
13
13
|
|
|
14
14
|
const CONFIG_DIR = path.join(os.homedir(), '.openclawmp');
|
|
15
15
|
const AUTH_FILE = path.join(CONFIG_DIR, 'auth.json');
|
|
16
|
+
const CREDENTIALS_FILE = path.join(CONFIG_DIR, 'credentials.json');
|
|
16
17
|
|
|
17
18
|
// Default API base — can be overridden by --api flag or OPENCLAWMP_API env
|
|
18
19
|
let API_BASE = 'https://openclawmp.cc';
|
|
@@ -24,12 +25,11 @@ const DEVICE_JSON = path.join(OPENCLAW_STATE_DIR, 'identity', 'device.json');
|
|
|
24
25
|
|
|
25
26
|
// Valid asset types and their install subdirectories
|
|
26
27
|
const ASSET_TYPES = {
|
|
27
|
-
skill:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
template: 'templates',
|
|
28
|
+
skill: 'skills',
|
|
29
|
+
plugin: 'plugins',
|
|
30
|
+
trigger: 'triggers',
|
|
31
|
+
channel: 'channels',
|
|
32
|
+
experience: 'experiences',
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -65,17 +65,33 @@ function setApiBase(url) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Read auth token
|
|
68
|
+
* Read auth token (priority: env var > auth.json > credentials.json)
|
|
69
69
|
*/
|
|
70
70
|
function getAuthToken() {
|
|
71
|
+
// 1. Environment variable (highest priority)
|
|
72
|
+
if (process.env.OPENCLAWMP_TOKEN) {
|
|
73
|
+
return process.env.OPENCLAWMP_TOKEN;
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
ensureConfigDir();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
|
|
78
|
+
// 2. auth.json (format: { token: "sk-xxx" })
|
|
79
|
+
if (fs.existsSync(AUTH_FILE)) {
|
|
80
|
+
try {
|
|
81
|
+
const data = JSON.parse(fs.readFileSync(AUTH_FILE, 'utf-8'));
|
|
82
|
+
if (data.token) return data.token;
|
|
83
|
+
} catch {}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 3. credentials.json (format: { api_key: "sk-xxx" })
|
|
87
|
+
if (fs.existsSync(CREDENTIALS_FILE)) {
|
|
88
|
+
try {
|
|
89
|
+
const data = JSON.parse(fs.readFileSync(CREDENTIALS_FILE, 'utf-8'));
|
|
90
|
+
if (data.api_key) return data.api_key;
|
|
91
|
+
} catch {}
|
|
78
92
|
}
|
|
93
|
+
|
|
94
|
+
return null;
|
|
79
95
|
}
|
|
80
96
|
|
|
81
97
|
/**
|
package/lib/help.js
CHANGED
|
@@ -30,7 +30,7 @@ function printHelp() {
|
|
|
30
30
|
console.log(' --version, -v Show version');
|
|
31
31
|
console.log(' --help, -h Show help');
|
|
32
32
|
console.log('');
|
|
33
|
-
console.log(` Asset types: ${c('dim', 'skill,
|
|
33
|
+
console.log(` Asset types: ${c('dim', 'skill, plugin, trigger, channel, experience')}`);
|
|
34
34
|
console.log('');
|
|
35
35
|
console.log(' Examples:');
|
|
36
36
|
console.log(' openclawmp install trigger/@xiaoyue/fs-event-trigger');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclawmp",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "\ud83d\udc1f OpenClaw Marketplace CLI \u2014 \u6c34\u4ea7\u5e02\u573a\u547d\u4ee4\u884c\u5de5\u5177",
|
|
5
5
|
"bin": {
|
|
6
6
|
"openclawmp": "./bin/openclawmp.js"
|
|
7
7
|
},
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 OpenClaw
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|