@isvbytes.com/cli 1.0.0 → 1.1.0
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/dist/index.js +8 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -97,29 +97,23 @@ function parseJwtExpiry(token) {
|
|
|
97
97
|
|
|
98
98
|
// src/index.ts
|
|
99
99
|
var program = new Command();
|
|
100
|
-
program.name("
|
|
101
|
-
program.command("generate").description("\u751F\u6210\u6307\u5B9A\u7528\u6237\u7684 authToken").requiredOption("-e, --env <env>", `\u76EE\u6807\u73AF\u5883 (${SUPPORTED_ENVS.join("/")})`, "prod").requiredOption("-c, --code <code>", "\u7528\u6237 IT code (\u5982 zhangys36)").option("-o, --org-id <orgId>", "\u7EC4\u7EC7 ID", "88").option("--json", "\
|
|
100
|
+
program.name("isvbytes").description("\u751F\u6210 xCloud authToken\uFF0C\u4F9B AI agent \u548C CLI \u5DE5\u5177\u4F7F\u7528").version("1.0.0");
|
|
101
|
+
program.command("generate").description("\u751F\u6210\u6307\u5B9A\u7528\u6237\u7684 authToken").requiredOption("-e, --env <env>", `\u76EE\u6807\u73AF\u5883 (${SUPPORTED_ENVS.join("/")})`, "prod").requiredOption("-c, --code <code>", "\u7528\u6237 IT code (\u5982 zhangys36)").option("-o, --org-id <orgId>", "\u7EC4\u7EC7 ID", "88").option("--json", "\u8F93\u51FA\u5B8C\u6574 JSON\uFF08\u542B env\u3001expiresAt \u7B49\uFF09", false).option("-v, --verbose", "\u663E\u793A\u8BE6\u7EC6\u4FE1\u606F\uFF08\u73AF\u5883\u3001\u7528\u6237\u3001\u8FC7\u671F\u65F6\u95F4\uFF09", false).action(async (opts) => {
|
|
102
102
|
const result = await generateToken({
|
|
103
103
|
env: opts.env,
|
|
104
104
|
code: opts.code,
|
|
105
105
|
orgId: Number(opts.orgId)
|
|
106
106
|
});
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
process.stdout.write(result.authToken);
|
|
110
|
-
} else {
|
|
111
|
-
process.stderr.write(`Error: ${result.error}
|
|
107
|
+
if (!result.success) {
|
|
108
|
+
process.stderr.write(`Error: ${result.error}
|
|
112
109
|
`);
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
return;
|
|
110
|
+
process.exit(1);
|
|
116
111
|
}
|
|
117
112
|
if (opts.json) {
|
|
118
113
|
console.log(JSON.stringify(result, null, 2));
|
|
119
|
-
if (!result.success) process.exit(1);
|
|
120
114
|
return;
|
|
121
115
|
}
|
|
122
|
-
if (
|
|
116
|
+
if (opts.verbose) {
|
|
123
117
|
console.log(`\u2705 authToken \u751F\u6210\u6210\u529F`);
|
|
124
118
|
console.log(` \u73AF\u5883: ${result.env}`);
|
|
125
119
|
console.log(` \u7528\u6237: ${result.code}`);
|
|
@@ -128,10 +122,9 @@ program.command("generate").description("\u751F\u6210\u6307\u5B9A\u7528\u6237\u7
|
|
|
128
122
|
}
|
|
129
123
|
console.log(`
|
|
130
124
|
${result.authToken}`);
|
|
131
|
-
|
|
132
|
-
console.error(`\u274C \u751F\u6210\u5931\u8D25: ${result.error}`);
|
|
133
|
-
process.exit(1);
|
|
125
|
+
return;
|
|
134
126
|
}
|
|
127
|
+
process.stdout.write(result.authToken);
|
|
135
128
|
});
|
|
136
129
|
program.command("envs").description("\u5217\u51FA\u6240\u6709\u652F\u6301\u7684\u73AF\u5883").action(() => {
|
|
137
130
|
console.log("\u652F\u6301\u7684\u73AF\u5883:\n");
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isvbytes.com/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI tool to generate xCloud authToken for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"isvbytes": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|