enver-cli 1.0.0 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +19 -7
  2. package/package.json +1 -1
  3. package/bin/index.ts +0 -155
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - **Smart Selection**: Choose between specific versions or instantly grab the latest backup.
14
14
  - **📁 Automated Organization**:
15
15
  - Automatically organizes backups by `project-name` and `version` (from `package.json`).
16
- - **Auto-Prunning**: Keeps only the last 5 backups per version to optimize storage.
16
+ - **Auto-Prunning**: Keeps only the last 5 backups per project version to optimize storage.
17
17
  - **⚙️ Configurable Security**: Enable/disable encryption or set a global default password for seamless automation.
18
18
 
19
19
  ---
@@ -22,13 +22,10 @@
22
22
 
23
23
  ### 1. Installation
24
24
 
25
- Clone the repository and install dependencies:
25
+ Install **Enver** globally via NPM:
26
26
 
27
27
  ```bash
28
- git clone <your-repo-url>
29
- cd Enver
30
- npm install
31
- npm run build
28
+ npm install -g enver-cli
32
29
  ```
33
30
 
34
31
  ### 2. Authentication
@@ -53,6 +50,14 @@ enver config password
53
50
 
54
51
  ## 🚀 Usage
55
52
 
53
+ ### Help & Commands
54
+
55
+ Get a full list of commands and options:
56
+
57
+ ```bash
58
+ enver --help
59
+ ```
60
+
56
61
  ### Backup your Environment
57
62
 
58
63
  Create an encrypted backup of your current `.env` file:
@@ -105,10 +110,17 @@ Google Drive
105
110
 
106
111
  ---
107
112
 
113
+ ## 🔗 Official Repositories
114
+
115
+ - **CLI Tool**: [Enver-CLI](https://github.com/NipunHemal/Enver-CLI)
116
+ - **Background Server**: [Enver-Server](https://github.com/NipunHemal/Enver-Server)
117
+
118
+ ---
119
+
108
120
  ## 🤝 Contributing
109
121
 
110
122
  Contributions are welcome! Please feel free to submit a Pull Request.
111
123
 
112
124
  ## 📄 License
113
125
 
114
- MIT © 2026
126
+ MIT © 2026 Nipuna Theekshana Hemal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enver-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A CLI tool to backup and restore .env files using Google Drive",
5
5
  "main": "dist/bin/index.js",
6
6
  "bin": {
package/bin/index.ts DELETED
@@ -1,155 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import dotenv from 'dotenv';
5
- import inquirer from 'inquirer';
6
- import chalk from 'chalk';
7
- import { getAuthenticatedClient, logout } from '../src/auth';
8
- import { uploadEnv, downloadEnv } from '../src/drive';
9
- import { setPassword, setEncryption, resetConfig } from '../src/config';
10
-
11
- dotenv.config();
12
-
13
- const program = new Command();
14
-
15
- program
16
- .name('enver')
17
- .description('Backup and restore your local .env files with encryption and versioning')
18
- .version('2.2.0', '-v, -V, --version');
19
-
20
- async function runSetup() {
21
- console.log(chalk.blue('\n--- Initial Setup ---'));
22
-
23
- const { encryption } = await inquirer.prompt([{
24
- type: 'confirm',
25
- name: 'encryption',
26
- message: 'Enable encryption globally by default?',
27
- default: false,
28
- }]);
29
-
30
- await setEncryption(encryption);
31
-
32
- const { setPass } = await inquirer.prompt([{
33
- type: 'confirm',
34
- name: 'setPass',
35
- message: 'Set a default encryption password now? (saves you from manual prompts)',
36
- default: false,
37
- }]);
38
-
39
- if (setPass) {
40
- const { password } = await inquirer.prompt([{
41
- type: 'password',
42
- name: 'password',
43
- message: 'Enter your default password:',
44
- mask: '*',
45
- }]);
46
- await setPassword(password);
47
- }
48
-
49
- console.log(chalk.green('\nSetup complete! You can change these anytime using "enver config".\n'));
50
- }
51
-
52
- program
53
- .command('login')
54
- .description('Authenticate with your Google account and run setup')
55
- .action(async () => {
56
- try {
57
- await getAuthenticatedClient();
58
- console.log(chalk.green('Successfully authenticated!'));
59
- await runSetup();
60
- } catch (error: any) {
61
- console.error(chalk.red('Authentication failed:'), error.message);
62
- }
63
- });
64
-
65
- program
66
- .command('logout')
67
- .description('Sign out and remove authentication tokens')
68
- .action(async () => {
69
- await logout();
70
- console.log(chalk.yellow('Successfully logged out. Credentials removed locally.'));
71
- });
72
-
73
- program
74
- .command('push')
75
- .description('Upload local .env (encrypted) to Google Drive')
76
- .option('-f, --file <filename>', 'Local filename to backup (default: .env)')
77
- .action(async (options) => {
78
- await uploadEnv({ file: options.file });
79
- });
80
-
81
- program
82
- .command('pull')
83
- .description('Restore .env from Google Drive with diff preview')
84
- .option('-f, --file <filename>', 'Local filename to restore to (default: .env)')
85
- .option('-n, --name <project>', 'Specific project folder name')
86
- .option('-l, --latest', 'Automatically pick the latest backup')
87
- .action(async (options) => {
88
- await downloadEnv({
89
- file: options.file,
90
- name: options.name,
91
- latest: options.latest
92
- });
93
- });
94
-
95
- const config = program.command('config').description('Manage CLI configuration');
96
-
97
- config
98
- .command('password')
99
- .description('Set, update, or remove the default encryption password')
100
- .action(async () => {
101
- const { action } = await inquirer.prompt([{
102
- type: 'list',
103
- name: 'action',
104
- message: 'What would you like to do?',
105
- choices: ['Set/Update Password', 'Remove Password', 'Cancel'],
106
- }]);
107
-
108
- if (action === 'Set/Update Password') {
109
- const { password } = await inquirer.prompt([{
110
- type: 'password',
111
- name: 'password',
112
- message: 'Enter new default password:',
113
- mask: '*',
114
- }]);
115
- await setPassword(password);
116
- console.log(chalk.green('Default password updated!'));
117
- } else if (action === 'Remove Password') {
118
- await setPassword(undefined);
119
- console.log(chalk.yellow('Default password removed. You will be prompted manually for future operations.'));
120
- }
121
- });
122
-
123
- config
124
- .command('encryption <state>')
125
- .description('Enable or disable encryption globally (on|off)')
126
- .action(async (state) => {
127
- if (state === 'on') {
128
- await setEncryption(true);
129
- console.log(chalk.green('Encryption enabled! Local files will be encrypted before upload.'));
130
- } else if (state === 'off') {
131
- await setEncryption(false);
132
- console.log(chalk.yellow('Encryption disabled! Backups will be stored as plain text.'));
133
- } else {
134
- console.error(chalk.red('Invalid state. Use "on" or "off".'));
135
- }
136
- });
137
-
138
- config
139
- .command('reset')
140
- .description('Reset all global configurations to factory defaults')
141
- .action(async () => {
142
- const { confirm } = await inquirer.prompt([{
143
- type: 'confirm',
144
- name: 'confirm',
145
- message: chalk.red('Are you sure you want to reset all configurations? This cannot be undone.'),
146
- default: false,
147
- }]);
148
-
149
- if (confirm) {
150
- await resetConfig();
151
- console.log(chalk.green('Configuration reset successfully! Settings are back to factory defaults.'));
152
- }
153
- });
154
-
155
- program.parse(process.argv);