@iservu-inc/adf-cli 0.4.29 → 0.4.30
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 +25 -0
- package/lib/ai/ai-config.js +36 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ All notable changes to `@iservu-inc/adf-cli` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.30] - 2025-10-04
|
|
9
|
+
|
|
10
|
+
### 🔒 Security: Auto .gitignore Protection
|
|
11
|
+
|
|
12
|
+
**Added: Automatic .gitignore Management**
|
|
13
|
+
- **Feature:** Automatically create/update `.gitignore` to protect `.adf/.env` file
|
|
14
|
+
- **Purpose:** Prevent accidentally committing API keys to version control
|
|
15
|
+
- **Implementation:**
|
|
16
|
+
- New `ensureGitignore()` function in `ai-config.js`
|
|
17
|
+
- Called automatically after saving API keys
|
|
18
|
+
- Creates `.gitignore` if it doesn't exist
|
|
19
|
+
- Adds `.adf/.env` entry with warning comment
|
|
20
|
+
- Skips if entry already exists (non-destructive)
|
|
21
|
+
|
|
22
|
+
**Code Changes:**
|
|
23
|
+
- `lib/ai/ai-config.js:106-136` - New `ensureGitignore()` function
|
|
24
|
+
- `lib/ai/ai-config.js:158-160` - Auto-call after saving API keys
|
|
25
|
+
|
|
26
|
+
**User Benefit:**
|
|
27
|
+
- No more risk of committing API keys
|
|
28
|
+
- Automatic protection without manual setup
|
|
29
|
+
- Works with existing `.gitignore` files safely
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
8
33
|
## [0.4.29] - 2025-10-04
|
|
9
34
|
|
|
10
35
|
### 🐛 CRITICAL FIX: OpenAI Model Fetching
|
package/lib/ai/ai-config.js
CHANGED
|
@@ -103,6 +103,38 @@ async function loadEnvFile(envPath) {
|
|
|
103
103
|
return {};
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Ensure .gitignore includes .adf/.env to protect API keys
|
|
108
|
+
*/
|
|
109
|
+
async function ensureGitignore(projectPath) {
|
|
110
|
+
const gitignorePath = path.join(projectPath, '.gitignore');
|
|
111
|
+
const entryToAdd = '.adf/.env';
|
|
112
|
+
|
|
113
|
+
let content = '';
|
|
114
|
+
let hasEntry = false;
|
|
115
|
+
|
|
116
|
+
// Read existing .gitignore if it exists
|
|
117
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
118
|
+
content = await fs.readFile(gitignorePath, 'utf-8');
|
|
119
|
+
hasEntry = content.split('\n').some(line => line.trim() === entryToAdd);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Add entry if not already present
|
|
123
|
+
if (!hasEntry) {
|
|
124
|
+
const lines = content ? content.split('\n') : [];
|
|
125
|
+
|
|
126
|
+
// Add a section header if .gitignore is empty or doesn't have the entry
|
|
127
|
+
if (lines.length === 0 || (lines[lines.length - 1] && lines[lines.length - 1].trim() !== '')) {
|
|
128
|
+
lines.push(''); // Add blank line if file is not empty
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
lines.push('# adf-cli - AI Provider API Keys (DO NOT COMMIT)');
|
|
132
|
+
lines.push(entryToAdd);
|
|
133
|
+
|
|
134
|
+
await fs.writeFile(gitignorePath, lines.join('\n'), 'utf-8');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
106
138
|
/**
|
|
107
139
|
* Save API key to .env file
|
|
108
140
|
*/
|
|
@@ -122,6 +154,10 @@ async function saveToEnvFile(envPath, key, value) {
|
|
|
122
154
|
|
|
123
155
|
await fs.ensureDir(path.dirname(envPath));
|
|
124
156
|
await fs.writeFile(envPath, lines.join('\n'), 'utf-8');
|
|
157
|
+
|
|
158
|
+
// Ensure .gitignore protects this file
|
|
159
|
+
const projectPath = path.dirname(path.dirname(envPath)); // Go up from .adf/.env to project root
|
|
160
|
+
await ensureGitignore(projectPath);
|
|
125
161
|
}
|
|
126
162
|
|
|
127
163
|
/**
|