@iservu-inc/adf-cli 0.4.29 → 0.4.31

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 CHANGED
@@ -5,6 +5,58 @@ 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.31] - 2025-10-04
9
+
10
+ ### 🐛 Fix: OpenAI o-series Model Support (o3, o3-mini, o3-pro)
11
+
12
+ **Fixed: o3 Models Failing with Parameter Error**
13
+ - **Problem:** o3 models failed with `Unsupported parameter: 'max_tokens' is not supported with this model`
14
+ - **Root Cause:** Only checking for `o1` models, not all o-series models (o1, o3, etc.)
15
+ - **Solution:** Updated regex to detect ANY o-series model (`/^o\d/`)
16
+
17
+ **Code Change (ai-client.js:118):**
18
+ ```javascript
19
+ // ❌ BEFORE - Only o1 models
20
+ const isO1Model = this.model.startsWith('o1');
21
+
22
+ // ✅ AFTER - All o-series models (o1, o3, o5, etc.)
23
+ const isOSeriesModel = /^o\d/.test(this.model);
24
+ ```
25
+
26
+ **Impact:**
27
+ - ✅ o1, o1-mini, o1-preview now work
28
+ - ✅ o3, o3-mini, o3-pro now work
29
+ - ✅ Future o-series models automatically supported
30
+ - Uses `max_completion_tokens` parameter (as required by OpenAI API)
31
+ - Removes `temperature` parameter (not supported by o-series)
32
+
33
+ ---
34
+
35
+ ## [0.4.30] - 2025-10-04
36
+
37
+ ### 🔒 Security: Auto .gitignore Protection
38
+
39
+ **Added: Automatic .gitignore Management**
40
+ - **Feature:** Automatically create/update `.gitignore` to protect `.adf/.env` file
41
+ - **Purpose:** Prevent accidentally committing API keys to version control
42
+ - **Implementation:**
43
+ - New `ensureGitignore()` function in `ai-config.js`
44
+ - Called automatically after saving API keys
45
+ - Creates `.gitignore` if it doesn't exist
46
+ - Adds `.adf/.env` entry with warning comment
47
+ - Skips if entry already exists (non-destructive)
48
+
49
+ **Code Changes:**
50
+ - `lib/ai/ai-config.js:106-136` - New `ensureGitignore()` function
51
+ - `lib/ai/ai-config.js:158-160` - Auto-call after saving API keys
52
+
53
+ **User Benefit:**
54
+ - No more risk of committing API keys
55
+ - Automatic protection without manual setup
56
+ - Works with existing `.gitignore` files safely
57
+
58
+ ---
59
+
8
60
  ## [0.4.29] - 2025-10-04
9
61
 
10
62
  ### 🐛 CRITICAL FIX: OpenAI Model Fetching
@@ -113,8 +113,9 @@ class AIClient {
113
113
  * OpenAI GPT request
114
114
  */
115
115
  async openaiRequest(prompt, maxTokens, temperature) {
116
- // o1 models use max_completion_tokens instead of max_tokens
117
- const isO1Model = this.model.startsWith('o1');
116
+ // o-series models (o1, o3, etc.) use max_completion_tokens instead of max_tokens
117
+ // Check for any model starting with 'o' followed by a digit
118
+ const isOSeriesModel = /^o\d/.test(this.model);
118
119
 
119
120
  const requestParams = {
120
121
  model: this.model,
@@ -126,10 +127,10 @@ class AIClient {
126
127
  ]
127
128
  };
128
129
 
129
- // o1 models use different parameter names
130
- if (isO1Model) {
130
+ // o-series models use different parameter names
131
+ if (isOSeriesModel) {
131
132
  requestParams.max_completion_tokens = maxTokens;
132
- // o1 models don't support temperature parameter
133
+ // o-series models don't support temperature parameter
133
134
  } else {
134
135
  requestParams.max_tokens = maxTokens;
135
136
  requestParams.temperature = temperature;
@@ -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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iservu-inc/adf-cli",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "description": "CLI tool for AgentDevFramework - AI-assisted development framework with multi-provider AI support",
5
5
  "main": "index.js",
6
6
  "bin": {