@stackweld/cli 0.2.2 → 0.2.3
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/LICENSE +21 -0
- package/dist/index.js +415 -181
- package/package.json +23 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Orlando Fernandez / XPlus Technologies LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Stackweld CLI — The operating system for your dev stacks.
|
|
4
4
|
*/
|
|
5
|
+
import { input, select, Separator } from "@inquirer/prompts";
|
|
5
6
|
import chalk from "chalk";
|
|
6
7
|
import { Command } from "commander";
|
|
7
|
-
import { select, input } from "@inquirer/prompts";
|
|
8
8
|
import { aiCommand } from "./commands/ai.js";
|
|
9
9
|
import { analyzeCommand } from "./commands/analyze.js";
|
|
10
10
|
import { benchmarkCommand } from "./commands/benchmark.js";
|
|
@@ -41,8 +41,7 @@ import { statusCommand } from "./commands/status.js";
|
|
|
41
41
|
import { templateCommand } from "./commands/template.js";
|
|
42
42
|
import { upCommand } from "./commands/up.js";
|
|
43
43
|
import { versionCommand } from "./commands/version-cmd.js";
|
|
44
|
-
|
|
45
|
-
const VERSION = "0.2.1";
|
|
44
|
+
const VERSION = "0.2.3";
|
|
46
45
|
const program = new Command();
|
|
47
46
|
program
|
|
48
47
|
.name("stackweld")
|
|
@@ -85,228 +84,463 @@ program
|
|
|
85
84
|
.addCommand(costCommand)
|
|
86
85
|
.addCommand(pluginCommand)
|
|
87
86
|
.addCommand(versionCommand);
|
|
88
|
-
//
|
|
87
|
+
// ─── Helpers ──────────────────────────────────────────────
|
|
88
|
+
function isExitSignal(err) {
|
|
89
|
+
if (!err || typeof err !== "object")
|
|
90
|
+
return false;
|
|
91
|
+
const e = err;
|
|
92
|
+
return (e.name === "ExitPromptError" ||
|
|
93
|
+
e.code === "ERR_USE_AFTER_CLOSE");
|
|
94
|
+
}
|
|
95
|
+
async function pressEnterToContinue() {
|
|
96
|
+
await input({ message: chalk.dim("Press Enter to continue...") });
|
|
97
|
+
}
|
|
98
|
+
async function run(args) {
|
|
99
|
+
try {
|
|
100
|
+
await program.parseAsync(["node", "stackweld", ...args]);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
const code = err?.code;
|
|
104
|
+
if (code === "commander.helpDisplayed" || code === "commander.version")
|
|
105
|
+
return;
|
|
106
|
+
if (code === "commander.missingMandatoryOptionValue" || code === "commander.missingArgument") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// ─── ASCII Art Logo ──────────────────────────────────────
|
|
113
|
+
function printLogo() {
|
|
114
|
+
const g = chalk.hex("#FFD700"); // gold
|
|
115
|
+
const c = chalk.hex("#00E3FD"); // cyan
|
|
116
|
+
const m = chalk.hex("#FF51FA"); // magenta
|
|
117
|
+
const p = chalk.hex("#7C5CFC"); // purple/brand
|
|
118
|
+
const logo = [
|
|
119
|
+
"",
|
|
120
|
+
` ${g("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${g("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${g("\u2588\u2588\u2588\u2588\u2588\u2557")} ${c("\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${c("\u2588\u2588\u2557 \u2588\u2588\u2557")} ${c("\u2588\u2588\u2557")} ${m("\u2588\u2588\u2557")} ${m("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${m("\u2588\u2588\u2557")} ${m("\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ")}`,
|
|
121
|
+
` ${g("\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D")} ${g("\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D")} ${g("\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")} ${c("\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D")} ${c("\u2588\u2588\u2551 \u2588\u2588\u2554\u255D")} ${c("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D")} ${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")}`,
|
|
122
|
+
` ${g("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${g("\u2588\u2588\u2551")} ${g("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551")} ${c("\u2588\u2588\u2551")} ${c("\u2588\u2588\u2588\u2588\u2588\u2554\u255D")} ${c("\u2588\u2588\u2551")} ${c("\u2588\u2588\u2557")} ${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2588\u2588\u2588\u2557")} ${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2551 \u2588\u2588\u2551")}`,
|
|
123
|
+
` ${g("\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551")} ${g("\u2588\u2588\u2551")} ${g("\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551")} ${c("\u2588\u2588\u2551")} ${c("\u2588\u2588\u2554\u2550\u2588\u2588\u2557")} ${c("\u2588\u2588\u2551")} ${c("\u2588\u2588\u2588\u2557")}${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2554\u2550\u2550\u255D")} ${m("\u2588\u2588\u2551")} ${m("\u2588\u2588\u2551 \u2588\u2588\u2551")}`,
|
|
124
|
+
` ${g("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551")} ${g("\u2588\u2588\u2551")} ${g("\u2588\u2588\u2551 \u2588\u2588\u2551")} ${c("\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${c("\u2588\u2588\u2551 \u2588\u2588\u2557")} ${c("\u255A\u2588\u2588\u2588\u2554\u2588\u2588\u2588\u2554\u255D")} ${m("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${m("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")} ${m("\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}`,
|
|
125
|
+
` ${g("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D")} ${g("\u255A\u2550\u255D")} ${g("\u255A\u2550\u255D \u255A\u2550\u255D")} ${c("\u255A\u2550\u2550\u2550\u2550\u2550\u255D")} ${c("\u255A\u2550\u255D \u255A\u2550\u255D")} ${c("\u255A\u2550\u2550\u255D\u255A\u2550\u2550\u255D")} ${m("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D")} ${m("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D")} ${m("\u255A\u2550\u2550\u2550\u2550\u2550\u255D")} `,
|
|
126
|
+
"",
|
|
127
|
+
` ${p.bold("The Developer's Forge")} ${chalk.dim(`v${VERSION}`)}`,
|
|
128
|
+
` ${chalk.dim("github.com/mundowise/Stackweld")}`,
|
|
129
|
+
"",
|
|
130
|
+
];
|
|
131
|
+
for (const line of logo) {
|
|
132
|
+
console.log(line);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// ─── Command List ────────────────────────────────────────
|
|
136
|
+
function printCommandList() {
|
|
137
|
+
const b = chalk.hex("#7C5CFC").bold;
|
|
138
|
+
const d = chalk.dim;
|
|
139
|
+
const w = chalk.white;
|
|
140
|
+
const categories = [
|
|
141
|
+
{
|
|
142
|
+
name: "Project Setup",
|
|
143
|
+
commands: [
|
|
144
|
+
["init", "Create a new project interactively"],
|
|
145
|
+
["create", "Create a stack definition from options"],
|
|
146
|
+
["generate", "Generate docker-compose & configs"],
|
|
147
|
+
["scaffold", "Scaffold project files from a stack"],
|
|
148
|
+
["template", "Manage & apply stack templates"],
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "Stack Management",
|
|
153
|
+
commands: [
|
|
154
|
+
["list", "List all saved stacks"],
|
|
155
|
+
["info", "Show stack or technology details"],
|
|
156
|
+
["save", "Save current stack definition"],
|
|
157
|
+
["delete", "Delete a saved stack"],
|
|
158
|
+
["clone", "Clone an existing stack"],
|
|
159
|
+
["export", "Export stack to a file"],
|
|
160
|
+
["import", "Import stack from a file"],
|
|
161
|
+
["share", "Share stack via URL"],
|
|
162
|
+
["import-url", "Import stack from a shared URL"],
|
|
163
|
+
["compare", "Compare two stacks side-by-side"],
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "Runtime & Services",
|
|
168
|
+
commands: [
|
|
169
|
+
["up", "Start stack services (docker-compose up)"],
|
|
170
|
+
["down", "Stop stack services"],
|
|
171
|
+
["status", "Show running service status"],
|
|
172
|
+
["logs", "View service logs"],
|
|
173
|
+
["health", "Run health checks on services"],
|
|
174
|
+
["env", "Manage environment variables"],
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "Analysis & Intelligence",
|
|
179
|
+
commands: [
|
|
180
|
+
["browse", "Browse available technologies"],
|
|
181
|
+
["analyze", "Analyze an existing project"],
|
|
182
|
+
["score", "Score compatibility between technologies"],
|
|
183
|
+
["learn", "Learn about a technology in depth"],
|
|
184
|
+
["migrate", "Get migration guide between technologies"],
|
|
185
|
+
["cost", "Estimate hosting costs for a stack"],
|
|
186
|
+
["benchmark", "Profile performance characteristics"],
|
|
187
|
+
["doctor", "Check system prerequisites"],
|
|
188
|
+
["ai", "AI-powered stack recommendations"],
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "Tools & Settings",
|
|
193
|
+
commands: [
|
|
194
|
+
["config", "View/set configuration preferences"],
|
|
195
|
+
["completion", "Generate shell completions"],
|
|
196
|
+
["deploy", "Generate deploy infrastructure"],
|
|
197
|
+
["lint", "Lint stack against best practices"],
|
|
198
|
+
["preview", "Preview stack in browser"],
|
|
199
|
+
["plugin", "Manage CLI plugins"],
|
|
200
|
+
["version", "Show detailed version info"],
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
console.log(`\n ${b("Available Commands")}\n`);
|
|
205
|
+
for (const cat of categories) {
|
|
206
|
+
console.log(` ${chalk.yellow.bold(cat.name)}`);
|
|
207
|
+
for (const [cmd, desc] of cat.commands) {
|
|
208
|
+
console.log(` ${w(`stackweld ${cmd}`)} ${d(desc)}`);
|
|
209
|
+
}
|
|
210
|
+
console.log("");
|
|
211
|
+
}
|
|
212
|
+
console.log(` ${d("Run")} ${w("stackweld <command> --help")} ${d("for detailed usage.")}\n`);
|
|
213
|
+
}
|
|
214
|
+
// ─── Submenus ─────────────────────────────────────────────
|
|
215
|
+
async function stacksSubmenu() {
|
|
216
|
+
const action = await select({
|
|
217
|
+
message: "Manage saved stacks",
|
|
218
|
+
loop: false,
|
|
219
|
+
pageSize: 15,
|
|
220
|
+
choices: [
|
|
221
|
+
{ name: "\uD83D\uDCCB List all stacks", value: "list" },
|
|
222
|
+
{ name: "\uD83D\uDD0D Stack/tech info", value: "info" },
|
|
223
|
+
{ name: "\uD83D\uDDD1\uFE0F Delete a stack", value: "delete" },
|
|
224
|
+
{ name: "\uD83D\uDCC2 Clone a stack", value: "clone" },
|
|
225
|
+
{ name: "\uD83D\uDCE4 Export a stack", value: "export" },
|
|
226
|
+
{ name: "\uD83D\uDCE5 Import a stack", value: "import" },
|
|
227
|
+
{ name: "\uD83D\uDD17 Share a stack (URL)", value: "share" },
|
|
228
|
+
{ name: "\uD83D\uDD17 Import from URL", value: "import-url" },
|
|
229
|
+
{ name: "\uD83D\uDD0D Compare two stacks", value: "compare" },
|
|
230
|
+
new Separator(),
|
|
231
|
+
{ name: "\u2B05\uFE0F Back to main menu", value: "back" },
|
|
232
|
+
],
|
|
233
|
+
});
|
|
234
|
+
if (action === "back")
|
|
235
|
+
return;
|
|
236
|
+
switch (action) {
|
|
237
|
+
case "list":
|
|
238
|
+
await run(["list"]);
|
|
239
|
+
break;
|
|
240
|
+
case "info": {
|
|
241
|
+
const id = await input({ message: "Stack or technology ID:" });
|
|
242
|
+
if (id.trim())
|
|
243
|
+
await run(["info", id.trim()]);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
case "delete": {
|
|
247
|
+
const id = await input({ message: "Stack ID to delete:" });
|
|
248
|
+
if (id.trim())
|
|
249
|
+
await run(["delete", id.trim()]);
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case "clone": {
|
|
253
|
+
const id = await input({ message: "Stack ID to clone:" });
|
|
254
|
+
if (id.trim())
|
|
255
|
+
await run(["clone", id.trim()]);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case "export": {
|
|
259
|
+
const id = await input({ message: "Stack ID to export:" });
|
|
260
|
+
if (id.trim())
|
|
261
|
+
await run(["export", id.trim()]);
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
case "import": {
|
|
265
|
+
const file = await input({ message: "File path to import:" });
|
|
266
|
+
if (file.trim())
|
|
267
|
+
await run(["import", file.trim()]);
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case "share": {
|
|
271
|
+
const id = await input({ message: "Stack ID to share:" });
|
|
272
|
+
if (id.trim())
|
|
273
|
+
await run(["share", id.trim()]);
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
case "import-url": {
|
|
277
|
+
const url = await input({ message: "Share URL to import:" });
|
|
278
|
+
if (url.trim())
|
|
279
|
+
await run(["import-url", url.trim()]);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case "compare": {
|
|
283
|
+
const a = await input({ message: "First stack ID:" });
|
|
284
|
+
const b = await input({ message: "Second stack ID:" });
|
|
285
|
+
if (a.trim() && b.trim())
|
|
286
|
+
await run(["compare", a.trim(), b.trim()]);
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function runtimeSubmenu() {
|
|
292
|
+
const action = await select({
|
|
293
|
+
message: "Runtime & services",
|
|
294
|
+
loop: false,
|
|
295
|
+
pageSize: 10,
|
|
296
|
+
choices: [
|
|
297
|
+
{ name: "\u25B6\uFE0F Start services (up)", value: "up" },
|
|
298
|
+
{ name: "\u23F9\uFE0F Stop services (down)", value: "down" },
|
|
299
|
+
{ name: "\uD83D\uDFE2 Service status", value: "status" },
|
|
300
|
+
{ name: "\uD83D\uDCDC View logs", value: "logs" },
|
|
301
|
+
{ name: "\uD83C\uDFE5 Health checks", value: "health" },
|
|
302
|
+
{ name: "\uD83D\uDD10 Environment variables", value: "env" },
|
|
303
|
+
new Separator(),
|
|
304
|
+
{ name: "\u2B05\uFE0F Back to main menu", value: "back" },
|
|
305
|
+
],
|
|
306
|
+
});
|
|
307
|
+
if (action === "back")
|
|
308
|
+
return;
|
|
309
|
+
switch (action) {
|
|
310
|
+
case "up":
|
|
311
|
+
await run(["up"]);
|
|
312
|
+
break;
|
|
313
|
+
case "down":
|
|
314
|
+
await run(["down"]);
|
|
315
|
+
break;
|
|
316
|
+
case "status":
|
|
317
|
+
await run(["status"]);
|
|
318
|
+
break;
|
|
319
|
+
case "logs":
|
|
320
|
+
await run(["logs"]);
|
|
321
|
+
break;
|
|
322
|
+
case "health":
|
|
323
|
+
await run(["health"]);
|
|
324
|
+
break;
|
|
325
|
+
case "env":
|
|
326
|
+
await run(["env"]);
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async function settingsSubmenu() {
|
|
331
|
+
const action = await select({
|
|
332
|
+
message: "Settings & tools",
|
|
333
|
+
loop: false,
|
|
334
|
+
pageSize: 10,
|
|
335
|
+
choices: [
|
|
336
|
+
{ name: "\u2699\uFE0F Configuration preferences", value: "config" },
|
|
337
|
+
{ name: "\uD83D\uDCDD Shell completions (bash/zsh/fish)", value: "completion" },
|
|
338
|
+
{ name: "\uD83D\uDD0C Manage plugins", value: "plugins" },
|
|
339
|
+
{ name: "\uD83D\uDE80 Generate deploy infrastructure", value: "deploy" },
|
|
340
|
+
{ name: "\uD83D\uDCCF Lint stack against standards", value: "lint" },
|
|
341
|
+
{ name: "\uD83D\uDD0D Preview stack in browser", value: "preview" },
|
|
342
|
+
new Separator(),
|
|
343
|
+
{ name: "\u2B05\uFE0F Back to main menu", value: "back" },
|
|
344
|
+
],
|
|
345
|
+
});
|
|
346
|
+
if (action === "back")
|
|
347
|
+
return;
|
|
348
|
+
switch (action) {
|
|
349
|
+
case "config":
|
|
350
|
+
await run(["config", "list"]);
|
|
351
|
+
break;
|
|
352
|
+
case "completion": {
|
|
353
|
+
const shell = await select({
|
|
354
|
+
message: "Shell type:",
|
|
355
|
+
loop: false,
|
|
356
|
+
choices: [
|
|
357
|
+
{ name: "bash", value: "bash" },
|
|
358
|
+
{ name: "zsh", value: "zsh" },
|
|
359
|
+
{ name: "fish", value: "fish" },
|
|
360
|
+
],
|
|
361
|
+
});
|
|
362
|
+
await run(["completion", shell]);
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
case "plugins":
|
|
366
|
+
await run(["plugin", "list"]);
|
|
367
|
+
break;
|
|
368
|
+
case "deploy": {
|
|
369
|
+
const id = await input({ message: "Stack ID to deploy:" });
|
|
370
|
+
if (id.trim())
|
|
371
|
+
await run(["deploy", id.trim()]);
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
case "lint":
|
|
375
|
+
await run(["lint"]);
|
|
376
|
+
break;
|
|
377
|
+
case "preview":
|
|
378
|
+
await run(["preview"]);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
// ─── Interactive Menu ─────────────────────────────────────
|
|
89
383
|
async function interactiveMenu() {
|
|
384
|
+
program.exitOverride();
|
|
90
385
|
console.clear();
|
|
91
|
-
|
|
386
|
+
printLogo();
|
|
92
387
|
while (true) {
|
|
388
|
+
let choice;
|
|
93
389
|
try {
|
|
94
|
-
|
|
95
|
-
message:
|
|
390
|
+
choice = await select({
|
|
391
|
+
message: "What would you like to do?",
|
|
392
|
+
loop: false,
|
|
393
|
+
pageSize: 20,
|
|
96
394
|
choices: [
|
|
97
|
-
{ name:
|
|
98
|
-
{ name:
|
|
99
|
-
{ name:
|
|
100
|
-
{ name:
|
|
101
|
-
{ name:
|
|
102
|
-
{ name:
|
|
103
|
-
{ name:
|
|
104
|
-
{ name:
|
|
105
|
-
{ name:
|
|
106
|
-
{ name:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{ name:
|
|
110
|
-
{ name:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{ name:
|
|
395
|
+
{ name: "\uD83D\uDE80 Create a new project", value: "init" },
|
|
396
|
+
{ name: "\uD83D\uDCCB Browse technologies", value: "browse" },
|
|
397
|
+
{ name: "\uD83D\uDD0D Analyze an existing project", value: "analyze" },
|
|
398
|
+
{ name: "\uD83C\uDFE5 Check system health (doctor)", value: "doctor" },
|
|
399
|
+
{ name: "\uD83D\uDCCA Score compatibility", value: "score" },
|
|
400
|
+
{ name: "\uD83D\uDCDA Learn about a technology", value: "learn" },
|
|
401
|
+
{ name: "\uD83D\uDD04 Migrate between technologies", value: "migrate" },
|
|
402
|
+
{ name: "\uD83D\uDCB0 Estimate hosting costs", value: "cost" },
|
|
403
|
+
{ name: "\u26A1 Performance profile", value: "benchmark" },
|
|
404
|
+
{ name: "\uD83E\uDD16 AI stack recommendations", value: "ai" },
|
|
405
|
+
new Separator(),
|
|
406
|
+
{ name: "\uD83D\uDCE6 Manage saved stacks", value: "stacks" },
|
|
407
|
+
{ name: "\uD83D\uDDA5\uFE0F Runtime & services", value: "runtime" },
|
|
408
|
+
{ name: "\u2699\uFE0F Settings & tools", value: "settings" },
|
|
409
|
+
new Separator(),
|
|
410
|
+
{ name: "\uD83D\uDCD6 Show all commands", value: "commands" },
|
|
411
|
+
{ name: "\u274C Exit", value: "exit" },
|
|
114
412
|
],
|
|
115
413
|
});
|
|
116
|
-
|
|
117
|
-
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
if (isExitSignal(err)) {
|
|
417
|
+
console.log(chalk.dim("\n Goodbye!\n"));
|
|
118
418
|
process.exit(0);
|
|
119
419
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
if (choice === "exit") {
|
|
423
|
+
console.log(chalk.dim("\n Goodbye!\n"));
|
|
424
|
+
process.exit(0);
|
|
425
|
+
}
|
|
426
|
+
if (choice === "commands") {
|
|
427
|
+
printCommandList();
|
|
428
|
+
try {
|
|
429
|
+
await pressEnterToContinue();
|
|
430
|
+
}
|
|
431
|
+
catch (err) {
|
|
432
|
+
if (isExitSignal(err)) {
|
|
433
|
+
console.log(chalk.dim("\n Goodbye!\n"));
|
|
434
|
+
process.exit(0);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
console.clear();
|
|
438
|
+
printLogo();
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
console.log("");
|
|
442
|
+
try {
|
|
443
|
+
switch (choice) {
|
|
444
|
+
case "init":
|
|
445
|
+
await run(["init"]);
|
|
124
446
|
break;
|
|
125
447
|
case "browse":
|
|
126
|
-
await
|
|
127
|
-
break;
|
|
128
|
-
case "score": {
|
|
129
|
-
const techA = await input({ message: "First technology ID:" });
|
|
130
|
-
const techB = await input({ message: "Second technology ID (or Enter to see best/worst):" });
|
|
131
|
-
const args = ["node", "stackweld", "score", techA];
|
|
132
|
-
if (techB)
|
|
133
|
-
args.push(techB);
|
|
134
|
-
await program.parseAsync(args);
|
|
448
|
+
await run(["browse"]);
|
|
135
449
|
break;
|
|
136
|
-
}
|
|
137
450
|
case "analyze": {
|
|
138
|
-
const path = await input({ message: "Project path:", default:
|
|
139
|
-
await
|
|
451
|
+
const path = await input({ message: "Project path to analyze:", default: process.cwd() });
|
|
452
|
+
await run(["analyze", path]);
|
|
140
453
|
break;
|
|
141
454
|
}
|
|
142
455
|
case "doctor":
|
|
143
|
-
await
|
|
456
|
+
await run(["doctor"]);
|
|
457
|
+
break;
|
|
458
|
+
case "score": {
|
|
459
|
+
const techA = await input({ message: "First technology ID (e.g. react, nextjs):" });
|
|
460
|
+
const techB = await input({
|
|
461
|
+
message: "Second technology ID (optional, Enter to skip):",
|
|
462
|
+
});
|
|
463
|
+
const scoreArgs = ["score", techA.trim()];
|
|
464
|
+
if (techB.trim())
|
|
465
|
+
scoreArgs.push(techB.trim());
|
|
466
|
+
await run(scoreArgs);
|
|
144
467
|
break;
|
|
468
|
+
}
|
|
145
469
|
case "learn": {
|
|
146
|
-
const tech = await input({ message: "Technology
|
|
147
|
-
|
|
470
|
+
const tech = await input({ message: "Technology ID (e.g. nextjs, react, docker):" });
|
|
471
|
+
if (tech.trim())
|
|
472
|
+
await run(["learn", tech.trim()]);
|
|
148
473
|
break;
|
|
149
474
|
}
|
|
150
475
|
case "migrate": {
|
|
151
476
|
const from = await input({ message: "Migrate FROM (technology ID):" });
|
|
152
477
|
const to = await input({ message: "Migrate TO (technology ID):" });
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
case "cost-ask": {
|
|
157
|
-
const stackId = await input({ message: "Stack ID:" });
|
|
158
|
-
await program.parseAsync(["node", "stackweld", "cost", stackId]);
|
|
478
|
+
if (from.trim() && to.trim()) {
|
|
479
|
+
await run(["migrate", "--from", from.trim(), "--to", to.trim()]);
|
|
480
|
+
}
|
|
159
481
|
break;
|
|
160
482
|
}
|
|
161
|
-
case "
|
|
162
|
-
const stackId = await input({ message: "Stack ID:" });
|
|
163
|
-
|
|
483
|
+
case "cost": {
|
|
484
|
+
const stackId = await input({ message: "Stack ID to estimate costs:" });
|
|
485
|
+
if (stackId.trim())
|
|
486
|
+
await run(["cost", stackId.trim()]);
|
|
164
487
|
break;
|
|
165
488
|
}
|
|
166
|
-
case "
|
|
167
|
-
const
|
|
168
|
-
|
|
489
|
+
case "benchmark": {
|
|
490
|
+
const stackId = await input({ message: "Stack ID to profile:" });
|
|
491
|
+
if (stackId.trim())
|
|
492
|
+
await run(["benchmark", stackId.trim()]);
|
|
169
493
|
break;
|
|
170
494
|
}
|
|
171
|
-
case "
|
|
172
|
-
|
|
173
|
-
message: "Environment action:",
|
|
174
|
-
choices: [
|
|
175
|
-
{ name: "Sync .env.example with .env", value: "sync" },
|
|
176
|
-
{ name: "Check for dangerous values", value: "check" },
|
|
177
|
-
],
|
|
178
|
-
});
|
|
179
|
-
const path = await input({ message: "Project path:", default: "." });
|
|
180
|
-
await program.parseAsync(["node", "stackweld", "env", subAction, "--path", path]);
|
|
495
|
+
case "ai":
|
|
496
|
+
await run(["ai"]);
|
|
181
497
|
break;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const subAction = await select({
|
|
185
|
-
message: "Stack management:",
|
|
186
|
-
choices: [
|
|
187
|
-
{ name: "📋 List all stacks", value: "list" },
|
|
188
|
-
{ name: "🔍 Stack info", value: "info" },
|
|
189
|
-
{ name: "🗑️ Delete a stack", value: "delete" },
|
|
190
|
-
{ name: "📤 Export a stack", value: "export" },
|
|
191
|
-
{ name: "📥 Import a stack", value: "import" },
|
|
192
|
-
{ name: "🔗 Share via URL", value: "share" },
|
|
193
|
-
{ name: "📑 Compare two stacks", value: "compare" },
|
|
194
|
-
{ name: "📋 Clone a stack", value: "clone" },
|
|
195
|
-
{ name: "⬅️ Back", value: "back" },
|
|
196
|
-
],
|
|
197
|
-
});
|
|
198
|
-
if (subAction === "back")
|
|
199
|
-
break;
|
|
200
|
-
if (subAction === "list") {
|
|
201
|
-
await program.parseAsync(["node", "stackweld", "list"]);
|
|
202
|
-
}
|
|
203
|
-
else if (subAction === "info") {
|
|
204
|
-
const id = await input({ message: "Stack ID:" });
|
|
205
|
-
await program.parseAsync(["node", "stackweld", "info", id]);
|
|
206
|
-
}
|
|
207
|
-
else if (subAction === "delete") {
|
|
208
|
-
const id = await input({ message: "Stack ID to delete:" });
|
|
209
|
-
await program.parseAsync(["node", "stackweld", "delete", id]);
|
|
210
|
-
}
|
|
211
|
-
else if (subAction === "export") {
|
|
212
|
-
const id = await input({ message: "Stack ID:" });
|
|
213
|
-
await program.parseAsync(["node", "stackweld", "export", id]);
|
|
214
|
-
}
|
|
215
|
-
else if (subAction === "import") {
|
|
216
|
-
const file = await input({ message: "File path:" });
|
|
217
|
-
await program.parseAsync(["node", "stackweld", "import", file]);
|
|
218
|
-
}
|
|
219
|
-
else if (subAction === "share") {
|
|
220
|
-
const id = await input({ message: "Stack ID:" });
|
|
221
|
-
await program.parseAsync(["node", "stackweld", "share", id]);
|
|
222
|
-
}
|
|
223
|
-
else if (subAction === "compare") {
|
|
224
|
-
const a = await input({ message: "First stack ID:" });
|
|
225
|
-
const b = await input({ message: "Second stack ID:" });
|
|
226
|
-
await program.parseAsync(["node", "stackweld", "compare", a, b]);
|
|
227
|
-
}
|
|
228
|
-
else if (subAction === "clone") {
|
|
229
|
-
const id = await input({ message: "Stack ID to clone:" });
|
|
230
|
-
await program.parseAsync(["node", "stackweld", "clone", id]);
|
|
231
|
-
}
|
|
498
|
+
case "stacks":
|
|
499
|
+
await stacksSubmenu();
|
|
232
500
|
break;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const subAction = await select({
|
|
236
|
-
message: "Docker runtime:",
|
|
237
|
-
choices: [
|
|
238
|
-
{ name: "▶️ Start services (up)", value: "up" },
|
|
239
|
-
{ name: "⏹️ Stop services (down)", value: "down" },
|
|
240
|
-
{ name: "📊 Service status", value: "status" },
|
|
241
|
-
{ name: "📜 View logs", value: "logs" },
|
|
242
|
-
{ name: "⬅️ Back", value: "back" },
|
|
243
|
-
],
|
|
244
|
-
});
|
|
245
|
-
if (subAction === "back")
|
|
246
|
-
break;
|
|
247
|
-
await program.parseAsync(["node", "stackweld", subAction]);
|
|
501
|
+
case "runtime":
|
|
502
|
+
await runtimeSubmenu();
|
|
248
503
|
break;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const subAction = await select({
|
|
252
|
-
message: "Settings & tools:",
|
|
253
|
-
choices: [
|
|
254
|
-
{ name: "⚙️ Configuration", value: "config" },
|
|
255
|
-
{ name: "🔌 Plugins", value: "plugin" },
|
|
256
|
-
{ name: "🏗️ Deploy (generate IaC)", value: "deploy-ask" },
|
|
257
|
-
{ name: "✅ Lint (team standards)", value: "lint" },
|
|
258
|
-
{ name: "📝 Templates", value: "template" },
|
|
259
|
-
{ name: "🤖 AI assistant", value: "ai" },
|
|
260
|
-
{ name: "⬅️ Back", value: "back" },
|
|
261
|
-
],
|
|
262
|
-
});
|
|
263
|
-
if (subAction === "back")
|
|
264
|
-
break;
|
|
265
|
-
if (subAction === "deploy-ask") {
|
|
266
|
-
const id = await input({ message: "Stack ID:" });
|
|
267
|
-
const target = await select({
|
|
268
|
-
message: "Deploy target:",
|
|
269
|
-
choices: [
|
|
270
|
-
{ name: "VPS (Docker + nginx)", value: "vps" },
|
|
271
|
-
{ name: "AWS (ECS Fargate)", value: "aws" },
|
|
272
|
-
{ name: "GCP (Cloud Run)", value: "gcp" },
|
|
273
|
-
],
|
|
274
|
-
});
|
|
275
|
-
await program.parseAsync(["node", "stackweld", "deploy", id, "--target", target]);
|
|
276
|
-
}
|
|
277
|
-
else if (subAction === "config") {
|
|
278
|
-
await program.parseAsync(["node", "stackweld", "config", "list"]);
|
|
279
|
-
}
|
|
280
|
-
else if (subAction === "plugin") {
|
|
281
|
-
await program.parseAsync(["node", "stackweld", "plugin", "list"]);
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
await program.parseAsync(["node", "stackweld", subAction]);
|
|
285
|
-
}
|
|
504
|
+
case "settings":
|
|
505
|
+
await settingsSubmenu();
|
|
286
506
|
break;
|
|
287
|
-
}
|
|
288
507
|
}
|
|
289
|
-
// Pause before showing menu again
|
|
290
|
-
console.log("");
|
|
291
|
-
await input({ message: chalk.dim("Press Enter to continue...") });
|
|
292
|
-
console.clear();
|
|
293
|
-
console.log(banner(VERSION));
|
|
294
508
|
}
|
|
295
509
|
catch (err) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
console.log(chalk.dim("\n Goodbye! 👋\n"));
|
|
510
|
+
if (isExitSignal(err)) {
|
|
511
|
+
console.log(chalk.dim("\n Goodbye!\n"));
|
|
299
512
|
process.exit(0);
|
|
300
513
|
}
|
|
301
|
-
|
|
514
|
+
console.error(chalk.red(`\n \u2716 ${err instanceof Error ? err.message : String(err)}\n`));
|
|
515
|
+
}
|
|
516
|
+
console.log("");
|
|
517
|
+
try {
|
|
518
|
+
await pressEnterToContinue();
|
|
302
519
|
}
|
|
520
|
+
catch (err) {
|
|
521
|
+
if (isExitSignal(err)) {
|
|
522
|
+
console.log(chalk.dim("\n Goodbye!\n"));
|
|
523
|
+
process.exit(0);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
console.clear();
|
|
527
|
+
printLogo();
|
|
303
528
|
}
|
|
304
529
|
}
|
|
305
|
-
//
|
|
530
|
+
// ─── Entry Point ──────────────────────────────────────────
|
|
306
531
|
if (process.argv.length <= 2) {
|
|
307
532
|
interactiveMenu().catch(() => process.exit(0));
|
|
308
533
|
}
|
|
309
534
|
else {
|
|
310
|
-
program.
|
|
535
|
+
program.parseAsync(process.argv).catch((err) => {
|
|
536
|
+
if (err && err.code === "commander.unknownCommand") {
|
|
537
|
+
const cmd = process.argv[2];
|
|
538
|
+
console.error(chalk.red(`\u2716 Unknown command: "${cmd}"`));
|
|
539
|
+
console.error(chalk.dim(` Run ${chalk.white("stackweld --help")} to see available commands.`));
|
|
540
|
+
process.exit(1);
|
|
541
|
+
}
|
|
542
|
+
console.error(chalk.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
543
|
+
process.exit(1);
|
|
544
|
+
});
|
|
311
545
|
}
|
|
312
546
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackweld/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "The operating system for your dev stacks — define, validate, scaffold, and launch development environments from the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Orlando Fernandez <hello@xplustechnologies.com>",
|
|
@@ -10,7 +10,15 @@
|
|
|
10
10
|
"url": "https://github.com/mundowise/Stackweld.git",
|
|
11
11
|
"directory": "packages/cli"
|
|
12
12
|
},
|
|
13
|
-
"keywords": [
|
|
13
|
+
"keywords": [
|
|
14
|
+
"cli",
|
|
15
|
+
"devtools",
|
|
16
|
+
"scaffold",
|
|
17
|
+
"stack",
|
|
18
|
+
"docker",
|
|
19
|
+
"developer-tools",
|
|
20
|
+
"project-generator"
|
|
21
|
+
],
|
|
14
22
|
"type": "module",
|
|
15
23
|
"main": "./dist/index.js",
|
|
16
24
|
"bin": {
|
|
@@ -25,28 +33,28 @@
|
|
|
25
33
|
"engines": {
|
|
26
34
|
"node": ">=22.0.0"
|
|
27
35
|
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "tsc -b",
|
|
30
|
-
"dev": "tsc -b --watch",
|
|
31
|
-
"test": "vitest run --passWithNoTests",
|
|
32
|
-
"typecheck": "tsc --noEmit",
|
|
33
|
-
"lint": "biome check src/",
|
|
34
|
-
"clean": "rm -rf dist .turbo"
|
|
35
|
-
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@anthropic-ai/sdk": "^0.80.0",
|
|
38
38
|
"@inquirer/prompts": "^7.0.0",
|
|
39
|
-
"@stackweld/core": "0.2.1",
|
|
40
|
-
"@stackweld/registry": "0.2.1",
|
|
41
|
-
"@stackweld/templates": "0.2.1",
|
|
42
39
|
"chalk": "^5.4.0",
|
|
43
40
|
"commander": "^13.0.0",
|
|
44
41
|
"ora": "^8.0.0",
|
|
45
|
-
"yaml": "^2.8.3"
|
|
42
|
+
"yaml": "^2.8.3",
|
|
43
|
+
"@stackweld/core": "0.2.1",
|
|
44
|
+
"@stackweld/registry": "0.2.1",
|
|
45
|
+
"@stackweld/templates": "0.2.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@biomejs/biome": "^2.0.0",
|
|
49
49
|
"typescript": "^5.9.0",
|
|
50
50
|
"vitest": "^4.1.2"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -b",
|
|
54
|
+
"dev": "tsc -b --watch",
|
|
55
|
+
"test": "vitest run --passWithNoTests",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"lint": "biome check src/",
|
|
58
|
+
"clean": "rm -rf dist .turbo"
|
|
51
59
|
}
|
|
52
|
-
}
|
|
60
|
+
}
|