dorky 2.3.6 → 2.3.7
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 +319 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,89 +14,353 @@
|
|
|
14
14
|
|
|
15
15
|
 `&& ` 
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Overview
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Manage sensitive project files like environment variables, configuration files, and API keys without committing them to public version control. **dorky** securely stores your sensitive files on AWS S3 or Google Drive, making them accessible to authorized team members.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Installation
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g dorky
|
|
25
|
+
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
Or use with npx:
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npx dorky --help
|
|
31
|
+
```
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
## Prerequisites
|
|
34
|
+
|
|
35
|
+
### AWS S3
|
|
36
|
+
|
|
37
|
+
1. Create an S3 bucket in your AWS account
|
|
38
|
+
2. Generate AWS credentials (Access Key ID and Secret Access Key)
|
|
39
|
+
3. Set up environment variables:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
export AWS_ACCESS_KEY="your-access-key"
|
|
43
|
+
export AWS_SECRET_KEY="your-secret-key"
|
|
44
|
+
export AWS_REGION="us-east-1"
|
|
45
|
+
export BUCKET_NAME="your-bucket-name"
|
|
46
|
+
```
|
|
30
47
|
|
|
31
|
-
|
|
48
|
+
### Google Drive
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
1. Create a Google Cloud Project
|
|
51
|
+
2. Enable Google Drive API
|
|
52
|
+
3. Download OAuth 2.0 credentials
|
|
53
|
+
4. Save credentials as `google-drive-credentials.json` in your project root
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
2. List the files using `dorky --list`.
|
|
37
|
-
> This command will not list the files that are excluded in `.dorkyignore`.
|
|
55
|
+
## Quick Start
|
|
38
56
|
|
|
39
|
-
|
|
57
|
+
### AWS S3 Setup
|
|
40
58
|
|
|
41
|
-
|
|
42
|
-
2. List the files using `dorky --list`, (make sure to add excluded file or folder patterns to .dorkyignore, to minimize the list).
|
|
43
|
-
3. Add files to stage-1 using `dorky --add file-name`.
|
|
44
|
-
4. Push files to S3 bucket using `dorky --push`.
|
|
59
|
+

|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
```bash
|
|
62
|
+
# Navigate to your project
|
|
63
|
+
cd your-project
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
# Initialize dorky with AWS
|
|
66
|
+
dorky --init aws
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
# List files that can be added
|
|
69
|
+
dorky --list
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
# Add sensitive files
|
|
72
|
+
dorky --add .env config.yml
|
|
54
73
|
|
|
55
|
-
|
|
74
|
+
# Push to S3
|
|
75
|
+
dorky --push
|
|
76
|
+
```
|
|
56
77
|
|
|
57
|
-
###
|
|
78
|
+
### Google Drive Setup
|
|
58
79
|
|
|
59
80
|

