From 2366bcdcadbdf766dc17990368e65c61007f28a6 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:58:41 +0530 Subject: [PATCH 1/8] Create index.js --- celtix-cli/bin/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 celtix-cli/bin/index.js diff --git a/celtix-cli/bin/index.js b/celtix-cli/bin/index.js new file mode 100644 index 0000000..05b791b --- /dev/null +++ b/celtix-cli/bin/index.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +const { program } = require('commander'); +const createCommand = require('../commands/create'); + +// Define the main program +program + .version('1.0.0') + .description('A CLI tool for creating project structures'); + +// Define the 'create' command +program + .command('create ') + .description('Create a new project from a template') + .action(createCommand); + +// Parse the arguments from the command line +program.parse(process.argv); From f057c78921512b51857089da86e61a0908bd8b44 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:00:39 +0530 Subject: [PATCH 2/8] Create create.js --- celtix-cli/commands/create.js | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 celtix-cli/commands/create.js diff --git a/celtix-cli/commands/create.js b/celtix-cli/commands/create.js new file mode 100644 index 0000000..5d51194 --- /dev/null +++ b/celtix-cli/commands/create.js @@ -0,0 +1,51 @@ +const fs = require('fs-extra'); +const path = require('path'); +const chalk = require('chalk'); +const inquirer = require('inquirer'); + +async function createProject(projectName) { + const targetDir = path.join(process.cwd(), projectName); + + // Check if the directory already exists + if (fs.existsSync(targetDir)) { + const { overwrite } = await inquirer.prompt([ + { + type: 'confirm', + name: 'overwrite', + message: chalk.yellow(`Directory "${projectName}" already exists. Overwrite?`), + default: false, + }, + ]); + + if (!overwrite) { + console.log(chalk.red('Operation cancelled.')); + return; + } + console.log(chalk.yellow(`Overwriting directory: ${targetDir}...`)); + await fs.remove(targetDir); + } + + // Create the project directory + await fs.mkdir(targetDir); + + // Define the source of the template + const templateDir = path.join(__dirname, '..', 'templates', 'default-backend'); + + try { + // Copy the template files to the new project directory + await fs.copy(templateDir, targetDir); + + console.log(chalk.green('\n✅ Project created successfully!')); + console.log(chalk.cyan('Next steps:')); + console.log(chalk.gray(` 1. cd ${projectName}`)); + console.log(chalk.gray(' 2. npm install')); + console.log(chalk.gray(' 3. cp .env.example .env (and edit it)')); + console.log(chalk.gray(' 4. npm start\n')); + } catch (error) { + console.error(chalk.red('Error creating project:', error)); + // Clean up created directory on failure + await fs.remove(targetDir); + } +} + +module.exports = createProject; From c8db6dcd59728452d968ada82ca430a7f5bfdbb8 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:06:48 +0530 Subject: [PATCH 3/8] Create index,js --- .../templates/ default-backend/src/index,js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 celtix-cli/commands/templates/ default-backend/src/index,js diff --git a/celtix-cli/commands/templates/ default-backend/src/index,js b/celtix-cli/commands/templates/ default-backend/src/index,js new file mode 100644 index 0000000..3221208 --- /dev/null +++ b/celtix-cli/commands/templates/ default-backend/src/index,js @@ -0,0 +1,13 @@ +require('dotenv').config(); +const express = require('express'); + +const app = express(); +const PORT = process.env.PORT || 3000; + +app.get('/', (req, res) => { + res.send(process.env.MESSAGE || 'Hello, World!'); +}); + +app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); +}); From 40249e40f7c9dbdbda15e118e2c1b7f41cfc507a Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:14:35 +0530 Subject: [PATCH 4/8] Create .env.example --- celtix-cli/commands/templates/ default-backend/.env.example | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 celtix-cli/commands/templates/ default-backend/.env.example diff --git a/celtix-cli/commands/templates/ default-backend/.env.example b/celtix-cli/commands/templates/ default-backend/.env.example new file mode 100644 index 0000000..79792d3 --- /dev/null +++ b/celtix-cli/commands/templates/ default-backend/.env.example @@ -0,0 +1,2 @@ +PORT=8080 +MESSAGE="Hello from Celtrix!" From 401bb2164693553b584bcd2b93395ba1e41f1df3 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:18:17 +0530 Subject: [PATCH 5/8] Create package.json --- celtix-cli/package.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 celtix-cli/package.json diff --git a/celtix-cli/package.json b/celtix-cli/package.json new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/celtix-cli/package.json @@ -0,0 +1 @@ + From 9e7141e9a30a0b75688c43586b549abe960ac588 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:22:49 +0530 Subject: [PATCH 6/8] Create package.json --- .../templates/ default-backend/package.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 celtix-cli/commands/templates/ default-backend/package.json diff --git a/celtix-cli/commands/templates/ default-backend/package.json b/celtix-cli/commands/templates/ default-backend/package.json new file mode 100644 index 0000000..aaf0e6d --- /dev/null +++ b/celtix-cli/commands/templates/ default-backend/package.json @@ -0,0 +1,13 @@ +{ + "name": "new-celtrix-app", + "version": "1.0.0", + "description": "A backend project generated by Celtrix CLI.", + "main": "src/index.js", + "scripts": { + "start": "node src/index.js" + }, + "dependencies": { + "express": "^4.19.2", + "dotenv": "^16.4.5" + } +} From 0d34448e895e1006032033b0cafdf296a16a18db Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 14:29:47 +0530 Subject: [PATCH 7/8] Update package.json --- package.json | 71 +++++++++++++--------------------------------------- 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index 9c73600..482ad24 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,25 @@ -{ - "name": "celtrix", - "version": "2.0.4", - "description": "CLI to create MERN apps quickly", - "type": "module", - "main": "./bin/celtrix.js", + + { + "name": "celtrix-cli", + "version": "1.0.0", + "description": "A CLI tool to scaffold new projects.", + "main": "index.js", "bin": { - "celtrix": "./bin/celtrix.js" + "celtrix": "bin/index.js" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" }, - "files": [ - "bin/", - "index.js", - "commands/", - "utils/", - "templates/" - ], "keywords": [ - "mern", "cli", - "react", - "express", - "mongodb", - "fullstack" + "scaffolding" ], - "author": "Joe Celaster", - "license": "ISC", + "author": "Your Name", + "license": "MIT", "dependencies": { - "@octokit/rest": "^22.0.0", - "@pinecone-database/pinecone": "^6.1.2", - "boxen": "^8.0.1", - "chalk": "^5.6.0", - "dotenv": "^17.2.3", - "express": "^5.1.0", - "figlet": "^1.8.2", - "fs-extra": "^11.3.1", - "gradient-string": "^3.0.0", - "inquirer": "^12.9.4", - "log-symbols": "^7.0.1", - "node-fetch": "^3.3.2", - "ora": "^8.2.0" - }, - "scripts": { - "release:patch": "npm version patch && npm publish --access public", - "release:minor": "npm version minor && npm publish --access public", - "release:major": "npm version major && npm publish --access public", - "validate": "node scripts/validate-apis.js", - "validate:pinecone": "node scripts/validate-apis.js pinecone", - "validate:github": "node scripts/validate-apis.js github", - "validate:gemini": "node scripts/validate-apis.js gemini", - "populate-issues": "node scripts/populate-existing-issues.js", - "cleanup-issue": "node scripts/cleanup-closed-issue.js", - "cleanup-specific": "node scripts/cleanup-specific-issue.js", - "cleanup-duplicates": "node scripts/cleanup-duplicates.js --force", - "debug-db": "node scripts/debug-pinecone.js", - "clear-all": "echo '⚠️ Use: npm run clear-all:force' && exit 1", - "clear-all:force": "node scripts/clear-all-vectors.js --force", - "check-duplicates": "node scripts/check-duplicates.js" - }, - "devDependencies": { - "typescript": "^5.9.3" + "chalk": "^4.1.2", + "commander": "^12.1.0", + "fs-extra": "^11.2.0", + "inquirer": "^8.2.4" } } From 1e9a1483a8d450c12127fd07d2269556abb62601 Mon Sep 17 00:00:00 2001 From: Raunak1375 <141954413+Raunak1375@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:33:41 +0530 Subject: [PATCH 8/8] Update index.js --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index e04659a..4534c6c 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +//raunak import inquirer from "inquirer"; import chalk from "chalk"; import gradient from "gradient-string";