@voltx/cli 0.1.0 → 0.1.1

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