@putao520/aiw 0.5.26 → 0.5.28

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- ![Version](https://img.shields.io/badge/version-0.5.25--developing-blue?style=flat-square)
5
+ ![Version](https://img.shields.io/badge/version-0.5.26-blue?style=flat-square)
6
6
  ![Rust](https://img.shields.io/badge/Rust-1.70+-orange?style=flat-square&logo=rust)
7
7
  ![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)
8
8
  ![MCP](https://img.shields.io/badge/MCP-Supported-purple?style=flat-square)
@@ -26,7 +26,7 @@ AIW is an intelligent platform for managing AI CLI tools (Claude, Codex, Gemini)
26
26
  # Basic usage with provider management
27
27
  aiw claude "explain this code" # Use default provider
28
28
  aiw claude -p openrouter "explain this code" # Use OpenRouter provider
29
- aiw claude -p glm "解释这段代码" # Use custom GLM provider
29
+ aiw claude -p glm "explain this code" # Use custom GLM provider
30
30
 
31
31
  # 🆕 Transparent Parameter Forwarding (v0.5.23+)
32
32
  aiw claude -p glm --model sonnet --debug api "explain this code"
@@ -44,7 +44,7 @@ aiw wait
44
44
  aiw provider
45
45
  ```
46
46
 
47
- ### 5. Update (更新AIW和AI CLI工具)
47
+ ### 5. Update
48
48
  - **AIW Self-Update**: Update AIW itself to latest version from NPM
49
49
  - **AI CLI Tools Update**: Update all installed AI CLI tools (claude, codex, gemini)
50
50
  - **Combined Update**: Update both AIW and AI CLI tools in one command
@@ -227,14 +227,14 @@ AIW now supports transparent parameter forwarding, allowing you to use **all** A
227
227
  # Parameter parsing logic:
228
228
  aiw <ai_type> -p <provider> <cli_params...> <prompt>
229
229
  # ^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
230
- # AIW处理 AIW处理 透明转发到AI CLI
230
+ # AIW args AIW args Forward to AI CLI
231
231
  ```
232
232
 
233
233
  ### Rules
234
234
 
235
- - **AIW Consumes**: `-p` / `--provider` parameters for provider selection
235
+ - **AIW Consumes**: `-r` / `--role` for role injection, `-p` / `--provider` for provider selection
236
236
  - **Transparent Forwarding**: All other `-` prefixed parameters are passed directly to the AI CLI
237
- - **Parameter Order**: Provider flags must come **before** other CLI parameters
237
+ - **Parameter Order**: AIW flags (-r, -p) must come **before** other CLI parameters
238
238
  - **Full Compatibility**: Maintain complete access to all AI CLI features
239
239
 
240
240
  ### Examples
@@ -248,7 +248,7 @@ aiw claude -p glm --model sonnet --debug api "explain this code"
248
248
  aiw claude -p glm --print --output-format json "summarize the file"
249
249
 
250
250
  # Tool restrictions
251
- aiw claude -p glm --allowed-tools Bash,Edit --print "modify this file"
251
+ aiw claude -p glm --allowed-tools Bash,Edit "modify this file"
252
252
 
253
253
  # Multiple parameters
254
254
  aiw claude -p glm --model sonnet --max-budget-usd 5 --dangerously-skip-permissions "help me debug"
@@ -265,20 +265,20 @@ aiw claude -p glm --print --output-format stream-json
265
265
  # Interactive with specific tools
266
266
  aiw claude -p glm --tools "Bash,Edit,Read" --no-session-persistence
267
267
 
268
- # Multi-AI with same provider and parameters
269
- aiw claude,codex -p glm --temperature 0.7 --print "compare approaches"
268
+ # Multi-AI with same provider
269
+ aiw "claude|codex" -p glm --temperature 0.7 "compare approaches"
270
270
  ```
271
271
 
272
272
  #### Provider-Specific Examples
273
273
  ```bash
274
274
  # Claude with structured output
275
- aiw claude -p glm --json-schema '{"type":"object","properties":{"summary":{"type":"string"}}}' --print "summarize"
275
+ aiw claude -p glm --json-schema '{"type":"object","properties":{"summary":{"type":"string"}}}' "summarize this"
276
276
 
277
277
  # Codex with custom settings
278
278
  aiw codex -p glm --temperature 0.3 --max-tokens 500 "write python function"
279
279
 
280
280
  # Gemini with approval mode
281
- aiw gemini -p glm --approval-mode yolo --print "translate this text"
281
+ aiw gemini -p glm --approval-mode yolo "translate this text"
282
282
  ```
283
283
 
284
284
  ### Benefits
@@ -347,6 +347,6 @@ MIT License - see [LICENSE](LICENSE) file for details.
347
347
 
348
348
  ---
349
349
 
350
- **AIW** - Universal AI CLI Management Platform with MCP Routing v0.5.25
350
+ **AIW** - Universal AI CLI Management Platform with MCP Routing v0.5.26
351
351
 
352
352
  For full documentation and source code, visit: [https://github.com/putao520/agentic-warden](https://github.com/putao520/agentic-warden)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putao520/aiw",
3
- "version": "0.5.26",
3
+ "version": "0.5.28",
4
4
  "description": "Universal AI CLI management platform with intelligent MCP routing, process tracking, and configuration synchronization",
5
5
  "keywords": [
6
6
  "ai",
@@ -122,9 +122,27 @@ function makeExecutable(filepath) {
122
122
  }
123
123
 
124
124
  /**
125
- * Check if binary already exists and is valid
125
+ * Get binary version by executing it
126
126
  */
127
- function binaryExists(filepath) {
127
+ function getBinaryVersion(filepath) {
128
+ try {
129
+ const result = execSync(`"${filepath}" --version`, {
130
+ encoding: 'utf8',
131
+ timeout: 5000,
132
+ stdio: ['pipe', 'pipe', 'pipe'],
133
+ });
134
+ // Extract version number (e.g., "aiw 0.5.26" -> "0.5.26")
135
+ const match = result.match(/(\d+\.\d+\.\d+)/);
136
+ return match ? match[1] : null;
137
+ } catch {
138
+ return null;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Check if binary already exists and matches current package version
144
+ */
145
+ function binaryExists(filepath, expectedVersion) {
128
146
  try {
129
147
  if (!fs.existsSync(filepath)) {
130
148
  return false;
@@ -137,6 +155,15 @@ function binaryExists(filepath) {
137
155
  return false;
138
156
  }
139
157
 
158
+ // Check version match (critical for upgrades!)
159
+ const binaryVersion = getBinaryVersion(filepath);
160
+ if (binaryVersion && binaryVersion !== expectedVersion) {
161
+ console.log(` Existing binary version: ${binaryVersion}`);
162
+ console.log(` Expected version: ${expectedVersion}`);
163
+ console.log(' Version mismatch, will download new binary.');
164
+ return false;
165
+ }
166
+
140
167
  return true;
141
168
  } catch {
142
169
  return false;
@@ -174,16 +201,15 @@ async function install() {
174
201
  }
175
202
 
176
203
  const binaryPath = path.join(BIN_DIR, platformInfo.filename);
204
+ const version = getPackageVersion();
177
205
 
178
- // Check if binary already exists
179
- if (binaryExists(binaryPath)) {
180
- console.log(` Binary already exists: ${platformInfo.filename}`);
206
+ // Check if binary already exists AND matches expected version
207
+ if (binaryExists(binaryPath, version)) {
208
+ console.log(` Binary already exists: ${platformInfo.filename} (v${version})`);
181
209
  console.log(' Skipping download.');
182
210
  console.log('');
183
211
  return;
184
212
  }
185
-
186
- const version = getPackageVersion();
187
213
  const downloadUrl = `https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/v${version}/${platformInfo.asset}`;
188
214
 
189
215
  console.log(` Platform: ${platformKey}`);