git-permachine
Advanced tools
+1
-1
| { | ||
| "name": "git-permachine", | ||
| "version": "0.1.2", | ||
| "version": "0.1.3", | ||
| "description": "Automatically merge machine-specific config files with base configs using git hooks", | ||
@@ -5,0 +5,0 @@ "type": "module", |
+51
-10
@@ -19,4 +19,5 @@ # permachine | ||
| 3. Merges them with base configs (e.g., `config.base.json`) | ||
| 4. Outputs the final config (e.g., `config.json`) - gitignored | ||
| 5. Runs automatically on git operations via hooks | ||
| 4. Outputs the final config (e.g., `config.json`) | ||
| 5. **Manages .gitignore** - Adds output files and removes from git tracking | ||
| 6. Runs automatically on git operations via hooks | ||
@@ -87,2 +88,3 @@ ## Quick Start | ||
| --auto Auto-detect best installation method | ||
| --no-gitignore Don't manage .gitignore or git tracking | ||
| ``` | ||
@@ -95,3 +97,7 @@ | ||
| 4. Performs initial merge | ||
| 5. Updates `.gitignore` with output files | ||
| 5. **Automatically manages .gitignore:** | ||
| - Adds output files (e.g., `config.json`, `.env`) to `.gitignore` | ||
| - Removes already-tracked output files from git index (`git rm --cached`) | ||
| - Creates `.gitignore` if it doesn't exist | ||
| - Appends to existing `.gitignore` without duplicates | ||
@@ -102,4 +108,5 @@ **Example output:** | ||
| ✓ Git hooks installed via core.hooksPath | ||
| ✓ Updated .gitignore with 2 file(s) | ||
| ✓ Merged 2 file(s) | ||
| ✓ Added 2 file(s) to .gitignore | ||
| ✓ Removed 1 file(s) from git tracking | ||
@@ -115,5 +122,15 @@ Git hooks will auto-merge on: | ||
| ```bash | ||
| permachine merge [--silent] | ||
| permachine merge [options] | ||
| Options: | ||
| --silent Suppress all output except errors | ||
| --no-gitignore Don't manage .gitignore or git tracking | ||
| ``` | ||
| **What it does:** | ||
| - Scans for machine-specific files | ||
| - Merges with base configs | ||
| - Writes output files | ||
| - **Automatically updates .gitignore** (unless `--no-gitignore` is used) | ||
| Useful for: | ||
@@ -217,4 +234,26 @@ - Testing merge logic | ||
| ### 4. Git Hooks | ||
| ### 4. Gitignore Management | ||
| **Automatic on `init` and `merge`:** | ||
| - Adds output files to `.gitignore` (e.g., `config.json`, `.env`) | ||
| - Removes already-tracked files from git with `git rm --cached` | ||
| - Creates `.gitignore` if missing | ||
| - Appends to existing `.gitignore` without duplicates | ||
| - Preserves comments and formatting | ||
| - Normalizes paths (Windows `\` → `/`) | ||
| **Edge cases handled:** | ||
| - Files with spaces in names | ||
| - Nested directories (`config/app.json`) | ||
| - Mixed tracking states (some tracked, some not) | ||
| - Idempotent - safe to run multiple times | ||
| **Disable with `--no-gitignore`:** | ||
| ```bash | ||
| permachine init --no-gitignore | ||
| permachine merge --no-gitignore | ||
| ``` | ||
| ### 5. Git Hooks | ||
| Two installation methods: | ||
@@ -235,3 +274,3 @@ | ||
| ### 5. Automation | ||
| ### 6. Automation | ||
@@ -437,6 +476,9 @@ Hooks run on: | ||
| - [x] JSON support | ||
| - [x] ENV support | ||
| - [x] ENV support | ||
| - [x] JSONC support (comments & trailing commas) | ||
| - [x] Git hooks (hooksPath & legacy) | ||
| - [x] Automatic .gitignore management | ||
| - [x] CLI interface | ||
| - [x] Comprehensive tests | ||
| - [x] Comprehensive tests (74 tests) | ||
| - [x] npm package publication | ||
| - [ ] YAML support | ||
@@ -448,3 +490,2 @@ - [ ] TOML support | ||
| - [ ] Dry-run mode | ||
| - [ ] npm package publication | ||
@@ -451,0 +492,0 @@ ## Credits |
Sorry, the diff of this file is too big to display
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
209814
1.96%6573
1.15%488
9.17%13
8.33%9
12.5%