@sylphx/flow 2.1.0 → 2.1.1
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 +17 -0
- package/package.json +1 -1
- package/src/core/attach-manager.ts +12 -21
- package/src/core/flow-executor.ts +53 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @sylphx/flow
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8ae48d6: Fix singleFiles location and improve settings cleanup
|
|
8
|
+
|
|
9
|
+
**Bug Fixes:**
|
|
10
|
+
|
|
11
|
+
1. Fixed silent.md location bug - output style files were incorrectly written to project root instead of target config directory (.claude/ or .opencode/)
|
|
12
|
+
|
|
13
|
+
2. Enhanced clearUserSettings to ensure complete cleanup in replace mode:
|
|
14
|
+
- Now clears ALL user configuration including hooks, complete MCP config, rules, and singleFiles
|
|
15
|
+
- Removes entire MCP section (not just servers) to properly clear user hooks
|
|
16
|
+
- Added legacy cleanup to remove incorrectly placed files from project root
|
|
17
|
+
|
|
18
|
+
This fixes the issue where user's hooks and MCP configs were still affecting execution even in replace mode (non-merge mode).
|
|
19
|
+
|
|
3
20
|
## 2.1.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sylphx/flow",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "One CLI to rule them all. Unified orchestration layer for Claude Code, OpenCode, Cursor and all AI development tools. Auto-detection, auto-installation, auto-upgrade.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -420,7 +420,9 @@ ${rules}
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
/**
|
|
423
|
-
* Attach single files (
|
|
423
|
+
* Attach single files (output styles like silent.md)
|
|
424
|
+
* NOTE: These files are placed in the target config directory (.claude/ or .opencode/),
|
|
425
|
+
* NOT in the project root directory.
|
|
424
426
|
*/
|
|
425
427
|
private async attachSingleFiles(
|
|
426
428
|
projectPath: string,
|
|
@@ -428,33 +430,22 @@ ${rules}
|
|
|
428
430
|
result: AttachResult,
|
|
429
431
|
manifest: BackupManifest
|
|
430
432
|
): Promise<void> {
|
|
433
|
+
// Get target from manifest to determine correct directory
|
|
434
|
+
const target = manifest.target;
|
|
435
|
+
const targetDir = this.projectManager.getTargetConfigDir(projectPath, target);
|
|
436
|
+
|
|
431
437
|
for (const file of singleFiles) {
|
|
432
|
-
|
|
438
|
+
// Write to target config directory, not project root
|
|
439
|
+
const filePath = path.join(targetDir, file.path);
|
|
433
440
|
const existed = existsSync(filePath);
|
|
434
441
|
|
|
435
442
|
if (existed) {
|
|
436
|
-
// User has file,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
// Check if already appended
|
|
440
|
-
if (userContent.includes('<!-- Sylphx Flow Enhancement -->')) {
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const merged = `${userContent}
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
|
|
448
|
-
**Sylphx Flow Enhancement:**
|
|
449
|
-
|
|
450
|
-
${file.content}
|
|
451
|
-
`;
|
|
452
|
-
|
|
453
|
-
await fs.writeFile(filePath, merged);
|
|
443
|
+
// User has file, overwrite with Flow content (backed up already)
|
|
444
|
+
await fs.writeFile(filePath, file.content);
|
|
454
445
|
|
|
455
446
|
manifest.backup.singleFiles[file.path] = {
|
|
456
447
|
existed: true,
|
|
457
|
-
originalSize:
|
|
448
|
+
originalSize: (await fs.readFile(filePath, 'utf-8')).length,
|
|
458
449
|
flowContentAdded: true,
|
|
459
450
|
};
|
|
460
451
|
} else {
|
|
@@ -169,6 +169,7 @@ export class FlowExecutor {
|
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* Clear user settings in replace mode
|
|
172
|
+
* This ensures a clean slate for Flow's configuration
|
|
172
173
|
*/
|
|
173
174
|
private async clearUserSettings(
|
|
174
175
|
projectPath: string,
|
|
@@ -188,7 +189,7 @@ export class FlowExecutor {
|
|
|
188
189
|
? { agents: 'agents', commands: 'commands' }
|
|
189
190
|
: { agents: 'agent', commands: 'command' };
|
|
190
191
|
|
|
191
|
-
// Clear agents directory
|
|
192
|
+
// 1. Clear agents directory (including AGENTS.md rules file)
|
|
192
193
|
const agentsDir = path.join(targetDir, dirs.agents);
|
|
193
194
|
if (existsSync(agentsDir)) {
|
|
194
195
|
const files = await fs.readdir(agentsDir);
|
|
@@ -197,7 +198,7 @@ export class FlowExecutor {
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
// Clear commands directory
|
|
201
|
+
// 2. Clear commands directory
|
|
201
202
|
const commandsDir = path.join(targetDir, dirs.commands);
|
|
202
203
|
if (existsSync(commandsDir)) {
|
|
203
204
|
const files = await fs.readdir(commandsDir);
|
|
@@ -206,31 +207,69 @@ export class FlowExecutor {
|
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
// Clear
|
|
210
|
+
// 3. Clear hooks directory
|
|
211
|
+
const hooksDir = path.join(targetDir, 'hooks');
|
|
212
|
+
if (existsSync(hooksDir)) {
|
|
213
|
+
const files = await fs.readdir(hooksDir);
|
|
214
|
+
for (const file of files) {
|
|
215
|
+
await fs.unlink(path.join(hooksDir, file));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 4. Clear MCP configuration completely
|
|
210
220
|
const configPath = target === 'claude-code'
|
|
211
221
|
? path.join(targetDir, 'settings.json')
|
|
212
222
|
: path.join(targetDir, '.mcp.json');
|
|
213
223
|
|
|
214
224
|
if (existsSync(configPath)) {
|
|
215
|
-
// Clear MCP servers section only, keep other settings
|
|
216
|
-
const config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
|
|
217
225
|
if (target === 'claude-code') {
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
// For Claude Code, clear entire MCP section to remove all user config
|
|
227
|
+
const config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
|
|
228
|
+
if (config.mcp) {
|
|
229
|
+
// Remove entire MCP configuration, not just servers
|
|
230
|
+
delete config.mcp;
|
|
220
231
|
await fs.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
221
232
|
}
|
|
222
233
|
} else {
|
|
223
|
-
// For
|
|
234
|
+
// For OpenCode, clear the entire .mcp.json file
|
|
224
235
|
await fs.writeFile(configPath, JSON.stringify({ servers: {} }, null, 2));
|
|
225
236
|
}
|
|
226
237
|
}
|
|
227
238
|
|
|
228
|
-
// Clear
|
|
229
|
-
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
await fs.unlink(
|
|
239
|
+
// 5. Clear AGENTS.md rules file (for OpenCode)
|
|
240
|
+
// Claude Code AGENTS.md is already handled in agents directory
|
|
241
|
+
if (target === 'opencode') {
|
|
242
|
+
const rulesPath = path.join(targetDir, 'AGENTS.md');
|
|
243
|
+
if (existsSync(rulesPath)) {
|
|
244
|
+
await fs.unlink(rulesPath);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// 6. Clear single files (output styles like silent.md)
|
|
249
|
+
// These are now in the target directory, not project root
|
|
250
|
+
const singleFiles = ['silent.md']; // Add other known single files here
|
|
251
|
+
for (const fileName of singleFiles) {
|
|
252
|
+
const filePath = path.join(targetDir, fileName);
|
|
253
|
+
if (existsSync(filePath)) {
|
|
254
|
+
await fs.unlink(filePath);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 7. Clean up any Flow-created files in project root (legacy bug cleanup)
|
|
259
|
+
// This handles files that were incorrectly created in project root
|
|
260
|
+
const legacySingleFiles = ['silent.md'];
|
|
261
|
+
for (const fileName of legacySingleFiles) {
|
|
262
|
+
const filePath = path.join(projectPath, fileName);
|
|
263
|
+
if (existsSync(filePath)) {
|
|
264
|
+
// Only delete if it looks like a Flow-created file
|
|
265
|
+
try {
|
|
266
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
267
|
+
if (content.includes('Sylphx Flow') || content.includes('Silent Execution Style')) {
|
|
268
|
+
await fs.unlink(filePath);
|
|
269
|
+
}
|
|
270
|
+
} catch {
|
|
271
|
+
// Ignore errors - file might not be readable
|
|
272
|
+
}
|
|
234
273
|
}
|
|
235
274
|
}
|
|
236
275
|
}
|