@sylphx/flow 1.3.0 → 1.3.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 +10 -0
- package/package.json +1 -1
- package/src/commands/flow-command.ts +18 -18
- package/src/utils/sync-utils.ts +47 -51
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @sylphx/flow
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Redesign sync flow for better clarity:
|
|
8
|
+
- Remove duplicate config files in preserved list
|
|
9
|
+
- Show MCP check in preview upfront (not after confirmation)
|
|
10
|
+
- Combined preview: templates + MCP servers + preserved files
|
|
11
|
+
- Clear sections with emojis for easy scanning
|
|
12
|
+
|
|
3
13
|
## 1.3.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -380,7 +380,7 @@ async function executeSetupPhase(prompt: string | undefined, options: FlowOption
|
|
|
380
380
|
|
|
381
381
|
// Handle sync mode - delete template files first
|
|
382
382
|
if (options.sync && !options.dryRun) {
|
|
383
|
-
const { buildSyncManifest, showSyncPreview, confirmSync, executeSyncDelete } = await import('../utils/sync-utils.js');
|
|
383
|
+
const { buildSyncManifest, showSyncPreview, confirmSync, executeSyncDelete, checkMCPServers, selectServersToRemove, removeMCPServers } = await import('../utils/sync-utils.js');
|
|
384
384
|
|
|
385
385
|
// Need target to build manifest
|
|
386
386
|
const targetId = await selectAndValidateTarget(initOptions);
|
|
@@ -394,8 +394,11 @@ async function executeSetupPhase(prompt: string | undefined, options: FlowOption
|
|
|
394
394
|
const target = targetOption.value;
|
|
395
395
|
const manifest = await buildSyncManifest(process.cwd(), target);
|
|
396
396
|
|
|
397
|
+
// Check MCP servers before showing preview
|
|
398
|
+
const nonRegistryServers = await checkMCPServers(process.cwd());
|
|
399
|
+
|
|
397
400
|
console.log(chalk.cyan.bold('━━━ 🔄 Synchronizing Files\n'));
|
|
398
|
-
showSyncPreview(manifest, process.cwd());
|
|
401
|
+
showSyncPreview(manifest, process.cwd(), nonRegistryServers);
|
|
399
402
|
|
|
400
403
|
const confirmed = await confirmSync();
|
|
401
404
|
if (!confirmed) {
|
|
@@ -403,20 +406,17 @@ async function executeSetupPhase(prompt: string | undefined, options: FlowOption
|
|
|
403
406
|
process.exit(0);
|
|
404
407
|
}
|
|
405
408
|
|
|
409
|
+
// Delete templates
|
|
406
410
|
const deletedCount = await executeSyncDelete(manifest);
|
|
407
|
-
console.log(chalk.green(`\n✓ Deleted ${deletedCount} files\n`));
|
|
408
|
-
|
|
409
|
-
// Check MCP servers
|
|
410
|
-
const { checkMCPServers, showNonRegistryServers, selectServersToRemove, removeMCPServers } = await import('../utils/sync-utils.js');
|
|
411
|
-
const nonRegistryServers = await checkMCPServers(process.cwd());
|
|
411
|
+
console.log(chalk.green(`\n✓ Deleted ${deletedCount} template files\n`));
|
|
412
412
|
|
|
413
|
+
// Handle MCP servers if any found
|
|
413
414
|
if (nonRegistryServers.length > 0) {
|
|
414
|
-
showNonRegistryServers(nonRegistryServers);
|
|
415
415
|
const serversToRemove = await selectServersToRemove(nonRegistryServers);
|
|
416
416
|
|
|
417
417
|
if (serversToRemove.length > 0) {
|
|
418
418
|
const removedCount = await removeMCPServers(process.cwd(), serversToRemove);
|
|
419
|
-
console.log(chalk.green(
|
|
419
|
+
console.log(chalk.green(`✓ Removed ${removedCount} MCP server(s)\n`));
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
} else if (!options.sync) {
|
|
@@ -709,7 +709,7 @@ async function executeFlowOnce(prompt: string | undefined, options: FlowOptions)
|
|
|
709
709
|
|
|
710
710
|
// Handle sync mode - delete template files first
|
|
711
711
|
if (options.sync && !options.dryRun) {
|
|
712
|
-
const { buildSyncManifest, showSyncPreview, confirmSync, executeSyncDelete } = await import('../utils/sync-utils.js');
|
|
712
|
+
const { buildSyncManifest, showSyncPreview, confirmSync, executeSyncDelete, checkMCPServers, selectServersToRemove, removeMCPServers } = await import('../utils/sync-utils.js');
|
|
713
713
|
|
|
714
714
|
// Need target to build manifest
|
|
715
715
|
const targetId = await selectAndValidateTarget(initOptions);
|
|
@@ -723,8 +723,11 @@ async function executeFlowOnce(prompt: string | undefined, options: FlowOptions)
|
|
|
723
723
|
const target = targetOption.value;
|
|
724
724
|
const manifest = await buildSyncManifest(process.cwd(), target);
|
|
725
725
|
|
|
726
|
+
// Check MCP servers before showing preview
|
|
727
|
+
const nonRegistryServers = await checkMCPServers(process.cwd());
|
|
728
|
+
|
|
726
729
|
console.log(chalk.cyan.bold('━━━ 🔄 Synchronizing Files\n'));
|
|
727
|
-
showSyncPreview(manifest, process.cwd());
|
|
730
|
+
showSyncPreview(manifest, process.cwd(), nonRegistryServers);
|
|
728
731
|
|
|
729
732
|
const confirmed = await confirmSync();
|
|
730
733
|
if (!confirmed) {
|
|
@@ -732,20 +735,17 @@ async function executeFlowOnce(prompt: string | undefined, options: FlowOptions)
|
|
|
732
735
|
process.exit(0);
|
|
733
736
|
}
|
|
734
737
|
|
|
738
|
+
// Delete templates
|
|
735
739
|
const deletedCount = await executeSyncDelete(manifest);
|
|
736
|
-
console.log(chalk.green(`\n✓ Deleted ${deletedCount} files\n`));
|
|
737
|
-
|
|
738
|
-
// Check MCP servers
|
|
739
|
-
const { checkMCPServers, showNonRegistryServers, selectServersToRemove, removeMCPServers } = await import('../utils/sync-utils.js');
|
|
740
|
-
const nonRegistryServers = await checkMCPServers(process.cwd());
|
|
740
|
+
console.log(chalk.green(`\n✓ Deleted ${deletedCount} template files\n`));
|
|
741
741
|
|
|
742
|
+
// Handle MCP servers if any found
|
|
742
743
|
if (nonRegistryServers.length > 0) {
|
|
743
|
-
showNonRegistryServers(nonRegistryServers);
|
|
744
744
|
const serversToRemove = await selectServersToRemove(nonRegistryServers);
|
|
745
745
|
|
|
746
746
|
if (serversToRemove.length > 0) {
|
|
747
747
|
const removedCount = await removeMCPServers(process.cwd(), serversToRemove);
|
|
748
|
-
console.log(chalk.green(
|
|
748
|
+
console.log(chalk.green(`✓ Removed ${removedCount} MCP server(s)\n`));
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
} else {
|
package/src/utils/sync-utils.ts
CHANGED
|
@@ -60,8 +60,6 @@ export async function buildSyncManifest(cwd: string, target: Target): Promise<Sy
|
|
|
60
60
|
'.sylphx-flow/',
|
|
61
61
|
'.secrets/',
|
|
62
62
|
target.config.configFile || '',
|
|
63
|
-
'.mcp.json',
|
|
64
|
-
'opencode.jsonc',
|
|
65
63
|
]
|
|
66
64
|
.filter(Boolean)
|
|
67
65
|
.map((p) => path.join(cwd, p));
|
|
@@ -72,46 +70,64 @@ export async function buildSyncManifest(cwd: string, target: Target): Promise<Sy
|
|
|
72
70
|
/**
|
|
73
71
|
* Show sync preview - what will be deleted
|
|
74
72
|
*/
|
|
75
|
-
export function showSyncPreview(
|
|
73
|
+
export function showSyncPreview(
|
|
74
|
+
manifest: SyncManifest,
|
|
75
|
+
cwd: string,
|
|
76
|
+
nonRegistryServers: string[]
|
|
77
|
+
): void {
|
|
76
78
|
console.log(chalk.cyan.bold('📋 Sync Preview\n'));
|
|
77
|
-
console.log(chalk.dim('The following files will be deleted and re-installed:\n'));
|
|
78
79
|
|
|
80
|
+
// Template files section
|
|
79
81
|
const allFiles = [...manifest.agents, ...manifest.slashCommands, ...manifest.rules];
|
|
80
82
|
|
|
81
|
-
if (allFiles.length
|
|
82
|
-
console.log(chalk.yellow('
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
83
|
+
if (allFiles.length > 0) {
|
|
84
|
+
console.log(chalk.yellow('🔄 Templates (delete + reinstall):\n'));
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
86
|
+
if (manifest.agents.length > 0) {
|
|
87
|
+
console.log(chalk.dim(' Agents:'));
|
|
88
|
+
manifest.agents.forEach((file) => {
|
|
89
|
+
const relative = path.relative(cwd, file);
|
|
90
|
+
console.log(chalk.dim(` - ${relative}`));
|
|
91
|
+
});
|
|
92
|
+
console.log('');
|
|
93
|
+
}
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
if (manifest.slashCommands.length > 0) {
|
|
96
|
+
console.log(chalk.dim(' Slash Commands:'));
|
|
97
|
+
manifest.slashCommands.forEach((file) => {
|
|
98
|
+
const relative = path.relative(cwd, file);
|
|
99
|
+
console.log(chalk.dim(` - ${relative}`));
|
|
100
|
+
});
|
|
101
|
+
console.log('');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (manifest.rules.length > 0) {
|
|
105
|
+
console.log(chalk.dim(' Rules:'));
|
|
106
|
+
manifest.rules.forEach((file) => {
|
|
107
|
+
const relative = path.relative(cwd, file);
|
|
108
|
+
console.log(chalk.dim(` - ${relative}`));
|
|
109
|
+
});
|
|
110
|
+
console.log('');
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
console.log(chalk.yellow('🔄 Templates: None found\n'));
|
|
103
114
|
}
|
|
104
115
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
console.log(chalk.dim(` - ${
|
|
116
|
+
// MCP servers section
|
|
117
|
+
if (nonRegistryServers.length > 0) {
|
|
118
|
+
console.log(chalk.yellow('🔍 MCP Servers (not in registry):\n'));
|
|
119
|
+
nonRegistryServers.forEach((server) => {
|
|
120
|
+
console.log(chalk.dim(` - ${server}`));
|
|
110
121
|
});
|
|
111
|
-
console.log('');
|
|
122
|
+
console.log(chalk.dim('\n Possible reasons:'));
|
|
123
|
+
console.log(chalk.dim(' 1. Removed from Flow registry'));
|
|
124
|
+
console.log(chalk.dim(' 2. Custom installation\n'));
|
|
125
|
+
} else {
|
|
126
|
+
console.log(chalk.green('✓ MCP Servers: All in registry\n'));
|
|
112
127
|
}
|
|
113
128
|
|
|
114
|
-
|
|
129
|
+
// Preserved files section
|
|
130
|
+
console.log(chalk.green('✓ Preserved:\n'));
|
|
115
131
|
manifest.preserve.forEach((file) => {
|
|
116
132
|
const relative = path.relative(cwd, file);
|
|
117
133
|
if (fs.existsSync(file)) {
|
|
@@ -188,26 +204,6 @@ export async function checkMCPServers(cwd: string): Promise<string[]> {
|
|
|
188
204
|
}
|
|
189
205
|
}
|
|
190
206
|
|
|
191
|
-
/**
|
|
192
|
-
* Show non-registry servers
|
|
193
|
-
*/
|
|
194
|
-
export function showNonRegistryServers(servers: string[]): void {
|
|
195
|
-
if (servers.length === 0) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
console.log(chalk.cyan.bold('\n📋 MCP Registry Check\n'));
|
|
200
|
-
console.log(chalk.yellow('⚠️ 以下 MCP servers 唔係 Flow registry 入面:\n'));
|
|
201
|
-
|
|
202
|
-
servers.forEach(server => {
|
|
203
|
-
console.log(chalk.dim(` - ${server}`));
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
console.log(chalk.dim('\n可能原因:'));
|
|
207
|
-
console.log(chalk.dim(' 1. Flow registry 已移除'));
|
|
208
|
-
console.log(chalk.dim(' 2. 你自己手動安裝\n'));
|
|
209
|
-
}
|
|
210
|
-
|
|
211
207
|
/**
|
|
212
208
|
* Select servers to remove
|
|
213
209
|
*/
|