|
|
60
81
|
|
|
61
|
-
|
|
82
|
+
```bash
|
|
83
|
+
# Navigate to your project
|
|
84
|
+
cd your-project
|
|
85
|
+
|
|
86
|
+
# Initialize dorky with Google Drive
|
|
87
|
+
dorky --init google-drive
|
|
88
|
+
|
|
89
|
+
# Authenticate (browser window will open)
|
|
90
|
+
# Follow the OAuth flow
|
|
91
|
+
|
|
92
|
+
# List files that can be added
|
|
93
|
+
dorky --list
|
|
94
|
+
|
|
95
|
+
# Add sensitive files
|
|
96
|
+
dorky --add .env secrets.json
|
|
97
|
+
|
|
98
|
+
# Push to Google Drive
|
|
99
|
+
dorky --push
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### Initialize a Project
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# For AWS S3
|
|
108
|
+
dorky --init aws
|
|
109
|
+
|
|
110
|
+
# For Google Drive
|
|
111
|
+
dorky --init google-drive
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This creates:
|
|
115
|
+
|
|
116
|
+
- `.dorky/` folder with metadata and credentials
|
|
117
|
+
- `.dorkyignore` file for exclusion patterns
|
|
118
|
+
- Updates `.gitignore` to protect credentials
|
|
119
|
+
|
|
120
|
+
### List Files
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# List local files (shows what can be added)
|
|
124
|
+
dorky --list
|
|
125
|
+
|
|
126
|
+
# List remote files (shows what's in storage)
|
|
127
|
+
dorky --list remote
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Add Files to Stage
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Add single file
|
|
134
|
+
dorky --add .env
|
|
135
|
+
|
|
136
|
+
# Add multiple files
|
|
137
|
+
dorky --add .env config.yml secrets.json
|
|
138
|
+
|
|
139
|
+
# Add files with specific patterns
|
|
140
|
+
dorky --add .env.production .env.staging
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Remove Files from Stage
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Remove single file
|
|
147
|
+
dorky --rm .env
|
|
148
|
+
|
|
149
|
+
# Remove multiple files
|
|
150
|
+
dorky --rm .env config.yml
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Push Files to Storage
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Push all staged files
|
|
157
|
+
dorky --push
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This command:
|
|
161
|
+
|
|
162
|
+
- Uploads new files
|
|
163
|
+
- Updates modified files (based on hash comparison)
|
|
164
|
+
- Skips unchanged files
|
|
165
|
+
|
|
166
|
+
### Pull Files from Storage
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Pull all tracked files
|
|
170
|
+
dorky --pull
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This command:
|
|
174
|
+
|
|
175
|
+
- Downloads all tracked files from storage
|
|
176
|
+
- Creates necessary directories
|
|
177
|
+
- Overwrites local files
|
|
178
|
+
|
|
179
|
+
## Configuration
|
|
180
|
+
|
|
181
|
+
### .dorkyignore
|
|
182
|
+
|
|
183
|
+
Exclude files and directories from dorky scanning:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
node_modules/
|
|
187
|
+
.git/
|
|
188
|
+
dist/
|
|
189
|
+
build/
|
|
190
|
+
*.log
|
|
191
|
+
coverage/
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Directory Structure
|
|
195
|
+
|
|
196
|
+
After initialization:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
your-project/
|
|
200
|
+
├── .dorky/
|
|
201
|
+
│ ├── credentials.json # Storage credentials (auto-ignored by git)
|
|
202
|
+
│ └── metadata.json # Tracked files metadata
|
|
203
|
+
├── .dorkyignore # Exclusion patterns
|
|
204
|
+
└── .gitignore # Updated automatically
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Common Workflows
|
|
208
|
+
|
|
209
|
+
### Workflow 1: Initial Setup for Team
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Team lead initializes and pushes files
|
|
213
|
+
dorky --init aws
|
|
214
|
+
dorky --add .env config/secrets.yml
|
|
215
|
+
dorky --push
|
|
216
|
+
|
|
217
|
+
# Team members pull files
|
|
218
|
+
git clone <repository>
|
|
219
|
+
cd <repository>
|
|
220
|
+
# Set up AWS credentials in environment
|
|
221
|
+
dorky --pull
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Workflow 2: Update Sensitive Configuration
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Modify your .env file locally
|
|
228
|
+
vim .env
|
|
229
|
+
|
|
230
|
+
# Add updated file
|
|
231
|
+
dorky --add .env
|
|
232
|
+
|
|
233
|
+
# Push changes
|
|
234
|
+
dorky --push
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Workflow 3: Clean Up Tracked Files
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Remove from staging
|
|
241
|
+
dorky --rm old-config.yml
|
|
242
|
+
|
|
243
|
+
# Push to remove from remote
|
|
244
|
+
dorky --push
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Examples
|
|
248
|
+
|
|
249
|
+
### Example 1: Managing Environment Files
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Initialize with AWS
|
|
253
|
+
dorky --init aws
|
|
254
|
+
|
|
255
|
+
# Add environment files for different stages
|
|
256
|
+
dorky --add .env.development .env.staging .env.production
|
|
257
|
+
|
|
258
|
+
# Check what will be uploaded
|
|
259
|
+
dorky --list
|
|
260
|
+
|
|
261
|
+
# Upload to S3
|
|
262
|
+
dorky --push
|
|
263
|
+
|
|
264
|
+
# View remote files
|
|
265
|
+
dorky --list remote
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Example 2: Managing API Keys
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Initialize with Google Drive
|
|
272
|
+
dorky --init google-drive
|
|
273
|
+
|
|
274
|
+
# Add API key files
|
|
275
|
+
dorky --add config/api-keys.json secrets/tokens.yml
|
|
276
|
+
|
|
277
|
+
# Push to Google Drive
|
|
278
|
+
dorky --push
|
|
279
|
+
|
|
280
|
+
# On another machine, pull the files
|
|
281
|
+
dorky --pull
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Features
|
|
285
|
+
|
|
286
|
+
- ✅ AWS S3 storage integration
|
|
287
|
+
- ✅ Google Drive storage integration
|
|
288
|
+
- ✅ List remote files in dorky bucket
|
|
289
|
+
- ✅ Auto detect .env and .config files
|
|
290
|
+
- ✅ Automatic .gitignore updates to ignore credentials
|
|
291
|
+
- ✅ Handle reauthentication for Google Drive
|
|
292
|
+
- ✅ Token refresh for Google Drive authentication
|
|
293
|
+
- ✅ Ignore dorky files in dorky itself
|
|
294
|
+
- ✅ File hash validation to skip unchanged files
|
|
295
|
+
- ✅ Mime-type detection for file uploads
|
|
296
|
+
- ✅ Recursive folder creation on pull
|
|
297
|
+
|
|
298
|
+
## How It Works
|
|
299
|
+
|
|
300
|
+
1. **Initialization**: Creates `.dorky/` folder with metadata and credentials
|
|
301
|
+
2. **File Tracking**: Maintains a hash-based registry of files in `metadata.json`
|
|
302
|
+
3. **Smart Uploads**: Only uploads files that have changed (based on MD5 hash)
|
|
303
|
+
4. **Auto-detection**: Highlights `.env` and `.config` files during listing
|
|
304
|
+
5. **Security**: Automatically updates `.gitignore` to protect credentials
|
|
305
|
+
|
|
306
|
+
## Security Best Practices
|
|
307
|
+
|
|
308
|
+
- ✅ Never commit `.dorky/credentials.json` to version control
|
|
309
|
+
- ✅ Use environment variables for AWS credentials
|
|
310
|
+
- ✅ Rotate access keys regularly
|
|
311
|
+
- ✅ Use IAM roles with minimal required permissions
|
|
312
|
+
- ✅ Review `.dorkyignore` before adding files
|
|
313
|
+
- ✅ Keep `google-drive-credentials.json` secure
|
|
314
|
+
|
|
315
|
+
## Troubleshooting
|
|
316
|
+
|
|
317
|
+
### AWS S3 Issues
|
|
318
|
+
|
|
319
|
+
**Error: Missing credentials**
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Set environment variables
|
|
323
|
+
export AWS_ACCESS_KEY="your-key"
|
|
324
|
+
export AWS_SECRET_KEY="your-secret"
|
|
325
|
+
export AWS_REGION="us-east-1"
|
|
326
|
+
export BUCKET_NAME="your-bucket"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Google Drive Issues
|
|
330
|
+
|
|
331
|
+
**Error: Invalid credentials**
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Re-authenticate
|
|
335
|
+
dorky --init google-drive
|
|
336
|
+
```
|
|
62
337
|
|
|
63
|
-
|
|
338
|
+
**Error: Token expired**
|
|
64
339
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
> This command will not list the files that are excluded in `.dorkyignore`.
|
|
340
|
+
- dorky automatically refreshes tokens
|
|
341
|
+
- If issues persist, delete `.dorky/credentials.json` and re-authenticate
|
|
68
342
|
|
|
69
|
-
|
|
343
|
+
## Contributing
|
|
70
344
|
|
|
71
|
-
|
|
72
|
-
2. List the files using `dorky --list`, (make sure to add excluded file or folder patterns to .dorkyignore, to minimize the list).
|
|
73
|
-
3. Add files to stage-1 using `dorky --add file-name`.
|
|
74
|
-
4. Push files to Google Drive using `dorky --push`.
|
|
345
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
75
346
|
|
|
76
|
-
|
|
347
|
+
## License
|
|
77
348
|
|
|
78
|
-
|
|
79
|
-
2. Push files to Google Drive using `dorky --push`. [Removes file from Google Drive <remote>]
|
|
349
|
+
ISC License - see [LICENSE](LICENSE) file for details.
|
|
80
350
|
|
|
81
|
-
|
|
351
|
+
## Support
|
|
82
352
|
|
|
83
|
-
|
|
353
|
+
- 📦 [npm package](https://npmjs.com/package/dorky)
|
|
354
|
+
- 🐛 [Report issues](https://github.com/trishantpahwa/dorky/issues)
|
|
355
|
+
- 🌐 [Website](https://dorky.trishantpahwa.me/)
|
|
84
356
|
|
|
85
|
-
##
|
|
357
|
+
## Roadmap
|
|
86
358
|
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[ ]
|
|
94
|
-
[ ] Update README. (Bug fix release)
|
|
95
|
-
[ ] Fix issue when the file is added again with the same contents, it still adds it, not checks it with the hash.
|
|
96
|
-
[ ] Handle invalid access token for google-drive.
|
|
97
|
-
[ ] Extension for VS Code to list and highlight them like git. (Major release)
|
|
98
|
-
[ ] Unintialize dorky setup. (Bug fix release)
|
|
99
|
-
[ ] MCP server. (Minor release)
|
|
100
|
-
[ ] Encryption of files. (Minor release)
|
|
101
|
-
[ ] Add stages for variables. (Major release)
|
|
359
|
+
- [ ] Handle invalid access token for Google Drive (edge cases)
|
|
360
|
+
- [ ] Extension for VS Code to list and highlight them like git (Major release)
|
|
361
|
+
- [ ] Uninitialize dorky setup (Bug fix release)
|
|
362
|
+
- [ ] MCP server (Minor release)
|
|
363
|
+
- [ ] Encryption of files (Minor release)
|
|
364
|
+
- [ ] Add stages for variables (Major release)
|
|
365
|
+
- [ ] Migrate dorky project to another storage (partially implemented)
|
|
102
366
|
|