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