You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-154Lines changed: 5 additions & 154 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -276,10 +276,8 @@ No configuration file found
276
276
277
277
#### ✅ Recommended Practices
278
278
279
-
-**Environment templates**: Copy `.env.example` instead of `.env` to avoid secrets
280
279
-**Development configs**: Include development-specific configurations only
281
280
-**Script organization**: Group related scripts in directories for easy copying
282
-
-**Documentation**: Include relevant documentation files (`README.md`, setup guides)
283
281
-**Version control**: Always version control your `.workie.yaml` configuration
284
282
285
283
#### ❌ What to Avoid
@@ -296,42 +294,6 @@ No configuration file found
296
294
-**Environment separation**: Use different configs for different environments
297
295
-**Documentation**: Comment your `.workie.yaml` to explain why files are copied
298
296
299
-
### Real-World Examples
300
-
301
-
#### Full-Stack Web Application
302
-
```yaml
303
-
files_to_copy:
304
-
# Environment setup
305
-
- .env.example
306
-
- .env.development.example
307
-
308
-
# Build and development tools
309
-
- package.json # For npm dependencies reference
310
-
- docker-compose.dev.yml # Development containers
311
-
- scripts/ # Build and utility scripts
312
-
313
-
# Configuration files
314
-
- config/development.json # App configuration
315
-
- .eslintrc.json # Code quality
316
-
- jest.config.js # Testing setup
317
-
```
318
-
319
-
#### Microservices Project
320
-
```yaml
321
-
files_to_copy:
322
-
# Shared configurations
323
-
- .env.example
324
-
- docker-compose.yml
325
-
- scripts/deploy.sh
326
-
327
-
# Service-specific configs
328
-
- config/
329
-
- kubernetes/ # K8s manifests
330
-
- docs/setup.md # Development guide
331
-
```
332
-
333
-
By following these patterns and best practices, you'll ensure that every new worktree is properly configured and ready for development from the moment it's created.
334
-
335
297
## How It Works
336
298
337
299
1.**Repository Detection**: Detects the current git repository using `git rev-parse --show-toplevel`
@@ -357,6 +319,7 @@ Hooks allow you to execute commands at different stages in the lifecycle of a wo
357
319
358
320
-**post_create**: Commands to run after creating a new worktree.
359
321
-**pre_remove**: Commands to run before removing a worktree.
322
+
-**post_cd**: Commands to run after changing to a worktree.
360
323
361
324
### Configuration Example
362
325
@@ -371,142 +334,30 @@ hooks:
371
334
pre_remove:
372
335
- "echo 'Cleaning up...'"
373
336
- "rm -rf /tmp/*"
337
+
post_cd:
338
+
- "echo 'Entering worktree'"
339
+
- "ls -l"
374
340
```
375
341
376
342
### Common Use Cases
377
343
378
344
- **Setting up development environments** with `post_create`, ensuring all dependencies are installed.
379
345
- **Cleanup tasks** using `pre_remove` to tidy up temporary files.
346
+
- **Post-cd actions** with `post_cd` to perform actions after changing to a worktree.
380
347
381
348
### Security Considerations
382
349
383
350
- Avoid destructive commands like `rm -rf /` in hooks.
384
351
- Validate all inputs and paths to prevent injection attacks.
385
352
- Limit the number of hooks and complexity to maintain performance.
0 commit comments