@choiceopen/automation-plugin-cli 0.2.4 → 0.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/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @choiceopen/automation-plugin-cli
|
|
|
20
20
|
$ atomemo COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ atomemo (--version)
|
|
23
|
-
@choiceopen/automation-plugin-cli/0.2.
|
|
23
|
+
@choiceopen/automation-plugin-cli/0.2.5 darwin-arm64 node-v24.13.0
|
|
24
24
|
$ atomemo --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ atomemo COMMAND
|
|
@@ -63,7 +63,7 @@ EXAMPLES
|
|
|
63
63
|
$ atomemo auth login
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
_See code: [src/commands/auth/login.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
66
|
+
_See code: [src/commands/auth/login.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/auth/login.ts)_
|
|
67
67
|
|
|
68
68
|
## `atomemo auth status`
|
|
69
69
|
|
|
@@ -85,7 +85,7 @@ EXAMPLES
|
|
|
85
85
|
$ atomemo auth status
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
_See code: [src/commands/auth/status.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
88
|
+
_See code: [src/commands/auth/status.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/auth/status.ts)_
|
|
89
89
|
|
|
90
90
|
## `atomemo autocomplete [SHELL]`
|
|
91
91
|
|
|
@@ -160,7 +160,7 @@ EXAMPLES
|
|
|
160
160
|
$ atomemo plugin checksum
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
_See code: [src/commands/plugin/checksum.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
163
|
+
_See code: [src/commands/plugin/checksum.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/checksum.ts)_
|
|
164
164
|
|
|
165
165
|
## `atomemo plugin init`
|
|
166
166
|
|
|
@@ -197,7 +197,7 @@ EXAMPLES
|
|
|
197
197
|
$ atomemo plugin init
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
_See code: [src/commands/plugin/init.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
200
|
+
_See code: [src/commands/plugin/init.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/init.ts)_
|
|
201
201
|
|
|
202
202
|
## `atomemo plugin pack [FILE]`
|
|
203
203
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ atomemo plugin pack
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/plugin/pack.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
224
|
+
_See code: [src/commands/plugin/pack.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/pack.ts)_
|
|
225
225
|
|
|
226
226
|
## `atomemo plugin permission [FILE]`
|
|
227
227
|
|
|
@@ -245,7 +245,7 @@ EXAMPLES
|
|
|
245
245
|
$ atomemo plugin permission
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
_See code: [src/commands/plugin/permission.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
248
|
+
_See code: [src/commands/plugin/permission.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/permission.ts)_
|
|
249
249
|
|
|
250
250
|
## `atomemo plugin refresh-key`
|
|
251
251
|
|
|
@@ -262,7 +262,7 @@ EXAMPLES
|
|
|
262
262
|
$ atomemo plugin refresh-key
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
_See code: [src/commands/plugin/refresh-key.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
265
|
+
_See code: [src/commands/plugin/refresh-key.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/refresh-key.ts)_
|
|
266
266
|
|
|
267
267
|
## `atomemo plugin run [FILE]`
|
|
268
268
|
|
|
@@ -286,7 +286,7 @@ EXAMPLES
|
|
|
286
286
|
$ atomemo plugin run
|
|
287
287
|
```
|
|
288
288
|
|
|
289
|
-
_See code: [src/commands/plugin/run.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.
|
|
289
|
+
_See code: [src/commands/plugin/run.ts](https://github.com/choice-open/automation-plugin-cli/blob/v0.2.5/src/commands/plugin/run.ts)_
|
|
290
290
|
|
|
291
291
|
## `atomemo version`
|
|
292
292
|
|
|
@@ -44,7 +44,16 @@ export default class AuthLogin extends Command {
|
|
|
44
44
|
await open(payload.verification_uri_complete);
|
|
45
45
|
}
|
|
46
46
|
const spinner = yoctoSpinner({ text: "Polling for token..." }).start();
|
|
47
|
-
|
|
47
|
+
let result;
|
|
48
|
+
try {
|
|
49
|
+
result = await this.pollForToken(payload.device_code, spinner);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof ExitError) {
|
|
53
|
+
this.exit(error.code);
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
48
57
|
await configStore.update({ auth: { access_token: result.access_token } });
|
|
49
58
|
const session = await fetch(`${this.endpoint}/v1/auth/get-session`, {
|
|
50
59
|
headers: {
|
|
@@ -71,7 +80,7 @@ export default class AuthLogin extends Command {
|
|
|
71
80
|
return (await response.json());
|
|
72
81
|
}
|
|
73
82
|
async pollForToken(device_code, spinner) {
|
|
74
|
-
return new Promise((resolve) => {
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
75
84
|
const poll = async () => {
|
|
76
85
|
const response = await fetch(`${this.endpoint}/v1/auth/device/token`, {
|
|
77
86
|
method: "POST",
|
|
@@ -97,13 +106,16 @@ export default class AuthLogin extends Command {
|
|
|
97
106
|
break;
|
|
98
107
|
case "access_denied":
|
|
99
108
|
spinner.error("Access was denied by the user");
|
|
100
|
-
|
|
109
|
+
reject(new ExitError(0, "access_denied"));
|
|
110
|
+
break;
|
|
101
111
|
case "expired_token":
|
|
102
112
|
spinner.error("The device code has expired. Please try again.");
|
|
103
|
-
|
|
113
|
+
reject(new ExitError(0, "expired_token"));
|
|
114
|
+
break;
|
|
104
115
|
default:
|
|
105
116
|
spinner.error(`Error: ${payload.error_description}`);
|
|
106
|
-
|
|
117
|
+
reject(new ExitError(1, payload.error_description));
|
|
118
|
+
break;
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
121
|
else {
|
|
@@ -115,3 +127,11 @@ export default class AuthLogin extends Command {
|
|
|
115
127
|
});
|
|
116
128
|
}
|
|
117
129
|
}
|
|
130
|
+
class ExitError extends Error {
|
|
131
|
+
code;
|
|
132
|
+
constructor(code, message) {
|
|
133
|
+
super(message);
|
|
134
|
+
this.code = code;
|
|
135
|
+
this.name = "ExitError";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -35,7 +35,7 @@ export default class AuthStatus extends Command {
|
|
|
35
35
|
catch (error) {
|
|
36
36
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
37
37
|
this.log(colorize("red", `✗ Failed to fetch session: ${message}`));
|
|
38
|
-
|
|
38
|
+
this.exit(1);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
async fetchSession(endpoint, accessToken) {
|
|
@@ -14,7 +14,7 @@ export default class PluginRefreshKey extends Command {
|
|
|
14
14
|
const config = await configStore.load();
|
|
15
15
|
if (!config.auth?.access_token) {
|
|
16
16
|
this.log(colorize("red", "✗ You're not authenticated yet, please run 'atomemo auth login' first."));
|
|
17
|
-
return
|
|
17
|
+
return this.exit(1);
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
20
|
// Step 2: Fetch debug API Key
|
|
@@ -31,7 +31,7 @@ export default class PluginRefreshKey extends Command {
|
|
|
31
31
|
catch (error) {
|
|
32
32
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
33
33
|
this.log(colorize("red", `✗ Failed to refresh debug API Key: ${message}`));
|
|
34
|
-
return
|
|
34
|
+
return this.exit(1);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
async fetchDebugApiKey(accessToken) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choiceopen/automation-plugin-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "A command-line utility for building and publishing Choiceform Atomemo Plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oclif"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"check": "biome check --write",
|
|
31
31
|
"prepack": "oclif manifest && oclif readme",
|
|
32
32
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
33
|
-
"test": "mocha
|
|
33
|
+
"test": "mocha \"test/**/*.test.ts\"",
|
|
34
34
|
"posttest": "npm run check",
|
|
35
35
|
"version": "oclif readme && git add README.md"
|
|
36
36
|
},
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@types/node": "20.19.27",
|
|
77
77
|
"chai": "4.5.0",
|
|
78
78
|
"mocha": "10.8.2",
|
|
79
|
+
"msw": "^2.12.7",
|
|
79
80
|
"oclif": "^4.22.65",
|
|
80
81
|
"shx": "^0.4.0",
|
|
81
82
|
"ts-node": "^10.9.2",
|