puter-cli 1.4.4 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -4,109 +4,122 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [v1.4.4](https://github.com/bitsnaps/puter-cli/compare/v1.4.3...v1.4.4)
7
+ #### [v1.5.1](https://github.com/HeyPuter/puter-cli/compare/v1.5.0...v1.5.1)
8
8
 
9
- - simplify failed login [`bbf8a42`](https://github.com/bitsnaps/puter-cli/commit/bbf8a429c1d2a64fbb03fb42f461bcc1a32c8379)
9
+ - imporve listing uid [`e2573f8`](https://github.com/HeyPuter/puter-cli/commit/e2573f83df6b47d8ab32ffc66ab19a9c984dd250)
10
10
 
11
- #### [v1.4.3](https://github.com/bitsnaps/puter-cli/compare/v1.4.2...v1.4.3)
11
+ #### [v1.5.0](https://github.com/HeyPuter/puter-cli/compare/v1.4.4...v1.5.0)
12
+
13
+ > 5 February 2025
14
+
15
+ - fix: improve version check [`f3ea79e`](https://github.com/HeyPuter/puter-cli/commit/f3ea79e3156632f892558489dfd34b1119948a48)
16
+ - update README [`79b381c`](https://github.com/HeyPuter/puter-cli/commit/79b381c57935cae5ffb9edf5ad11aca395ae8f8d)
17
+
18
+ #### [v1.4.4](https://github.com/HeyPuter/puter-cli/compare/v1.4.3...v1.4.4)
19
+
20
+ > 4 February 2025
21
+
22
+ - simplify failed login [`bbf8a42`](https://github.com/HeyPuter/puter-cli/commit/bbf8a429c1d2a64fbb03fb42f461bcc1a32c8379)
23
+
24
+ #### [v1.4.3](https://github.com/HeyPuter/puter-cli/compare/v1.4.2...v1.4.3)
12
25
 
13
26
  > 2 February 2025
14
27
 
15
- - fix: show disk usage [`dfd0ca3`](https://github.com/bitsnaps/puter-cli/commit/dfd0ca302f459b7295593c8d0147df15e488c963)
28
+ - fix: show disk usage [`dfd0ca3`](https://github.com/HeyPuter/puter-cli/commit/dfd0ca302f459b7295593c8d0147df15e488c963)
16
29
 
17
- #### [v1.4.2](https://github.com/bitsnaps/puter-cli/compare/v1.4.1...v1.4.2)
30
+ #### [v1.4.2](https://github.com/HeyPuter/puter-cli/compare/v1.4.1...v1.4.2)
18
31
 
19
32
  > 30 January 2025
20
33
 
21
- - license to MIT [`ed0c7ce`](https://github.com/bitsnaps/puter-cli/commit/ed0c7cefba242a5d8fe701cddf5adbe32121bca7)
22
- - codecov: setup & badge [`7c4211b`](https://github.com/bitsnaps/puter-cli/commit/7c4211b6ea7b882485e3dfbaa17887a2d1fabccc)
23
- - changelog: update license [`dcf8d23`](https://github.com/bitsnaps/puter-cli/commit/dcf8d232160cf74d13267baa07a8f36578df9443)
34
+ - license to MIT [`ed0c7ce`](https://github.com/HeyPuter/puter-cli/commit/ed0c7cefba242a5d8fe701cddf5adbe32121bca7)
35
+ - codecov: setup & badge [`7c4211b`](https://github.com/HeyPuter/puter-cli/commit/7c4211b6ea7b882485e3dfbaa17887a2d1fabccc)
36
+ - changelog: update license [`dcf8d23`](https://github.com/HeyPuter/puter-cli/commit/dcf8d232160cf74d13267baa07a8f36578df9443)
24
37
 
25
- #### [v1.4.1](https://github.com/bitsnaps/puter-cli/compare/v1.4.0...v1.4.1)
38
+ #### [v1.4.1](https://github.com/HeyPuter/puter-cli/compare/v1.4.0...v1.4.1)
26
39
 
27
40
  > 27 January 2025
28
41
 
29
- - feat: init command will scaffold new project [`c61d3f8`](https://github.com/bitsnaps/puter-cli/commit/c61d3f8669d66eb1a869db38b877d226d00b8aca)
30
- - changelog: update [`c09aa17`](https://github.com/bitsnaps/puter-cli/commit/c09aa179bd0ad2f437bdf779916050c2496424cd)
42
+ - feat: init command will scaffold new project [`c61d3f8`](https://github.com/HeyPuter/puter-cli/commit/c61d3f8669d66eb1a869db38b877d226d00b8aca)
43
+ - changelog: update [`c09aa17`](https://github.com/HeyPuter/puter-cli/commit/c09aa179bd0ad2f437bdf779916050c2496424cd)
31
44
 
32
- #### [v1.4.0](https://github.com/bitsnaps/puter-cli/compare/v1.3.0...v1.4.0)
45
+ #### [v1.4.0](https://github.com/HeyPuter/puter-cli/compare/v1.3.0...v1.4.0)
33
46
 
34
47
  > 26 January 2025
35
48
 
36
- - offline mode to get version [`d3c1dc2`](https://github.com/bitsnaps/puter-cli/commit/d3c1dc275bf8a1f38f083c8cdb066fb884a08138)
37
- - changelog: update [`f0cc1e3`](https://github.com/bitsnaps/puter-cli/commit/f0cc1e36b2b246d65a88f32c626942c0e15ac245)
49
+ - offline mode to get version [`d3c1dc2`](https://github.com/HeyPuter/puter-cli/commit/d3c1dc275bf8a1f38f083c8cdb066fb884a08138)
50
+ - changelog: update [`f0cc1e3`](https://github.com/HeyPuter/puter-cli/commit/f0cc1e36b2b246d65a88f32c626942c0e15ac245)
38
51
 
39
- #### [v1.3.0](https://github.com/bitsnaps/puter-cli/compare/v1.2.1...v1.3.0)
52
+ #### [v1.3.0](https://github.com/HeyPuter/puter-cli/compare/v1.2.1...v1.3.0)
40
53
 
41
54
  > 22 January 2025
42
55
 
43
- - ci: simplify workflow [`757b41c`](https://github.com/bitsnaps/puter-cli/commit/757b41caa62dc71946e7f1ffb34a32f2871248e0)
44
- - test: setup coverage [`2dd6500`](https://github.com/bitsnaps/puter-cli/commit/2dd650088ad9ecb6f7f9cd60b3dab80d48ac2611)
45
- - ci: update packages [`b346932`](https://github.com/bitsnaps/puter-cli/commit/b346932c4b6af2d8e43279ad3f35c45e451fd9f0)
56
+ - ci: simplify workflow [`757b41c`](https://github.com/HeyPuter/puter-cli/commit/757b41caa62dc71946e7f1ffb34a32f2871248e0)
57
+ - test: setup coverage [`2dd6500`](https://github.com/HeyPuter/puter-cli/commit/2dd650088ad9ecb6f7f9cd60b3dab80d48ac2611)
58
+ - ci: update packages [`b346932`](https://github.com/HeyPuter/puter-cli/commit/b346932c4b6af2d8e43279ad3f35c45e451fd9f0)
46
59
 
47
- #### [v1.2.1](https://github.com/bitsnaps/puter-cli/compare/v1.2.0...v1.2.1)
60
+ #### [v1.2.1](https://github.com/HeyPuter/puter-cli/compare/v1.2.0...v1.2.1)
48
61
 
49
62
  > 18 January 2025
50
63
 
51
- - feat: update changelog [`028ca0c`](https://github.com/bitsnaps/puter-cli/commit/028ca0cf72e09bb63468d2b0a0ba7602d3b870ad)
52
- - feat: auto-update changelog [`3004bed`](https://github.com/bitsnaps/puter-cli/commit/3004beda6afcf68cc916d544a45be85fa7e658e3)
64
+ - feat: update changelog [`028ca0c`](https://github.com/HeyPuter/puter-cli/commit/028ca0cf72e09bb63468d2b0a0ba7602d3b870ad)
65
+ - feat: auto-update changelog [`3004bed`](https://github.com/HeyPuter/puter-cli/commit/3004beda6afcf68cc916d544a45be85fa7e658e3)
53
66
 
54
- #### [v1.2.0](https://github.com/bitsnaps/puter-cli/compare/v1.1.5...v1.2.0)
67
+ #### [v1.2.0](https://github.com/HeyPuter/puter-cli/compare/v1.1.5...v1.2.0)
55
68
 
56
69
  > 18 January 2025
57
70
 
58
- - ci: attempt to fix npm install [`32fc508`](https://github.com/bitsnaps/puter-cli/commit/32fc508c4807119de485926674274b70e034288f)
59
- - feat: basic history command [`18da28c`](https://github.com/bitsnaps/puter-cli/commit/18da28c83aa0760128d7b18e66e6b4d2b08b48d3)
60
- - chore: improve structure [`70b67ad`](https://github.com/bitsnaps/puter-cli/commit/70b67adad5bd5e0bad4a9276160d17538d9b4bb6)
71
+ - ci: attempt to fix npm install [`32fc508`](https://github.com/HeyPuter/puter-cli/commit/32fc508c4807119de485926674274b70e034288f)
72
+ - feat: basic history command [`18da28c`](https://github.com/HeyPuter/puter-cli/commit/18da28c83aa0760128d7b18e66e6b4d2b08b48d3)
73
+ - chore: improve structure [`70b67ad`](https://github.com/HeyPuter/puter-cli/commit/70b67adad5bd5e0bad4a9276160d17538d9b4bb6)
61
74
 
62
- #### [v1.1.5](https://github.com/bitsnaps/puter-cli/compare/v1.1.4...v1.1.5)
75
+ #### [v1.1.5](https://github.com/HeyPuter/puter-cli/compare/v1.1.4...v1.1.5)
63
76
 
64
77
  > 16 January 2025
65
78
 
66
- - fix: description arg handling & improve args parsing [`45c5a8c`](https://github.com/bitsnaps/puter-cli/commit/45c5a8c19034379e3cd7f30e724b8675d98bf28f)
79
+ - fix: description arg handling & improve args parsing [`45c5a8c`](https://github.com/HeyPuter/puter-cli/commit/45c5a8c19034379e3cd7f30e724b8675d98bf28f)
67
80
 
68
- #### [v1.1.4](https://github.com/bitsnaps/puter-cli/compare/v1.1.3...v1.1.4)
81
+ #### [v1.1.4](https://github.com/HeyPuter/puter-cli/compare/v1.1.3...v1.1.4)
69
82
 
70
83
  > 16 January 2025
71
84
 
72
- - improve compatibility crypto api [`b015e6f`](https://github.com/bitsnaps/puter-cli/commit/b015e6f1318a2c4994675dd7390fab09d45bf3e9)
73
- - fix: temporary disabled description [`c7456be`](https://github.com/bitsnaps/puter-cli/commit/c7456bed1c496f1a52156801aa4c0ea0191279c7)
85
+ - improve compatibility crypto api [`b015e6f`](https://github.com/HeyPuter/puter-cli/commit/b015e6f1318a2c4994675dd7390fab09d45bf3e9)
86
+ - fix: temporary disabled description [`c7456be`](https://github.com/HeyPuter/puter-cli/commit/c7456bed1c496f1a52156801aa4c0ea0191279c7)
74
87
 
75
- #### [v1.1.3](https://github.com/bitsnaps/puter-cli/compare/v1.1.2...v1.1.3)
88
+ #### [v1.1.3](https://github.com/HeyPuter/puter-cli/compare/v1.1.2...v1.1.3)
76
89
 
77
90
  > 14 January 2025
78
91
 
79
- - fix: unavailable subdomain when update app [`2497de4`](https://github.com/bitsnaps/puter-cli/commit/2497de41b5691df4d3a141952841c08cace4703c)
92
+ - fix: unavailable subdomain when update app [`2497de4`](https://github.com/HeyPuter/puter-cli/commit/2497de41b5691df4d3a141952841c08cace4703c)
80
93
 
81
- #### [v1.1.2](https://github.com/bitsnaps/puter-cli/compare/v1.1.1...v1.1.2)
94
+ #### [v1.1.2](https://github.com/HeyPuter/puter-cli/compare/v1.1.1...v1.1.2)
82
95
 
83
96
  > 14 January 2025
84
97
 
85
- - grab latest version from npm [`9c32190`](https://github.com/bitsnaps/puter-cli/commit/9c321906415dfb5baa3d2bbba7b352f2766f8b84)
98
+ - grab latest version from npm [`9c32190`](https://github.com/HeyPuter/puter-cli/commit/9c321906415dfb5baa3d2bbba7b352f2766f8b84)
86
99
 
87
- #### [v1.1.1](https://github.com/bitsnaps/puter-cli/compare/v1.1.0...v1.1.1)
100
+ #### [v1.1.1](https://github.com/HeyPuter/puter-cli/compare/v1.1.0...v1.1.1)
88
101
 
89
102
  > 14 January 2025
90
103
 
91
- - Create npm-publish action [`48d9a70`](https://github.com/bitsnaps/puter-cli/commit/48d9a709417664900681e2219ea2af5e9bf33c01)
92
- - update README: badges [`49241d7`](https://github.com/bitsnaps/puter-cli/commit/49241d7144c8c128955891a64acb448e79e1822c)
104
+ - Create npm-publish action [`48d9a70`](https://github.com/HeyPuter/puter-cli/commit/48d9a709417664900681e2219ea2af5e9bf33c01)
105
+ - update README: badges [`49241d7`](https://github.com/HeyPuter/puter-cli/commit/49241d7144c8c128955891a64acb448e79e1822c)
93
106
 
94
- #### [v1.1.0](https://github.com/bitsnaps/puter-cli/compare/v1.0.3...v1.1.0)
107
+ #### [v1.1.0](https://github.com/HeyPuter/puter-cli/compare/v1.0.3...v1.1.0)
95
108
 
96
109
  > 14 January 2025
97
110
 
98
- - feat: add support for 2FA logins [`#1`](https://github.com/bitsnaps/puter-cli/pull/1)
111
+ - feat: add support for 2FA logins [`#1`](https://github.com/HeyPuter/puter-cli/pull/1)
99
112
 
100
- #### [v1.0.3](https://github.com/bitsnaps/puter-cli/compare/v1.0.1...v1.0.3)
113
+ #### [v1.0.3](https://github.com/HeyPuter/puter-cli/compare/v1.0.1...v1.0.3)
101
114
 
102
115
  > 13 January 2025
103
116
 
104
- - update README [`479b8fc`](https://github.com/bitsnaps/puter-cli/commit/479b8fc9c784061146f453bc68759dbdb417ea1e)
117
+ - update README [`479b8fc`](https://github.com/HeyPuter/puter-cli/commit/479b8fc9c784061146f453bc68759dbdb417ea1e)
105
118
 
106
119
  #### v1.0.1
107
120
 
108
121
  > 13 January 2025
109
122
 
110
- - initial commit [`604d4a4`](https://github.com/bitsnaps/puter-cli/commit/604d4a47c8b593b7e24757c115df728f09233664)
111
- - output nicely formatted table [`a0adb75`](https://github.com/bitsnaps/puter-cli/commit/a0adb75813bcecb21878c8ae7228b0ecbfdb397f)
112
- - remove unused packages [`925b6cb`](https://github.com/bitsnaps/puter-cli/commit/925b6cbf827e619e65eb5afaa566a4d14e919cb8)
123
+ - initial commit [`604d4a4`](https://github.com/HeyPuter/puter-cli/commit/604d4a47c8b593b7e24757c115df728f09233664)
124
+ - output nicely formatted table [`a0adb75`](https://github.com/HeyPuter/puter-cli/commit/a0adb75813bcecb21878c8ae7228b0ecbfdb397f)
125
+ - remove unused packages [`925b6cb`](https://github.com/HeyPuter/puter-cli/commit/925b6cbf827e619e65eb5afaa566a4d14e919cb8)
package/README.md CHANGED
@@ -315,7 +315,7 @@ This project is not equivalent [phoenix](https://github.com/HeyPuter/puter/blob/
315
315
 
316
316
  ## Configuration
317
317
 
318
- The CLI uses a configuration file to store user credentials and settings. By default, this file is located at `~/.config/puter-cli/config.json`. You can manually edit this file or use the `puter logout` to empty the file settings.
318
+ The CLI uses a configuration file to store user credentials and settings. You can use the `puter logout` to clear the configuration settings.
319
319
 
320
320
  ---
321
321
 
package/bin/index.js CHANGED
@@ -6,7 +6,7 @@ import { startShell } from '../src/commands/shell.js';
6
6
  import { PROJECT_NAME, getLatestVersion } from '../src/commons.js';
7
7
 
8
8
  async function main() {
9
- const { version } = await getLatestVersion(PROJECT_NAME);
9
+ const version = await getLatestVersion(PROJECT_NAME);
10
10
 
11
11
  const program = new Command();
12
12
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puter-cli",
3
- "version": "1.4.4",
3
+ "version": "1.5.1",
4
4
  "description": "Command line interface for Puter cloud platform",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -56,8 +56,8 @@ export async function listFiles(args = []) {
56
56
  const name = file.name.padEnd(20);
57
57
  const size = file.is_dir ? '0' : formatSize(file.size);
58
58
  const modified = formatDateTime(file.modified);
59
- const uid = file.uid;
60
- console.log(`${type}${write} ${name} ${size.padEnd(8)} ${modified} ${uid}`);
59
+ const uid = file.uid?.split('-');
60
+ console.log(`${type}${write} ${name} ${size.padEnd(8)} ${modified} ${uid[0]}-...-${uid.slice(-1)}`);
61
61
  });
62
62
  console.log(chalk.green(`There are ${files.length} object(s).`));
63
63
  } else {
@@ -35,6 +35,7 @@ export async function listSites(args = {}) {
35
35
  // Format and add data to table
36
36
  let i = 0;
37
37
  data.result.forEach(domain => {
38
+ let appDir = domain?.root_dir?.path.split('/').pop().split('-');
38
39
  table.push([
39
40
  i++,
40
41
  domain.uid,
@@ -42,7 +43,7 @@ export async function listSites(args = {}) {
42
43
  formatDate(domain.created_at).split(',')[0],
43
44
  domain.protected ? chalk.red('Yes') : chalk.green('No'),
44
45
  // domain.owner['username'],
45
- domain?.root_dir?.path.split('/').pop()
46
+ appDir.length == 6?`${appDir[0]}-...-${appDir.slice(-1)}`:appDir.join('-')
46
47
  ]);
47
48
  });
48
49
 
package/src/commons.js CHANGED
@@ -316,15 +316,25 @@ export function getDefaultHomePage(appName, jsFiles = [], cssFiles= []) {
316
316
  export async function getVersionFromPackage() {
317
317
  try {
318
318
  const __filename = fileURLToPath(import.meta.url);
319
- const __dirname = dirname(__filename);
320
- const packageJson = JSON.parse(
321
- await readFile(join(__dirname, 'package.json'), 'utf8')
322
- );
323
- return packageJson.version;
319
+ const __dirname = dirname(__filename);
320
+
321
+ // First try parent directory (dev mode)
322
+ try {
323
+ const devPackage = JSON.parse(
324
+ await readFile(join(__dirname, '..', 'package.json'), 'utf8')
325
+ );
326
+ return devPackage.version;
327
+ } catch (devError) {
328
+ // Fallback to current directory (production)
329
+ const prodPackage = JSON.parse(
330
+ await readFile(join(__dirname, 'package.json'), 'utf8')
331
+ );
332
+ return prodPackage.version;
333
+ }
324
334
  } catch (error) {
325
335
  console.error(`Error fetching latest version:`, error.message);
326
336
  return null;
327
- }
337
+ }
328
338
  }
329
339
 
330
340
  /**
@@ -334,8 +344,13 @@ export async function getLatestVersion(packageName) {
334
344
  try {
335
345
  const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
336
346
  let data = await response.json();
337
- return data;
347
+ const currentVersion = await getVersionFromPackage();
348
+ if (data.version !== currentVersion){
349
+ return `v${currentVersion} (latest: ${data.version})`;
350
+ }
351
+ return `v${currentVersion}`;
338
352
  } catch (error) {
339
- return getVersionFromPackage();
353
+ console.error(`ERROR: ${error.message}`);
354
+ return "<Unknown>";
340
355
  }
341
356
  }