flowstride 1.0.2 ā 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.
- package/dist/cli/index.js +26 -33
- 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.
|
|
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,11 +97,10 @@ 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
|
-
|
|
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
|
-
const nodeModulesPath = path.join(process.cwd(), "node_modules", "@
|
|
103
|
+
const nodeModulesPath = path.join(process.cwd(), "node_modules", "@heroamogs", "pro");
|
|
108
104
|
if (fs.existsSync(localPackageJsonPath) &&
|
|
109
105
|
!fs.existsSync(nodeModulesPath)) {
|
|
110
106
|
const installPro = await (0, prompts_1.confirm)({
|
|
@@ -112,44 +108,41 @@ program
|
|
|
112
108
|
default: true,
|
|
113
109
|
});
|
|
114
110
|
if (installPro) {
|
|
115
|
-
const installSpinner = (0, ora_1.default)("
|
|
116
|
-
const
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// C. Run the silent install
|
|
130
|
-
(0, child_process_1.execSync)("npm install @flowstride/pro --save-dev", {
|
|
131
|
-
stdio: "ignore",
|
|
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", {
|
|
128
|
+
stdio: "inherit",
|
|
132
129
|
cwd: process.cwd(),
|
|
133
130
|
});
|
|
134
|
-
|
|
131
|
+
console.log(chalk_1.default.green("\nā
Enterprise Engine installed successfully!"));
|
|
135
132
|
}
|
|
136
133
|
catch (installError) {
|
|
137
|
-
installSpinner.
|
|
138
|
-
console.
|
|
134
|
+
installSpinner.stop();
|
|
135
|
+
console.log(chalk_1.default.red("\nā Failed to install the Enterprise Engine automatically."));
|
|
136
|
+
console.error(chalk_1.default.gray(String(installError)));
|
|
139
137
|
}
|
|
140
138
|
finally {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
fs.writeFileSync(npmrcPath, originalNpmrc); // Restore original
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
if (fs.existsSync(npmrcPath))
|
|
147
|
-
fs.unlinkSync(npmrcPath); // Delete if we created it
|
|
139
|
+
if (fs.existsSync(tarballPath)) {
|
|
140
|
+
fs.unlinkSync(tarballPath);
|
|
148
141
|
}
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
else {
|
|
152
|
-
console.log(chalk_1.default.gray(`\nSkipped installation
|
|
145
|
+
console.log(chalk_1.default.gray(`\nSkipped installation.`));
|
|
153
146
|
}
|
|
154
147
|
}
|
|
155
148
|
}
|