@voltx/cli 0.1.0
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/chunk-77A5TSPB.mjs +98 -0
- package/dist/chunk-HI2GGQGH.mjs +82 -0
- package/dist/chunk-IZORYXJQ.mjs +74 -0
- package/dist/chunk-NWDPHY2E.mjs +107 -0
- package/dist/chunk-PCJYGBOW.mjs +98 -0
- package/dist/chunk-PP2IAQAI.mjs +74 -0
- package/dist/chunk-RH5Q7I3S.mjs +115 -0
- package/dist/chunk-XG76SXPJ.mjs +115 -0
- package/dist/chunk-YY7HMJGT.mjs +116 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +42 -0
- package/dist/cli.mjs +41 -0
- package/dist/create.d.mts +8 -0
- package/dist/create.d.ts +8 -0
- package/dist/create.js +234 -0
- package/dist/create.mjs +8 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +240 -0
- package/dist/index.mjs +11 -0
- package/dist/welcome.d.mts +3 -0
- package/dist/welcome.d.ts +3 -0
- package/dist/welcome.js +131 -0
- package/dist/welcome.mjs +6 -0
- package/package.json +50 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/welcome.ts
|
|
9
|
+
var ESC = "\x1B[";
|
|
10
|
+
var RESET = `${ESC}0m`;
|
|
11
|
+
var ITALIC = `${ESC}3m`;
|
|
12
|
+
function rgb(r, g, b, text) {
|
|
13
|
+
return `${ESC}38;2;${r};${g};${b}m${text}${RESET}`;
|
|
14
|
+
}
|
|
15
|
+
function lerp(a, b, t) {
|
|
16
|
+
return Math.round(a + (b - a) * t);
|
|
17
|
+
}
|
|
18
|
+
function gradientLine(text, from, to) {
|
|
19
|
+
const len = text.length;
|
|
20
|
+
if (len === 0) return "";
|
|
21
|
+
return text.split("").map((char, i) => {
|
|
22
|
+
const t = len === 1 ? 0 : i / (len - 1);
|
|
23
|
+
const r = lerp(from.r, to.r, t);
|
|
24
|
+
const g = lerp(from.g, to.g, t);
|
|
25
|
+
const b = lerp(from.b, to.b, t);
|
|
26
|
+
return rgb(r, g, b, char);
|
|
27
|
+
}).join("");
|
|
28
|
+
}
|
|
29
|
+
function gradientBlock(lines, colors) {
|
|
30
|
+
return lines.map((line, i) => {
|
|
31
|
+
const t = lines.length === 1 ? 0 : i / (lines.length - 1);
|
|
32
|
+
const segIndex = t * (colors.length - 1);
|
|
33
|
+
const fromIdx = Math.floor(segIndex);
|
|
34
|
+
const toIdx = Math.min(fromIdx + 1, colors.length - 1);
|
|
35
|
+
const localT = segIndex - fromIdx;
|
|
36
|
+
const from = {
|
|
37
|
+
r: lerp(colors[fromIdx].r, colors[toIdx].r, localT),
|
|
38
|
+
g: lerp(colors[fromIdx].g, colors[toIdx].g, localT),
|
|
39
|
+
b: lerp(colors[fromIdx].b, colors[toIdx].b, localT)
|
|
40
|
+
};
|
|
41
|
+
const to = {
|
|
42
|
+
r: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].r, colors[Math.min(toIdx + 1, colors.length - 1)].r, localT),
|
|
43
|
+
g: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].g, colors[Math.min(toIdx + 1, colors.length - 1)].g, localT),
|
|
44
|
+
b: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].b, colors[Math.min(toIdx + 1, colors.length - 1)].b, localT)
|
|
45
|
+
};
|
|
46
|
+
return gradientLine(line, from, to);
|
|
47
|
+
}).join("\n");
|
|
48
|
+
}
|
|
49
|
+
var VOLTX_BANNER = [
|
|
50
|
+
" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
|
|
51
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D",
|
|
52
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D ",
|
|
53
|
+
" \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 ",
|
|
54
|
+
" \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2588\u2588\u2557",
|
|
55
|
+
" \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"
|
|
56
|
+
];
|
|
57
|
+
var VOLTX_COLORS = [
|
|
58
|
+
{ r: 0, g: 180, b: 255 },
|
|
59
|
+
// electric blue
|
|
60
|
+
{ r: 120, g: 80, b: 255 },
|
|
61
|
+
// purple
|
|
62
|
+
{ r: 255, g: 50, b: 180 },
|
|
63
|
+
// hot pink
|
|
64
|
+
{ r: 255, g: 120, b: 50 }
|
|
65
|
+
// orange
|
|
66
|
+
];
|
|
67
|
+
function dimRule(width = 48) {
|
|
68
|
+
return ` ${rgb(60, 60, 80, "\u2500".repeat(width))}`;
|
|
69
|
+
}
|
|
70
|
+
function printWelcomeBanner(projectName) {
|
|
71
|
+
console.log("");
|
|
72
|
+
console.log(gradientBlock(VOLTX_BANNER, VOLTX_COLORS));
|
|
73
|
+
console.log("");
|
|
74
|
+
console.log(
|
|
75
|
+
` ${ITALIC}${rgb(180, 180, 220, "The AI-first full-stack framework")}${RESET}`
|
|
76
|
+
);
|
|
77
|
+
console.log("");
|
|
78
|
+
if (projectName) {
|
|
79
|
+
console.log(
|
|
80
|
+
` ${ITALIC}${rgb(120, 220, 180, `Thank you for choosing VoltX! \u26A1`)}${RESET}`
|
|
81
|
+
);
|
|
82
|
+
console.log(
|
|
83
|
+
` ${ITALIC}${rgb(160, 160, 200, `Your project "${projectName}" is ready to go.`)}${RESET}`
|
|
84
|
+
);
|
|
85
|
+
console.log("");
|
|
86
|
+
console.log(` ${rgb(100, 180, 255, "Next steps:")}`);
|
|
87
|
+
console.log(` ${rgb(200, 200, 220, ` cd ${projectName}`)}`);
|
|
88
|
+
console.log(` ${rgb(200, 200, 220, " pnpm install")}`);
|
|
89
|
+
console.log(` ${rgb(200, 200, 220, " pnpm dev")}`);
|
|
90
|
+
console.log("");
|
|
91
|
+
console.log(dimRule());
|
|
92
|
+
console.log("");
|
|
93
|
+
console.log(
|
|
94
|
+
` ${rgb(255, 200, 80, "\u2615")} ${ITALIC}${rgb(200, 180, 140, "Love VoltX? Support us and fuel the next update:")}${RESET}`
|
|
95
|
+
);
|
|
96
|
+
console.log(
|
|
97
|
+
` ${rgb(255, 180, 100, "https://buymeacoffee.com/promptlyai")}`
|
|
98
|
+
);
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log(dimRule());
|
|
101
|
+
console.log("");
|
|
102
|
+
console.log(
|
|
103
|
+
` ${ITALIC}${rgb(140, 140, 170, "Docs: https://voltx.dev \u2022 GitHub: github.com/voltx")}${RESET}`
|
|
104
|
+
);
|
|
105
|
+
console.log(
|
|
106
|
+
` ${ITALIC}${rgb(100, 100, 130, "Made with \u2665 by the Promptly AI Team")}${RESET}`
|
|
107
|
+
);
|
|
108
|
+
console.log("");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export {
|
|
113
|
+
__require,
|
|
114
|
+
printWelcomeBanner
|
|
115
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/welcome.ts
|
|
9
|
+
var ESC = "\x1B[";
|
|
10
|
+
var RESET = `${ESC}0m`;
|
|
11
|
+
var ITALIC = `${ESC}3m`;
|
|
12
|
+
var BOLD = `${ESC}1m`;
|
|
13
|
+
function rgb(r, g, b, text) {
|
|
14
|
+
return `${ESC}38;2;${r};${g};${b}m${text}${RESET}`;
|
|
15
|
+
}
|
|
16
|
+
function lerp(a, b, t) {
|
|
17
|
+
return Math.round(a + (b - a) * t);
|
|
18
|
+
}
|
|
19
|
+
function gradientLine(text, from, to) {
|
|
20
|
+
const len = text.length;
|
|
21
|
+
if (len === 0) return "";
|
|
22
|
+
return text.split("").map((char, i) => {
|
|
23
|
+
const t = len === 1 ? 0 : i / (len - 1);
|
|
24
|
+
const r = lerp(from.r, to.r, t);
|
|
25
|
+
const g = lerp(from.g, to.g, t);
|
|
26
|
+
const b = lerp(from.b, to.b, t);
|
|
27
|
+
return rgb(r, g, b, char);
|
|
28
|
+
}).join("");
|
|
29
|
+
}
|
|
30
|
+
function gradientBlock(lines, colors) {
|
|
31
|
+
return lines.map((line, i) => {
|
|
32
|
+
const t = lines.length === 1 ? 0 : i / (lines.length - 1);
|
|
33
|
+
const segIndex = t * (colors.length - 1);
|
|
34
|
+
const fromIdx = Math.floor(segIndex);
|
|
35
|
+
const toIdx = Math.min(fromIdx + 1, colors.length - 1);
|
|
36
|
+
const localT = segIndex - fromIdx;
|
|
37
|
+
const from = {
|
|
38
|
+
r: lerp(colors[fromIdx].r, colors[toIdx].r, localT),
|
|
39
|
+
g: lerp(colors[fromIdx].g, colors[toIdx].g, localT),
|
|
40
|
+
b: lerp(colors[fromIdx].b, colors[toIdx].b, localT)
|
|
41
|
+
};
|
|
42
|
+
const to = {
|
|
43
|
+
r: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].r, colors[Math.min(toIdx + 1, colors.length - 1)].r, localT),
|
|
44
|
+
g: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].g, colors[Math.min(toIdx + 1, colors.length - 1)].g, localT),
|
|
45
|
+
b: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].b, colors[Math.min(toIdx + 1, colors.length - 1)].b, localT)
|
|
46
|
+
};
|
|
47
|
+
return gradientLine(line, from, to);
|
|
48
|
+
}).join("\n");
|
|
49
|
+
}
|
|
50
|
+
var VOLTX_BANNER = [
|
|
51
|
+
" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
|
|
52
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D",
|
|
53
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D ",
|
|
54
|
+
" \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 ",
|
|
55
|
+
" \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2588\u2588\u2557",
|
|
56
|
+
" \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"
|
|
57
|
+
];
|
|
58
|
+
var VOLTX_COLORS = [
|
|
59
|
+
{ r: 0, g: 180, b: 255 },
|
|
60
|
+
// electric blue
|
|
61
|
+
{ r: 120, g: 80, b: 255 },
|
|
62
|
+
// purple
|
|
63
|
+
{ r: 255, g: 50, b: 180 },
|
|
64
|
+
// hot pink
|
|
65
|
+
{ r: 255, g: 120, b: 50 }
|
|
66
|
+
// orange
|
|
67
|
+
];
|
|
68
|
+
function dimRule(width = 48) {
|
|
69
|
+
return ` ${rgb(60, 60, 80, "\u2500".repeat(width))}`;
|
|
70
|
+
}
|
|
71
|
+
function printWelcomeBanner(projectName) {
|
|
72
|
+
console.log("");
|
|
73
|
+
console.log(gradientBlock(VOLTX_BANNER, VOLTX_COLORS));
|
|
74
|
+
console.log("");
|
|
75
|
+
console.log(
|
|
76
|
+
` ${ITALIC}${rgb(180, 180, 220, "The AI-first full-stack framework")}${RESET}`
|
|
77
|
+
);
|
|
78
|
+
console.log("");
|
|
79
|
+
if (projectName) {
|
|
80
|
+
console.log(
|
|
81
|
+
` ${ITALIC}${rgb(120, 220, 180, `Thank you for choosing VoltX! \u26A1`)}${RESET}`
|
|
82
|
+
);
|
|
83
|
+
console.log(
|
|
84
|
+
` ${ITALIC}${rgb(160, 160, 200, `Your project "${projectName}" is ready to go.`)}${RESET}`
|
|
85
|
+
);
|
|
86
|
+
console.log("");
|
|
87
|
+
console.log(` ${rgb(100, 180, 255, "Next steps:")}`);
|
|
88
|
+
console.log(` ${rgb(200, 200, 220, ` cd ${projectName}`)}`);
|
|
89
|
+
console.log(` ${rgb(200, 200, 220, " pnpm install")}`);
|
|
90
|
+
console.log(` ${rgb(200, 200, 220, " pnpm dev")}`);
|
|
91
|
+
console.log("");
|
|
92
|
+
console.log(dimRule());
|
|
93
|
+
console.log("");
|
|
94
|
+
console.log(
|
|
95
|
+
` ${rgb(255, 200, 80, "\u2615")} ${ITALIC}${rgb(200, 180, 140, "Love VoltX? Support us and fuel the next update:")}${RESET}`
|
|
96
|
+
);
|
|
97
|
+
console.log(
|
|
98
|
+
` ${rgb(255, 180, 100, "https://buymeacoffee.com/promptlyai")}`
|
|
99
|
+
);
|
|
100
|
+
console.log("");
|
|
101
|
+
console.log(dimRule());
|
|
102
|
+
console.log("");
|
|
103
|
+
console.log(
|
|
104
|
+
` ${ITALIC}${rgb(140, 140, 170, "Docs: https://voltx.dev \u2022 GitHub: github.com/voltx")}${RESET}`
|
|
105
|
+
);
|
|
106
|
+
console.log(
|
|
107
|
+
` ${ITALIC}${rgb(100, 100, 130, "Made with \u2665 by the Promptly AI Team")}${RESET}`
|
|
108
|
+
);
|
|
109
|
+
console.log("");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
__require,
|
|
115
|
+
printWelcomeBanner
|
|
116
|
+
};
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// src/cli.ts
|
|
5
|
+
var args = process.argv.slice(2);
|
|
6
|
+
var command = args[0];
|
|
7
|
+
async function main() {
|
|
8
|
+
switch (command) {
|
|
9
|
+
case "dev": {
|
|
10
|
+
console.log("[voltx] Starting dev server...");
|
|
11
|
+
console.log("[voltx] Dev server not yet implemented \u2014 coming in Phase 2");
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
case "build": {
|
|
15
|
+
console.log("[voltx] Building for production...");
|
|
16
|
+
console.log("[voltx] Build not yet implemented \u2014 coming in Phase 2");
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
case "start": {
|
|
20
|
+
console.log("[voltx] Starting production server...");
|
|
21
|
+
console.log("[voltx] Start not yet implemented \u2014 coming in Phase 2");
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
default: {
|
|
25
|
+
console.log(`
|
|
26
|
+
voltx \u2014 The AI-first full-stack framework
|
|
27
|
+
|
|
28
|
+
Usage:
|
|
29
|
+
voltx dev Start the development server
|
|
30
|
+
voltx build Build for production
|
|
31
|
+
voltx start Start the production server
|
|
32
|
+
|
|
33
|
+
To create a new project:
|
|
34
|
+
create-voltx-app <project-name>
|
|
35
|
+
`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
main().catch((err) => {
|
|
40
|
+
console.error("[voltx] Fatal error:", err);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
});
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
var args = process.argv.slice(2);
|
|
5
|
+
var command = args[0];
|
|
6
|
+
async function main() {
|
|
7
|
+
switch (command) {
|
|
8
|
+
case "dev": {
|
|
9
|
+
console.log("[voltx] Starting dev server...");
|
|
10
|
+
console.log("[voltx] Dev server not yet implemented \u2014 coming in Phase 2");
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
case "build": {
|
|
14
|
+
console.log("[voltx] Building for production...");
|
|
15
|
+
console.log("[voltx] Build not yet implemented \u2014 coming in Phase 2");
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case "start": {
|
|
19
|
+
console.log("[voltx] Starting production server...");
|
|
20
|
+
console.log("[voltx] Start not yet implemented \u2014 coming in Phase 2");
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
default: {
|
|
24
|
+
console.log(`
|
|
25
|
+
voltx \u2014 The AI-first full-stack framework
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
voltx dev Start the development server
|
|
29
|
+
voltx build Build for production
|
|
30
|
+
voltx start Start the production server
|
|
31
|
+
|
|
32
|
+
To create a new project:
|
|
33
|
+
create-voltx-app <project-name>
|
|
34
|
+
`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
main().catch((err) => {
|
|
39
|
+
console.error("[voltx] Fatal error:", err);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface CreateProjectOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
template?: "chatbot" | "rag-app" | "agent-app" | "blank";
|
|
5
|
+
}
|
|
6
|
+
declare function createProject(options: CreateProjectOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
export { type CreateProjectOptions, createProject };
|
package/dist/create.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface CreateProjectOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
template?: "chatbot" | "rag-app" | "agent-app" | "blank";
|
|
5
|
+
}
|
|
6
|
+
declare function createProject(options: CreateProjectOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
export { type CreateProjectOptions, createProject };
|
package/dist/create.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/create.ts
|
|
32
|
+
var create_exports = {};
|
|
33
|
+
__export(create_exports, {
|
|
34
|
+
createProject: () => createProject
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(create_exports);
|
|
37
|
+
var fs = __toESM(require("fs"));
|
|
38
|
+
var path = __toESM(require("path"));
|
|
39
|
+
|
|
40
|
+
// src/welcome.ts
|
|
41
|
+
var ESC = "\x1B[";
|
|
42
|
+
var RESET = `${ESC}0m`;
|
|
43
|
+
var ITALIC = `${ESC}3m`;
|
|
44
|
+
function rgb(r, g, b, text) {
|
|
45
|
+
return `${ESC}38;2;${r};${g};${b}m${text}${RESET}`;
|
|
46
|
+
}
|
|
47
|
+
function lerp(a, b, t) {
|
|
48
|
+
return Math.round(a + (b - a) * t);
|
|
49
|
+
}
|
|
50
|
+
function gradientLine(text, from, to) {
|
|
51
|
+
const len = text.length;
|
|
52
|
+
if (len === 0) return "";
|
|
53
|
+
return text.split("").map((char, i) => {
|
|
54
|
+
const t = len === 1 ? 0 : i / (len - 1);
|
|
55
|
+
const r = lerp(from.r, to.r, t);
|
|
56
|
+
const g = lerp(from.g, to.g, t);
|
|
57
|
+
const b = lerp(from.b, to.b, t);
|
|
58
|
+
return rgb(r, g, b, char);
|
|
59
|
+
}).join("");
|
|
60
|
+
}
|
|
61
|
+
function gradientBlock(lines, colors) {
|
|
62
|
+
return lines.map((line, i) => {
|
|
63
|
+
const t = lines.length === 1 ? 0 : i / (lines.length - 1);
|
|
64
|
+
const segIndex = t * (colors.length - 1);
|
|
65
|
+
const fromIdx = Math.floor(segIndex);
|
|
66
|
+
const toIdx = Math.min(fromIdx + 1, colors.length - 1);
|
|
67
|
+
const localT = segIndex - fromIdx;
|
|
68
|
+
const from = {
|
|
69
|
+
r: lerp(colors[fromIdx].r, colors[toIdx].r, localT),
|
|
70
|
+
g: lerp(colors[fromIdx].g, colors[toIdx].g, localT),
|
|
71
|
+
b: lerp(colors[fromIdx].b, colors[toIdx].b, localT)
|
|
72
|
+
};
|
|
73
|
+
const to = {
|
|
74
|
+
r: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].r, colors[Math.min(toIdx + 1, colors.length - 1)].r, localT),
|
|
75
|
+
g: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].g, colors[Math.min(toIdx + 1, colors.length - 1)].g, localT),
|
|
76
|
+
b: lerp(colors[Math.min(fromIdx + 1, colors.length - 1)].b, colors[Math.min(toIdx + 1, colors.length - 1)].b, localT)
|
|
77
|
+
};
|
|
78
|
+
return gradientLine(line, from, to);
|
|
79
|
+
}).join("\n");
|
|
80
|
+
}
|
|
81
|
+
var VOLTX_BANNER = [
|
|
82
|
+
" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
|
|
83
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D",
|
|
84
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D ",
|
|
85
|
+
" \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 ",
|
|
86
|
+
" \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u255D \u2588\u2588\u2557",
|
|
87
|
+
" \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"
|
|
88
|
+
];
|
|
89
|
+
var VOLTX_COLORS = [
|
|
90
|
+
{ r: 0, g: 180, b: 255 },
|
|
91
|
+
// electric blue
|
|
92
|
+
{ r: 120, g: 80, b: 255 },
|
|
93
|
+
// purple
|
|
94
|
+
{ r: 255, g: 50, b: 180 },
|
|
95
|
+
// hot pink
|
|
96
|
+
{ r: 255, g: 120, b: 50 }
|
|
97
|
+
// orange
|
|
98
|
+
];
|
|
99
|
+
function dimRule(width = 48) {
|
|
100
|
+
return ` ${rgb(60, 60, 80, "\u2500".repeat(width))}`;
|
|
101
|
+
}
|
|
102
|
+
function printWelcomeBanner(projectName) {
|
|
103
|
+
console.log("");
|
|
104
|
+
console.log(gradientBlock(VOLTX_BANNER, VOLTX_COLORS));
|
|
105
|
+
console.log("");
|
|
106
|
+
console.log(
|
|
107
|
+
` ${ITALIC}${rgb(180, 180, 220, "The AI-first full-stack framework")}${RESET}`
|
|
108
|
+
);
|
|
109
|
+
console.log("");
|
|
110
|
+
if (projectName) {
|
|
111
|
+
console.log(
|
|
112
|
+
` ${ITALIC}${rgb(120, 220, 180, `Thank you for choosing VoltX! \u26A1`)}${RESET}`
|
|
113
|
+
);
|
|
114
|
+
console.log(
|
|
115
|
+
` ${ITALIC}${rgb(160, 160, 200, `Your project "${projectName}" is ready to go.`)}${RESET}`
|
|
116
|
+
);
|
|
117
|
+
console.log("");
|
|
118
|
+
console.log(` ${rgb(100, 180, 255, "Next steps:")}`);
|
|
119
|
+
console.log(` ${rgb(200, 200, 220, ` cd ${projectName}`)}`);
|
|
120
|
+
console.log(` ${rgb(200, 200, 220, " pnpm install")}`);
|
|
121
|
+
console.log(` ${rgb(200, 200, 220, " pnpm dev")}`);
|
|
122
|
+
console.log("");
|
|
123
|
+
console.log(dimRule());
|
|
124
|
+
console.log("");
|
|
125
|
+
console.log(
|
|
126
|
+
` ${rgb(255, 200, 80, "\u2615")} ${ITALIC}${rgb(200, 180, 140, "Love VoltX? Support us and fuel the next update:")}${RESET}`
|
|
127
|
+
);
|
|
128
|
+
console.log(
|
|
129
|
+
` ${rgb(255, 180, 100, "https://buymeacoffee.com/promptlyai")}`
|
|
130
|
+
);
|
|
131
|
+
console.log("");
|
|
132
|
+
console.log(dimRule());
|
|
133
|
+
console.log("");
|
|
134
|
+
console.log(
|
|
135
|
+
` ${ITALIC}${rgb(140, 140, 170, "Docs: https://voltx.co.in \u2022 GitHub: github.com/codewithshail/voltx")}${RESET}`
|
|
136
|
+
);
|
|
137
|
+
console.log(
|
|
138
|
+
` ${ITALIC}${rgb(100, 100, 130, "Made with \u2665 by the Promptly AI Team")}${RESET}`
|
|
139
|
+
);
|
|
140
|
+
console.log("");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/create.ts
|
|
145
|
+
async function createProject(options) {
|
|
146
|
+
const { name, template = "blank" } = options;
|
|
147
|
+
const targetDir = path.resolve(process.cwd(), name);
|
|
148
|
+
if (fs.existsSync(targetDir)) {
|
|
149
|
+
console.error(`[voltx] Directory "${name}" already exists.`);
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
153
|
+
const templateDeps = {
|
|
154
|
+
blank: { "@voltx/core": "^0.1.0" },
|
|
155
|
+
chatbot: {
|
|
156
|
+
"@voltx/core": "^0.1.0",
|
|
157
|
+
"@voltx/agents": "^0.1.0",
|
|
158
|
+
"@voltx/memory": "^0.1.0",
|
|
159
|
+
"@voltx/ui": "^0.1.0"
|
|
160
|
+
},
|
|
161
|
+
"rag-app": {
|
|
162
|
+
"@voltx/core": "^0.1.0",
|
|
163
|
+
"@voltx/rag": "^0.1.0",
|
|
164
|
+
"@voltx/db": "^0.1.0",
|
|
165
|
+
"@voltx/ui": "^0.1.0"
|
|
166
|
+
},
|
|
167
|
+
"agent-app": {
|
|
168
|
+
"@voltx/core": "^0.1.0",
|
|
169
|
+
"@voltx/agents": "^0.1.0",
|
|
170
|
+
"@voltx/memory": "^0.1.0",
|
|
171
|
+
"@voltx/rag": "^0.1.0",
|
|
172
|
+
"@voltx/db": "^0.1.0",
|
|
173
|
+
"@voltx/ui": "^0.1.0"
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const packageJson = {
|
|
177
|
+
name,
|
|
178
|
+
version: "0.1.0",
|
|
179
|
+
private: true,
|
|
180
|
+
scripts: {
|
|
181
|
+
dev: "voltx dev",
|
|
182
|
+
build: "voltx build",
|
|
183
|
+
start: "voltx start"
|
|
184
|
+
},
|
|
185
|
+
dependencies: templateDeps[template] ?? templateDeps["blank"]
|
|
186
|
+
};
|
|
187
|
+
fs.writeFileSync(
|
|
188
|
+
path.join(targetDir, "package.json"),
|
|
189
|
+
JSON.stringify(packageJson, null, 2)
|
|
190
|
+
);
|
|
191
|
+
const configContent = `import { defineConfig } from "@voltx/core";
|
|
192
|
+
|
|
193
|
+
export default defineConfig({
|
|
194
|
+
name: "${name}",
|
|
195
|
+
port: 3000,
|
|
196
|
+
ai: {
|
|
197
|
+
provider: "openai",
|
|
198
|
+
model: "gpt-4o",
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
`;
|
|
202
|
+
fs.writeFileSync(path.join(targetDir, "voltx.config.ts"), configContent);
|
|
203
|
+
fs.mkdirSync(path.join(targetDir, "src", "routes"), { recursive: true });
|
|
204
|
+
fs.mkdirSync(path.join(targetDir, "src", "agents"), { recursive: true });
|
|
205
|
+
const indexContent = `import { createApp } from "@voltx/core";
|
|
206
|
+
import config from "../voltx.config";
|
|
207
|
+
|
|
208
|
+
const app = createApp(config);
|
|
209
|
+
app.start();
|
|
210
|
+
`;
|
|
211
|
+
fs.writeFileSync(path.join(targetDir, "src", "index.ts"), indexContent);
|
|
212
|
+
fs.writeFileSync(
|
|
213
|
+
path.join(targetDir, ".env.example"),
|
|
214
|
+
"OPENAI_API_KEY=your-key-here\nDATABASE_URL=\n"
|
|
215
|
+
);
|
|
216
|
+
printWelcomeBanner(name);
|
|
217
|
+
}
|
|
218
|
+
if (require.main === module) {
|
|
219
|
+
const projectName = process.argv[2];
|
|
220
|
+
if (!projectName) {
|
|
221
|
+
console.log("Usage: create-voltx-app <project-name> [--template chatbot]");
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
const templateFlag = process.argv.indexOf("--template");
|
|
225
|
+
const template = templateFlag !== -1 ? process.argv[templateFlag + 1] : "blank";
|
|
226
|
+
createProject({ name: projectName, template }).catch((err) => {
|
|
227
|
+
console.error("[voltx] Error:", err);
|
|
228
|
+
process.exit(1);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
232
|
+
0 && (module.exports = {
|
|
233
|
+
createProject
|
|
234
|
+
});
|
package/dist/create.mjs
ADDED
package/dist/index.d.mts
ADDED