wogiflow 2.5.0 → 2.5.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.
Files changed (2) hide show
  1. package/lib/workspace.js +66 -6
  2. package/package.json +1 -1
package/lib/workspace.js CHANGED
@@ -939,16 +939,76 @@ function generateMemberMcpConfigs(workspaceRoot, config) {
939
939
  * @param {string[]} args — CLI arguments
940
940
  */
941
941
  async function initWorkspace(args) {
942
- const workspaceRoot = process.cwd();
943
- const workspaceName = path.basename(workspaceRoot);
942
+ let workspaceRoot = process.cwd();
943
+
944
+ // Walk up to find existing workspace root (same as startWorkerSession)
945
+ let existingWorkspaceRoot = null;
946
+ let dir = workspaceRoot;
947
+ while (dir !== path.dirname(dir)) {
948
+ if (fs.existsSync(path.join(dir, WORKSPACE_CONFIG_FILE))) {
949
+ existingWorkspaceRoot = dir;
950
+ break;
951
+ }
952
+ dir = path.dirname(dir);
953
+ }
954
+
955
+ // If we're inside an existing workspace (found in parent or CWD)
956
+ if (existingWorkspaceRoot) {
957
+ // Check if channels need to be enabled (upgrade path)
958
+ let existingConfig;
959
+ try {
960
+ existingConfig = JSON.parse(fs.readFileSync(path.join(existingWorkspaceRoot, WORKSPACE_CONFIG_FILE), 'utf-8'));
961
+ } catch (err) {
962
+ console.error(`Error reading workspace config: ${err.message}`);
963
+ process.exit(1);
964
+ }
944
965
 
945
- // Check if workspace already exists
946
- if (fs.existsSync(path.join(workspaceRoot, WORKSPACE_CONFIG_FILE))) {
947
- console.error(`Workspace already initialized in ${workspaceRoot}`);
948
- console.error('Use `flow workspace sync` to update.');
966
+ if (!existingConfig.channels?.enabled) {
967
+ console.log(`Workspace found at ${existingWorkspaceRoot}`);
968
+ console.log('Channels not yet enabled — adding channel configuration...\n');
969
+
970
+ // Add channels section to existing config
971
+ const members = Object.keys(existingConfig.members);
972
+ const basePort = 8801;
973
+ existingConfig.channels = {
974
+ enabled: true,
975
+ basePort,
976
+ members: {}
977
+ };
978
+ let port = basePort;
979
+ for (const name of members) {
980
+ existingConfig.channels.members[name] = { port: port++ };
981
+ }
982
+
983
+ // Write updated config
984
+ fs.writeFileSync(
985
+ path.join(existingWorkspaceRoot, WORKSPACE_CONFIG_FILE),
986
+ JSON.stringify(existingConfig, null, 2)
987
+ );
988
+ console.log(` ✓ Updated ${WORKSPACE_CONFIG_FILE} with channels (ports ${basePort}-${basePort + members.length - 1})`);
989
+
990
+ // Generate .mcp.json for each member
991
+ console.log('');
992
+ console.log('── Setting up workspace channels ────────────\n');
993
+ generateMemberMcpConfigs(existingWorkspaceRoot, existingConfig);
994
+ console.log('');
995
+ console.log('Channels enabled! Run `flow workspace start` from a member repo to begin.');
996
+ return;
997
+ }
998
+
999
+ // Workspace exists and channels are already enabled
1000
+ if (existingWorkspaceRoot !== workspaceRoot) {
1001
+ console.error(`You are inside workspace "${path.basename(existingWorkspaceRoot)}" at ${existingWorkspaceRoot}`);
1002
+ console.error(`Run this command from the workspace root, or use \`flow workspace sync\` to update.`);
1003
+ } else {
1004
+ console.error(`Workspace already initialized in ${workspaceRoot}`);
1005
+ console.error('Use `flow workspace sync` to update.');
1006
+ }
949
1007
  process.exit(1);
950
1008
  }
951
1009
 
1010
+ const workspaceName = path.basename(workspaceRoot);
1011
+
952
1012
  console.log('🔍 Scanning for WogiFlow-enabled projects...\n');
953
1013
 
954
1014
  // Discover member repos
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {