puter-cli 1.0.2 → 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/README.md +12 -0
- package/commands/auth.js +31 -1
- package/package.json +1 -1
- package/screenshot.png +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The **Puter CLI** is a command-line interface tool designed to interact with the **Puter Cloud Platform**. If you don't have an account you can [Signup](https://puter.com/?r=N5Y0ZYTF) from here for free. This cli tool allows users to manage files, directories, applications, and other resources directly from the terminal. This tool is ideal for developers and power users who prefer working with command-line utilities.
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
5
8
|
---
|
|
6
9
|
|
|
7
10
|
## Features
|
|
@@ -72,18 +75,27 @@ It works with wildcards as you would expect in any OS for basic navigation with
|
|
|
72
75
|
```bash
|
|
73
76
|
puter> mkdir <dir>
|
|
74
77
|
```
|
|
78
|
+
|
|
79
|
+
- **Create file**: Create a new file in the current directory.
|
|
80
|
+
```bash
|
|
81
|
+
puter> touch <file>
|
|
82
|
+
```
|
|
83
|
+
|
|
75
84
|
- **Copy Files**: Copy files or directories.
|
|
76
85
|
```bash
|
|
77
86
|
puter> cp <src> <dest>
|
|
78
87
|
```
|
|
88
|
+
|
|
79
89
|
- **Move Files**: Move or rename files or directories.
|
|
80
90
|
```bash
|
|
81
91
|
puter> mv <src> <dest>
|
|
82
92
|
```
|
|
93
|
+
|
|
83
94
|
- **Delete Files/Directories**: Move files or directories to the trash.
|
|
84
95
|
```bash
|
|
85
96
|
puter> rm [-f] <file>
|
|
86
97
|
```
|
|
98
|
+
|
|
87
99
|
- **Empty Trash**: Empty the system's trash.
|
|
88
100
|
```bash
|
|
89
101
|
puter> clean
|
package/commands/auth.js
CHANGED
|
@@ -40,7 +40,37 @@ export async function login() {
|
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
let data = await response.json();
|
|
44
|
+
|
|
45
|
+
while ( data.proceed && data.next_step ) {
|
|
46
|
+
if ( data.next_step === 'otp') {
|
|
47
|
+
spinner.succeed(chalk.green('2FA is enabled'));
|
|
48
|
+
const answers = await inquirer.prompt([
|
|
49
|
+
{
|
|
50
|
+
type: 'input',
|
|
51
|
+
name: 'otp',
|
|
52
|
+
message: 'Authenticator Code:',
|
|
53
|
+
validate: input => input.length === 6 || 'OTP must be 6 digits'
|
|
54
|
+
}
|
|
55
|
+
]);
|
|
56
|
+
spinner = ora('Logging in to Puter...').start();
|
|
57
|
+
const response = await fetch(`${BASE_URL}/login/otp`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: getHeaders(),
|
|
60
|
+
body: JSON.stringify({
|
|
61
|
+
token: data.otp_jwt_token,
|
|
62
|
+
code: answers.otp,
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
data = await response.json();
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if ( data.next_step === 'complete' ) break;
|
|
70
|
+
|
|
71
|
+
spinner.fail(chalk.red(`Unrecognized login step "${data.next_step}"; you might need to update puter-cli.`));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
44
74
|
|
|
45
75
|
if (data.proceed && data.token) {
|
|
46
76
|
config.set('auth_token', data.token);
|
package/package.json
CHANGED
package/screenshot.png
ADDED
|
Binary file
|