puter-cli 1.0.3 → 1.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.
@@ -0,0 +1,36 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [created]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 20
18
+ - run: npm ci
19
+ - run: npm test
20
+
21
+ publish-gpr:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: read
26
+ packages: write
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-node@v4
30
+ with:
31
+ node-version: 20
32
+ registry-url: https://npm.pkg.github.com/
33
+ - run: npm ci
34
+ - run: npm publish
35
+ env:
36
+ NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Puter-CLI
2
2
 
3
+ <p align="center">
4
+ <img alt="test" src="https://github.com/bitsnaps/puter-cli/actions/workflows/npm-publish-github-packages.yml/badge.svg">
5
+ <img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/bitsnaps/puter-cli">
6
+ </p>
7
+
8
+
3
9
  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
10
 
5
11
 
package/commands/auth.js CHANGED
@@ -40,7 +40,37 @@ export async function login() {
40
40
  })
41
41
  });
42
42
 
43
- const data = await response.json();
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puter-cli",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "Command line interface for Puter cloud platform",
5
5
  "main": "index.js",
6
6
  "bin": {