@pmate/cli 0.24.11 → 0.24.13

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -19930,15 +19930,14 @@ var AccountCommandHandler = class {
19930
19930
  switch (args.action) {
19931
19931
  case "bot-keygen": {
19932
19932
  const keyFile = this.generateBotKeyFile(args.app, args.name);
19933
- if (args.out) {
19934
- const outPath = this.resolveFilePath(args.out);
19935
- (0, import_node_fs20.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
19936
- (0, import_node_fs20.chmodSync)(outPath, 384);
19937
- if (!args.json) {
19938
- ui.success(`Bot key saved to ${outPath}`);
19939
- }
19933
+ const outPath = args.out ? this.resolveFilePath(args.out) : this.resolveDefaultBotKeyPath(args.app, args.name);
19934
+ (0, import_node_fs20.mkdirSync)(import_node_path24.default.dirname(outPath), { recursive: true });
19935
+ (0, import_node_fs20.writeFileSync)(outPath, JSON.stringify(keyFile, null, 2), { mode: 384 });
19936
+ (0, import_node_fs20.chmodSync)(outPath, 384);
19937
+ if (!args.json) {
19938
+ ui.success(`Bot key saved to ${outPath}`);
19940
19939
  }
19941
- if (args.json || !args.out) {
19940
+ if (args.json) {
19942
19941
  ui.plain(JSON.stringify(keyFile, null, 2));
19943
19942
  }
19944
19943
  return;
@@ -20397,6 +20396,12 @@ var AccountCommandHandler = class {
20397
20396
  resolveFilePath(filePath) {
20398
20397
  return import_node_path24.default.resolve(process.cwd(), filePath);
20399
20398
  }
20399
+ resolveDefaultBotKeyPath(app, name) {
20400
+ return import_node_path24.default.join(this.homeDir(), ".pmate", "bots", app, `${name}.bot-key.json`);
20401
+ }
20402
+ homeDir() {
20403
+ return process.env.HOME || process.env.USERPROFILE || process.cwd();
20404
+ }
20400
20405
  generateBotKeyFile(app, name) {
20401
20406
  const { publicKey, privateKey } = (0, import_node_crypto4.generateKeyPairSync)("ed25519");
20402
20407
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.24.11",
3
+ "version": "0.24.13",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -40,7 +40,7 @@
40
40
  "@alicloud/openapi-client": "^0.4.15",
41
41
  "@alicloud/sts20150401": "^1.2.0",
42
42
  "@linear/sdk": "^70.0.0",
43
- "@pmate/chat-sdk": "^0.1.9",
43
+ "@pmate/chat-sdk": "^0.1.10",
44
44
  "@types/ali-oss": "^6.16.13",
45
45
  "ajv": "^8.17.1",
46
46
  "ali-oss": "^6.23.0",