flowstride 1.0.3 → 1.0.6

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/dist/cli/index.js +22 -31
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -52,7 +52,7 @@ const program = new commander_1.Command();
52
52
  program
53
53
  .name("flowstride")
54
54
  .description("Flowstride: The Enterprise Flow-First Automation CLI")
55
- .version("1.0.3");
55
+ .version("1.0.6");
56
56
  program
57
57
  .command("init")
58
58
  .description("Initialise a new Flowstride workspace in the current directory")
@@ -66,11 +66,9 @@ program
66
66
  console.log(chalk_1.default.bold.blue("\n🌐 Flowstride Enterprise Cloud Sync\n"));
67
67
  const userEmail = await (0, prompts_1.input)({ message: "Enter your Flowstride email:" });
68
68
  const userPass = await (0, prompts_1.password)({ message: "Enter your password:" });
69
- // Silently grab the computer's hostname without bothering the user
70
69
  const deviceName = os.hostname();
71
70
  const spinner = (0, ora_1.default)("Authenticating with Cloud...").start();
72
71
  try {
73
- // 1. Authenticate with Next.js Server
74
72
  const authString = Buffer.from(`${userEmail}:${userPass}`).toString("base64");
75
73
  const response = await fetch("https://cloud.flowstride.io/api/auth/cli-sync", {
76
74
  method: "POST",
@@ -86,7 +84,6 @@ program
86
84
  process.exit(1);
87
85
  }
88
86
  spinner.succeed(chalk_1.default.green("Authentication Successful!"));
89
- // 2. Save Machine Token Locally
90
87
  const configDir = path.join(os.homedir(), ".flowstride");
91
88
  if (!fs.existsSync(configDir)) {
92
89
  fs.mkdirSync(configDir, { recursive: true });
@@ -100,8 +97,7 @@ program
100
97
  }, null, 2));
101
98
  console.log(chalk_1.default.gray(`\nCredentials saved to ${credentialsPath}`));
102
99
  console.log(chalk_1.default.bold.green(`\nāœ… Machine synchronized with Flowstride Enterprise.`));
103
- // 3. The Auto-Installer Logic
104
- if (data.githubToken) {
100
+ if (data.githubToken || data.isProEligible) {
105
101
  console.log(chalk_1.default.yellow(`\nāš™ļø System Check: You have access to Enterprise features (AI Healing, Parallel Workers).`));
106
102
  const localPackageJsonPath = path.join(process.cwd(), "package.json");
107
103
  const nodeModulesPath = path.join(process.cwd(), "node_modules", "@heroamogs", "pro");
@@ -112,46 +108,41 @@ program
112
108
  default: true,
113
109
  });
114
110
  if (installPro) {
115
- const installSpinner = (0, ora_1.default)("Configuring secure registry and installing @heroamogs/pro...").start();
116
- const npmrcPath = path.join(process.cwd(), ".npmrc");
117
- let originalNpmrc = "";
111
+ const installSpinner = (0, ora_1.default)("Downloading Enterprise Engine via secure proxy...").start();
112
+ const tarballPath = path.join(process.cwd(), "flowstride-pro.tgz");
118
113
  try {
119
- // A. Backup existing .npmrc if it exists
120
- if (fs.existsSync(npmrcPath)) {
121
- originalNpmrc = fs.readFileSync(npmrcPath, "utf8");
114
+ const tarballResponse = await fetch("https://cloud.flowstride.io/api/workspace/download-pro", {
115
+ method: "GET",
116
+ headers: {
117
+ Authorization: `Bearer ${data.machineToken}`,
118
+ },
119
+ });
120
+ if (!tarballResponse.ok) {
121
+ throw new Error(`Secure proxy rejected request: ${tarballResponse.statusText}`);
122
122
  }
123
- // B. Write the temporary GitHub configuration
124
- const tempNpmrcContent = `
125
- @heroamogs:registry=https://npm.pkg.github.com
126
- //npm.pkg.github.com/:_authToken=${data.githubToken}
127
- `;
128
- fs.writeFileSync(npmrcPath, (originalNpmrc ? originalNpmrc + "\n" : "") + tempNpmrcContent);
129
- installSpinner.stop(); // Stop spinner so we can see the exact npm logs
130
- console.log(chalk_1.default.cyan("Starting npm install..."));
131
- // C. Run the install WITH INHERIT to expose the exact error
132
- (0, child_process_1.execSync)("npm install @heroamogs/pro --save-dev", {
123
+ const buffer = await tarballResponse.arrayBuffer();
124
+ fs.writeFileSync(tarballPath, Buffer.from(buffer));
125
+ installSpinner.stop();
126
+ console.log(chalk_1.default.cyan("Starting secure local install..."));
127
+ (0, child_process_1.execSync)("npm install ./flowstride-pro.tgz --save-dev", {
133
128
  stdio: "inherit",
134
129
  cwd: process.cwd(),
135
130
  });
136
131
  console.log(chalk_1.default.green("\nāœ… Enterprise Engine installed successfully!"));
137
132
  }
138
133
  catch (installError) {
134
+ installSpinner.stop();
139
135
  console.log(chalk_1.default.red("\nāœ– Failed to install the Enterprise Engine automatically."));
140
- console.error(chalk_1.default.gray("You may need to install it manually."));
136
+ console.error(chalk_1.default.gray(String(installError)));
141
137
  }
142
138
  finally {
143
- // D. Secure Cleanup: Remove the token from .npmrc
144
- if (originalNpmrc) {
145
- fs.writeFileSync(npmrcPath, originalNpmrc); // Restore original
146
- }
147
- else {
148
- if (fs.existsSync(npmrcPath))
149
- fs.unlinkSync(npmrcPath); // Delete if we created it
139
+ if (fs.existsSync(tarballPath)) {
140
+ fs.unlinkSync(tarballPath);
150
141
  }
151
142
  }
152
143
  }
153
144
  else {
154
- console.log(chalk_1.default.gray(`\nSkipped installation. You can run 'npm install @heroamogs/pro --save-dev' manually later.`));
145
+ console.log(chalk_1.default.gray(`\nSkipped installation.`));
155
146
  }
156
147
  }
157
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowstride",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "An opensource flowfirst test automation framework",
5
5
  "workspaces": [
6
6
  "packages/flowstride_report"