@orion-js/core 4.0.3 → 4.0.4

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.cjs CHANGED
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
 
25
25
  // src/index.ts
26
- var import_chalk11 = __toESM(require("chalk"), 1);
26
+ var import_chalk13 = __toESM(require("chalk"), 1);
27
27
  var import_commander = require("commander");
28
28
 
29
29
  // src/helpers/execute.ts
@@ -82,7 +82,7 @@ async function writeFile_default(path7, content) {
82
82
  var import_node_child_process2 = require("child_process");
83
83
 
84
84
  // src/dev/runner/getArgs.ts
85
- function getArgs(options) {
85
+ function getArgs(options, command) {
86
86
  let startCommand = process.env.START_COMMAND || "tsx";
87
87
  const args = [];
88
88
  if (process.env.START_COMMAND) {
@@ -93,13 +93,14 @@ function getArgs(options) {
93
93
  } else if (options.shell) {
94
94
  args.push("--inspect");
95
95
  }
96
+ args.push(...command.args);
96
97
  args.push("./app/index.ts");
97
98
  return { startCommand, args };
98
99
  }
99
100
 
100
101
  // src/dev/runner/startProcess.ts
101
- function startProcess(options) {
102
- const { startCommand, args } = getArgs(options);
102
+ function startProcess(options, command) {
103
+ const { startCommand, args } = getArgs(options, command);
103
104
  return (0, import_node_child_process2.spawn)(startCommand, args, {
104
105
  env: {
105
106
  ORION_DEV: "local",
@@ -112,14 +113,14 @@ function startProcess(options) {
112
113
  }
113
114
 
114
115
  // src/dev/runner/index.ts
115
- function getRunner(options) {
116
+ function getRunner(options, command) {
116
117
  let appProcess = null;
117
118
  if (options.clean) {
118
119
  console.log(import_chalk.default.bold("=> Cleaning directory...\n"));
119
120
  }
120
121
  const start = () => {
121
122
  console.log(import_chalk.default.bold("=> Starting app...\n"));
122
- appProcess = startProcess(options);
123
+ appProcess = startProcess(options, command);
123
124
  appProcess.on("exit", (code, signal) => {
124
125
  if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
125
126
  } else {
@@ -476,7 +477,7 @@ async function copyMCP() {
476
477
 
477
478
  // src/dev/index.ts
478
479
  var import_chalk7 = __toESM(require("chalk"), 1);
479
- async function dev_default(options) {
480
+ async function dev_default(options, command) {
480
481
  console.log(import_chalk7.default.bold(`
481
482
  Orionjs App ${import_chalk7.default.green(import_chalk7.default.bold("V4"))} Dev mode
482
483
  `));
@@ -489,7 +490,7 @@ Orionjs App ${import_chalk7.default.green(import_chalk7.default.bold("V4"))} Dev
489
490
  if (!options.omitMcpServer && !options.omitCursorRule) {
490
491
  console.log(import_chalk7.default.bold("=> \u2728 Orionjs AI is ready\n"));
491
492
  }
492
- const runner = getRunner(options);
493
+ const runner = getRunner(options, command);
493
494
  watchAndCompile(runner);
494
495
  }
495
496
 
@@ -498,8 +499,9 @@ var import_chalk9 = __toESM(require("chalk"), 1);
498
499
 
499
500
  // src/prod/runProd.ts
500
501
  var import_node_child_process3 = require("child_process");
501
- function runProd() {
502
- (0, import_node_child_process3.spawn)("tsx", ["./app/index.ts"], {
502
+ function runProd(command) {
503
+ const args = [...command.args, "./app/index.ts"];
504
+ (0, import_node_child_process3.spawn)("tsx", args, {
503
505
  env: {
504
506
  NODE_ENV: "production",
505
507
  ...process.env
@@ -533,12 +535,12 @@ function checkTs() {
533
535
  }
534
536
 
535
537
  // src/prod/index.ts
536
- async function prod_default() {
538
+ async function prod_default(_, command) {
537
539
  console.log(import_chalk9.default.bold(`
538
540
  Orionjs App ${import_chalk9.default.green(import_chalk9.default.bold("V4"))} Prod mode
539
541
  `));
540
542
  checkTs();
541
- runProd();
543
+ runProd(command);
542
544
  }
543
545
 
544
546
  // src/handleErrors.ts
@@ -560,16 +562,51 @@ var version_default = "3.0";
560
562
 
561
563
  // src/index.ts
562
564
  var import_config = require("dotenv/config");
565
+
566
+ // src/check/index.ts
567
+ var import_chalk12 = __toESM(require("chalk"), 1);
568
+
569
+ // src/check/checkTs.ts
570
+ var import_chalk11 = __toESM(require("chalk"), 1);
571
+ var import_node_child_process5 = require("child_process");
572
+ function checkTs2() {
573
+ try {
574
+ (0, import_node_child_process5.execSync)("tsc --noEmit", {
575
+ cwd: process.cwd(),
576
+ env: {
577
+ ...process.env
578
+ },
579
+ gid: process.getgid(),
580
+ uid: process.getuid(),
581
+ stdio: "inherit"
582
+ });
583
+ } catch {
584
+ console.log(import_chalk11.default.red.bold("TypeScript compilation failed"));
585
+ process.exit(1);
586
+ }
587
+ }
588
+
589
+ // src/check/index.ts
590
+ async function check_default() {
591
+ console.log(import_chalk12.default.bold(`Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))}
592
+ `));
593
+ console.log("Checking typescript...");
594
+ checkTs2();
595
+ console.log(import_chalk12.default.bold.green("Check passed\n"));
596
+ }
597
+
598
+ // src/index.ts
563
599
  var program = new import_commander.Command();
564
600
  var run = (action) => async (...args) => {
565
601
  try {
566
602
  await action(...args);
567
603
  } catch (e) {
568
- console.error(import_chalk11.default.red(`Error: ${e.message}`));
604
+ console.error(import_chalk13.default.red(`Error: ${e.message}`));
569
605
  }
570
606
  };
571
- program.command("dev").description("Run the Orionjs app in development mode").option("--shell", "Opens a shell in Chrome developer tools").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").action(run(dev_default));
572
- program.command("prod").description("Run the Orionjs app in production mode").action(run(prod_default));
607
+ program.command("dev").description("Run the Orionjs app in development mode").option("--shell", "Opens a shell in Chrome developer tools").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").allowUnknownOption().action(run(dev_default));
608
+ program.command("check").description("Runs a typescript check").action(run(check_default));
609
+ program.command("prod").allowUnknownOption().description("Run the Orionjs app in production mode").action(run(prod_default));
573
610
  program.command("create").description("Creates a new Orionjs project").option("--name [name]", "Name of the project").option("--kit [kit]", "Which starter kit to use").action(run(create_default));
574
611
  program.version(version_default, "-v --version");
575
612
  program.parse(process.argv);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/watchDeletes.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyCursorRule/index.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/prod/checkTs.ts","../src/handleErrors.ts","../src/version.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--shell', 'Opens a shell in Chrome developer tools')\n .option('--omit-cursor-rule', 'Omit the creation of the Orionjs Cursor rule')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .action(run(dev))\n\nprogram.command('prod').description('Run the Orionjs app in production mode').action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // option to omit the creation of the orion cursor rule\n omitCursorRule?: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const start = () => {\n console.log(chalk.bold('=> Starting app...\\n'))\n appProcess = startProcess(options)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n }\n }\n\n const restart = () => {\n stop()\n start()\n }\n\n return {\n restart,\n stop,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions) {\n const {startCommand, args} = getArgs(options)\n\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(options: RunnerOptions) {\n let startCommand = process.env.START_COMMAND || 'tsx'\n\n const args = []\n\n if (process.env.START_COMMAND) {\n const [first, ...otherArgs] = process.env.START_COMMAND.split(' ')\n startCommand = first\n args.push(...otherArgs)\n\n console.log(`Using custom command: ${[startCommand, ...args].join(' ')}`)\n } else if (options.shell) {\n args.push('--inspect')\n }\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchDeletes} from './watchDeletes'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchDeletes()\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory() {\n try {\n const dirPath = path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n\n if (diagnostic.code === 6032 || diagnostic.code === 6031) {\n runner.stop()\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n return\n }\n }\n\n runner.restart()\n }\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport chokidar from 'chokidar'\n\nexport async function watchDeletes() {\n const projectPath = path.resolve('./app')\n const watcher = chokidar.watch(projectPath, {\n ignoreInitial: true,\n })\n\n watcher.on('unlink', async filepath => {\n if (!filepath.endsWith('.ts')) return\n\n const relative = path.relative(process.cwd(), filepath)\n const atBuildPath = path.resolve('.orion/build', relative.replace(/.ts$/, ''))\n try {\n fs.unlinkSync(`${atBuildPath}.js`)\n fs.unlinkSync(`${atBuildPath}.d.ts`)\n } catch (error) {\n console.log(\n `Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`,\n )\n }\n })\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport https from 'node:https'\nimport path from 'node:path'\nimport chalk from 'chalk'\n\nconst rules = [\n 'orionjs.mdx',\n 'orionjs-component.mdx',\n 'orionjs-repository.mdx',\n 'orionjs-schema.mdx',\n 'orionjs-services.mdx',\n 'orionjs-resolvers.mdx',\n 'orionjs-tov4.mdx',\n]\n\n// Function to download the file content\nconst downloadFile = (url: string): Promise<string> => {\n return new Promise((resolve, reject) => {\n https.get(url, response => {\n if (response.statusCode !== 200) {\n reject(new Error(`Failed to download, status code: ${response.statusCode}`))\n return\n }\n\n let data = ''\n response.on('data', chunk => {\n data += chunk\n })\n response.on('end', () => {\n resolve(data)\n })\n response.on('error', err => {\n reject(err)\n })\n })\n })\n}\n\nexport async function copyCursorRule() {\n const baseUrl = 'https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc'\n\n try {\n // Create target directory if it doesn't exist\n const targetDir = path.join(process.cwd(), '.cursor', 'rules')\n await fs.mkdir(targetDir, {recursive: true})\n\n // Process each rule file\n await Promise.all(\n rules.map(async rule => {\n // Change extension from .mdx to .mdc\n const targetFileName = rule.replace('.mdx', '.mdc')\n const targetFile = path.join(targetDir, targetFileName)\n\n // Construct source URL\n const sourceUrl = `${baseUrl}/${rule}`\n\n // console.log(chalk.gray(`=> ✨ Downloading ${chalk.cyan(rule)} to ${chalk.cyan(targetFileName)}...`))\n\n // Download the file content\n const content = await downloadFile(sourceUrl)\n\n // Write the content to the target file\n await fs.writeFile(targetFile, content, 'utf8')\n\n console.log(chalk.bold(`=> ✨ Successfully downloaded ${chalk.cyan(targetFileName)}`))\n }),\n )\n\n console.log(chalk.bold('=> ✨ All rule files have been successfully copied'))\n } catch (error) {\n console.error(chalk.red(`Error copying rule files: ${error.message}`))\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyCursorRule} from './copyCursorRule'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitCursorRule) {\n await copyCursorRule().catch(console.error)\n }\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n }\n\n if (!options.omitMcpServer && !options.omitCursorRule) {\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport {checkTs} from './checkTs'\nexport default async function () {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n checkTs()\n runProd()\n}\n","import {spawn} from 'node:child_process'\n\nexport function runProd() {\n spawn('tsx', ['./app/index.ts'], {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaugh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EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","import_node_fs","path","fs","path","fs","import_node_child_process","chalk","import_typescript","import_node_fs","import_node_path","fs","path","import_typescript","import_node_fs","fs","ts","import_typescript","ts","import_chalk","chalk","ts","import_node_fs","import_node_path","path","chokidar","fs","import_chalk","import_chokidar","chokidar","chalk","ts","import_node_path","import_chalk","https","path","fs","chalk","import_promises","import_node_path","import_chalk","import_promises","import_node_path","import_chalk","fs","path","chalk","path","fs","chalk","import_chalk","chalk","import_chalk","import_node_child_process","import_chalk","import_node_child_process","chalk","chalk","import_chalk","chalk","chalk"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/watchDeletes.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyCursorRule/index.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/prod/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport check from './check'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--shell', 'Opens a shell in Chrome developer tools')\n .option('--omit-cursor-rule', 'Omit the creation of the Orionjs Cursor rule')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // option to omit the creation of the orion cursor rule\n omitCursorRule?: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const start = () => {\n console.log(chalk.bold('=> Starting app...\\n'))\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n }\n }\n\n const restart = () => {\n stop()\n start()\n }\n\n return {\n restart,\n stop,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n let startCommand = process.env.START_COMMAND || 'tsx'\n\n const args = []\n\n if (process.env.START_COMMAND) {\n const [first, ...otherArgs] = process.env.START_COMMAND.split(' ')\n startCommand = first\n args.push(...otherArgs)\n\n console.log(`Using custom command: ${[startCommand, ...args].join(' ')}`)\n } else if (options.shell) {\n args.push('--inspect')\n }\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchDeletes} from './watchDeletes'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchDeletes()\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory() {\n try {\n const dirPath = path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n\n if (diagnostic.code === 6032 || diagnostic.code === 6031) {\n runner.stop()\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n return\n }\n }\n\n runner.restart()\n }\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport chokidar from 'chokidar'\n\nexport async function watchDeletes() {\n const projectPath = path.resolve('./app')\n const watcher = chokidar.watch(projectPath, {\n ignoreInitial: true,\n })\n\n watcher.on('unlink', async filepath => {\n if (!filepath.endsWith('.ts')) return\n\n const relative = path.relative(process.cwd(), filepath)\n const atBuildPath = path.resolve('.orion/build', relative.replace(/.ts$/, ''))\n try {\n fs.unlinkSync(`${atBuildPath}.js`)\n fs.unlinkSync(`${atBuildPath}.d.ts`)\n } catch (error) {\n console.log(\n `Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`,\n )\n }\n })\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport https from 'node:https'\nimport path from 'node:path'\nimport chalk from 'chalk'\n\nconst rules = [\n 'orionjs.mdx',\n 'orionjs-component.mdx',\n 'orionjs-repository.mdx',\n 'orionjs-schema.mdx',\n 'orionjs-services.mdx',\n 'orionjs-resolvers.mdx',\n 'orionjs-tov4.mdx',\n]\n\n// Function to download the file content\nconst downloadFile = (url: string): Promise<string> => {\n return new Promise((resolve, reject) => {\n https.get(url, response => {\n if (response.statusCode !== 200) {\n reject(new Error(`Failed to download, status code: ${response.statusCode}`))\n return\n }\n\n let data = ''\n response.on('data', chunk => {\n data += chunk\n })\n response.on('end', () => {\n resolve(data)\n })\n response.on('error', err => {\n reject(err)\n })\n })\n })\n}\n\nexport async function copyCursorRule() {\n const baseUrl = 'https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc'\n\n try {\n // Create target directory if it doesn't exist\n const targetDir = path.join(process.cwd(), '.cursor', 'rules')\n await fs.mkdir(targetDir, {recursive: true})\n\n // Process each rule file\n await Promise.all(\n rules.map(async rule => {\n // Change extension from .mdx to .mdc\n const targetFileName = rule.replace('.mdx', '.mdc')\n const targetFile = path.join(targetDir, targetFileName)\n\n // Construct source URL\n const sourceUrl = `${baseUrl}/${rule}`\n\n // console.log(chalk.gray(`=> ✨ Downloading ${chalk.cyan(rule)} to ${chalk.cyan(targetFileName)}...`))\n\n // Download the file content\n const content = await downloadFile(sourceUrl)\n\n // Write the content to the target file\n await fs.writeFile(targetFile, content, 'utf8')\n\n console.log(chalk.bold(`=> ✨ Successfully downloaded ${chalk.cyan(targetFileName)}`))\n }),\n )\n\n console.log(chalk.bold('=> ✨ All rule files have been successfully copied'))\n } catch (error) {\n console.error(chalk.red(`Error copying rule files: ${error.message}`))\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyCursorRule} from './copyCursorRule'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitCursorRule) {\n await copyCursorRule().catch(console.error)\n }\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n }\n\n if (!options.omitMcpServer && !options.omitCursorRule) {\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport {checkTs} from './checkTs'\n\nexport default async function (_, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n checkTs()\n runProd(command)\n}\n","import {spawn} from 'node:child_process'\n\nexport function runProd(command: any) {\n const args = [...command.args, './app/index.ts']\n spawn('tsx', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAkB;AAClB,uBAAsB;;;ACFtB,gCAAmB;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,wCAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,M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AAO,EAAE,CAAC;AAAA,EAChD;AACF;AAEF,QACG,QAAQ,KAAK,EACb,YAAY,yCAAyC,EACrD,OAAO,WAAW,yCAAyC,EAC3D,OAAO,sBAAsB,8CAA8C,EAC3E,OAAO,qBAAqB,6CAA6C,EACzE,mBAAmB,EACnB,OAAO,IAAI,WAAG,CAAC;AAElB,QAAQ,QAAQ,OAAO,EAAE,YAAY,yBAAyB,EAAE,OAAO,IAAI,aAAK,CAAC;AAEjF,QACG,QAAQ,MAAM,EACd,mBAAmB,EACnB,YAAY,wCAAwC,EACpD,OAAO,IAAI,YAAI,CAAC;AAEnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","import_node_fs","path","fs","path","fs","import_node_child_process","chalk","import_typescript","import_node_fs","import_node_path","fs","path","import_typescript","import_node_fs","fs","ts","import_typescript","ts","import_chalk","chalk","ts","import_node_fs","import_node_path","path","chokidar","fs","import_chalk","import_chokidar","chokidar","chalk","ts","import_node_path","import_chalk","https","path","fs","chalk","import_promises","import_node_path","import_chalk","import_promises","import_node_path","import_chalk","fs","path","chalk","path","fs","chalk","import_chalk","chalk","import_chalk","import_node_child_process","import_chalk","import_node_child_process","chalk","chalk","import_chalk","chalk","import_chalk","import_chalk","import_node_child_process","checkTs","chalk","chalk","checkTs","chalk"]}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import chalk11 from "chalk";
4
+ import chalk13 from "chalk";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // src/helpers/execute.ts
@@ -60,7 +60,7 @@ async function writeFile_default(path7, content) {
60
60
  import { spawn } from "child_process";
61
61
 
62
62
  // src/dev/runner/getArgs.ts
63
- function getArgs(options) {
63
+ function getArgs(options, command) {
64
64
  let startCommand = process.env.START_COMMAND || "tsx";
65
65
  const args = [];
66
66
  if (process.env.START_COMMAND) {
@@ -71,13 +71,14 @@ function getArgs(options) {
71
71
  } else if (options.shell) {
72
72
  args.push("--inspect");
73
73
  }
74
+ args.push(...command.args);
74
75
  args.push("./app/index.ts");
75
76
  return { startCommand, args };
76
77
  }
77
78
 
78
79
  // src/dev/runner/startProcess.ts
79
- function startProcess(options) {
80
- const { startCommand, args } = getArgs(options);
80
+ function startProcess(options, command) {
81
+ const { startCommand, args } = getArgs(options, command);
81
82
  return spawn(startCommand, args, {
82
83
  env: {
83
84
  ORION_DEV: "local",
@@ -90,14 +91,14 @@ function startProcess(options) {
90
91
  }
91
92
 
92
93
  // src/dev/runner/index.ts
93
- function getRunner(options) {
94
+ function getRunner(options, command) {
94
95
  let appProcess = null;
95
96
  if (options.clean) {
96
97
  console.log(chalk.bold("=> Cleaning directory...\n"));
97
98
  }
98
99
  const start = () => {
99
100
  console.log(chalk.bold("=> Starting app...\n"));
100
- appProcess = startProcess(options);
101
+ appProcess = startProcess(options, command);
101
102
  appProcess.on("exit", (code, signal) => {
102
103
  if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
103
104
  } else {
@@ -454,7 +455,7 @@ async function copyMCP() {
454
455
 
455
456
  // src/dev/index.ts
456
457
  import chalk7 from "chalk";
457
- async function dev_default(options) {
458
+ async function dev_default(options, command) {
458
459
  console.log(chalk7.bold(`
459
460
  Orionjs App ${chalk7.green(chalk7.bold("V4"))} Dev mode
460
461
  `));
@@ -467,7 +468,7 @@ Orionjs App ${chalk7.green(chalk7.bold("V4"))} Dev mode
467
468
  if (!options.omitMcpServer && !options.omitCursorRule) {
468
469
  console.log(chalk7.bold("=> \u2728 Orionjs AI is ready\n"));
469
470
  }
470
- const runner = getRunner(options);
471
+ const runner = getRunner(options, command);
471
472
  watchAndCompile(runner);
472
473
  }
473
474
 
@@ -476,8 +477,9 @@ import chalk9 from "chalk";
476
477
 
477
478
  // src/prod/runProd.ts
478
479
  import { spawn as spawn2 } from "child_process";
479
- function runProd() {
480
- spawn2("tsx", ["./app/index.ts"], {
480
+ function runProd(command) {
481
+ const args = [...command.args, "./app/index.ts"];
482
+ spawn2("tsx", args, {
481
483
  env: {
482
484
  NODE_ENV: "production",
483
485
  ...process.env
@@ -511,12 +513,12 @@ function checkTs() {
511
513
  }
512
514
 
513
515
  // src/prod/index.ts
514
- async function prod_default() {
516
+ async function prod_default(_, command) {
515
517
  console.log(chalk9.bold(`
516
518
  Orionjs App ${chalk9.green(chalk9.bold("V4"))} Prod mode
517
519
  `));
518
520
  checkTs();
519
- runProd();
521
+ runProd(command);
520
522
  }
521
523
 
522
524
  // src/handleErrors.ts
@@ -538,16 +540,51 @@ var version_default = "3.0";
538
540
 
539
541
  // src/index.ts
540
542
  import "dotenv/config";
543
+
544
+ // src/check/index.ts
545
+ import chalk12 from "chalk";
546
+
547
+ // src/check/checkTs.ts
548
+ import chalk11 from "chalk";
549
+ import { execSync as execSync2 } from "child_process";
550
+ function checkTs2() {
551
+ try {
552
+ execSync2("tsc --noEmit", {
553
+ cwd: process.cwd(),
554
+ env: {
555
+ ...process.env
556
+ },
557
+ gid: process.getgid(),
558
+ uid: process.getuid(),
559
+ stdio: "inherit"
560
+ });
561
+ } catch {
562
+ console.log(chalk11.red.bold("TypeScript compilation failed"));
563
+ process.exit(1);
564
+ }
565
+ }
566
+
567
+ // src/check/index.ts
568
+ async function check_default() {
569
+ console.log(chalk12.bold(`Orionjs App ${chalk12.green(chalk12.bold("V4"))}
570
+ `));
571
+ console.log("Checking typescript...");
572
+ checkTs2();
573
+ console.log(chalk12.bold.green("Check passed\n"));
574
+ }
575
+
576
+ // src/index.ts
541
577
  var program = new Command();
542
578
  var run = (action) => async (...args) => {
543
579
  try {
544
580
  await action(...args);
545
581
  } catch (e) {
546
- console.error(chalk11.red(`Error: ${e.message}`));
582
+ console.error(chalk13.red(`Error: ${e.message}`));
547
583
  }
548
584
  };
549
- program.command("dev").description("Run the Orionjs app in development mode").option("--shell", "Opens a shell in Chrome developer tools").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").action(run(dev_default));
550
- program.command("prod").description("Run the Orionjs app in production mode").action(run(prod_default));
585
+ program.command("dev").description("Run the Orionjs app in development mode").option("--shell", "Opens a shell in Chrome developer tools").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").allowUnknownOption().action(run(dev_default));
586
+ program.command("check").description("Runs a typescript check").action(run(check_default));
587
+ program.command("prod").allowUnknownOption().description("Run the Orionjs app in production mode").action(run(prod_default));
551
588
  program.command("create").description("Creates a new Orionjs project").option("--name [name]", "Name of the project").option("--kit [kit]", "Which starter kit to use").action(run(create_default));
552
589
  program.version(version_default, "-v --version");
553
590
  program.parse(process.argv);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/watchDeletes.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyCursorRule/index.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/prod/checkTs.ts","../src/handleErrors.ts","../src/version.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--shell', 'Opens a shell in Chrome developer tools')\n .option('--omit-cursor-rule', 'Omit the creation of the Orionjs Cursor rule')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .action(run(dev))\n\nprogram.command('prod').description('Run the Orionjs app in production mode').action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // option to omit the creation of the orion cursor rule\n omitCursorRule?: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const start = () => {\n console.log(chalk.bold('=> Starting app...\\n'))\n appProcess = startProcess(options)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n }\n }\n\n const restart = () => {\n stop()\n start()\n }\n\n return {\n restart,\n stop,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions) {\n const {startCommand, args} = getArgs(options)\n\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(options: RunnerOptions) {\n let startCommand = process.env.START_COMMAND || 'tsx'\n\n const args = []\n\n if (process.env.START_COMMAND) {\n const [first, ...otherArgs] = process.env.START_COMMAND.split(' ')\n startCommand = first\n args.push(...otherArgs)\n\n console.log(`Using custom command: ${[startCommand, ...args].join(' ')}`)\n } else if (options.shell) {\n args.push('--inspect')\n }\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchDeletes} from './watchDeletes'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchDeletes()\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory() {\n try {\n const dirPath = path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n\n if (diagnostic.code === 6032 || diagnostic.code === 6031) {\n runner.stop()\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n return\n }\n }\n\n runner.restart()\n }\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport chokidar from 'chokidar'\n\nexport async function watchDeletes() {\n const projectPath = path.resolve('./app')\n const watcher = chokidar.watch(projectPath, {\n ignoreInitial: true,\n })\n\n watcher.on('unlink', async filepath => {\n if (!filepath.endsWith('.ts')) return\n\n const relative = path.relative(process.cwd(), filepath)\n const atBuildPath = path.resolve('.orion/build', relative.replace(/.ts$/, ''))\n try {\n fs.unlinkSync(`${atBuildPath}.js`)\n fs.unlinkSync(`${atBuildPath}.d.ts`)\n } catch (error) {\n console.log(\n `Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`,\n )\n }\n })\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport https from 'node:https'\nimport path from 'node:path'\nimport chalk from 'chalk'\n\nconst rules = [\n 'orionjs.mdx',\n 'orionjs-component.mdx',\n 'orionjs-repository.mdx',\n 'orionjs-schema.mdx',\n 'orionjs-services.mdx',\n 'orionjs-resolvers.mdx',\n 'orionjs-tov4.mdx',\n]\n\n// Function to download the file content\nconst downloadFile = (url: string): Promise<string> => {\n return new Promise((resolve, reject) => {\n https.get(url, response => {\n if (response.statusCode !== 200) {\n reject(new Error(`Failed to download, status code: ${response.statusCode}`))\n return\n }\n\n let data = ''\n response.on('data', chunk => {\n data += chunk\n })\n response.on('end', () => {\n resolve(data)\n })\n response.on('error', err => {\n reject(err)\n })\n })\n })\n}\n\nexport async function copyCursorRule() {\n const baseUrl = 'https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc'\n\n try {\n // Create target directory if it doesn't exist\n const targetDir = path.join(process.cwd(), '.cursor', 'rules')\n await fs.mkdir(targetDir, {recursive: true})\n\n // Process each rule file\n await Promise.all(\n rules.map(async rule => {\n // Change extension from .mdx to .mdc\n const targetFileName = rule.replace('.mdx', '.mdc')\n const targetFile = path.join(targetDir, targetFileName)\n\n // Construct source URL\n const sourceUrl = `${baseUrl}/${rule}`\n\n // console.log(chalk.gray(`=> ✨ Downloading ${chalk.cyan(rule)} to ${chalk.cyan(targetFileName)}...`))\n\n // Download the file content\n const content = await downloadFile(sourceUrl)\n\n // Write the content to the target file\n await fs.writeFile(targetFile, content, 'utf8')\n\n console.log(chalk.bold(`=> ✨ Successfully downloaded ${chalk.cyan(targetFileName)}`))\n }),\n )\n\n console.log(chalk.bold('=> ✨ All rule files have been successfully copied'))\n } catch (error) {\n console.error(chalk.red(`Error copying rule files: ${error.message}`))\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyCursorRule} from './copyCursorRule'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitCursorRule) {\n await copyCursorRule().catch(console.error)\n }\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n }\n\n if (!options.omitMcpServer && !options.omitCursorRule) {\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport {checkTs} from './checkTs'\nexport default async function () {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n checkTs()\n runProd()\n}\n","import {spawn} from 'node:child_process'\n\nexport function runProd() {\n spawn('tsx', ['./app/index.ts'], {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n"],"mappings":";;;AACA,OAAOA,aAAW;AAClB,SAAQ,eAAc;;;ACFtB,SAAQ,YAAW;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,SAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,gBAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,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AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["chalk","fs","path","fs","ts","fs","path","ts","fs","ts","chalk","ts","fs","path","chalk","chokidar","ts","fs","path","chalk","fs","path","chalk","fs","path","chalk","fs","path","chalk","path","fs","chalk","chalk","chalk","spawn","chalk","chalk","chalk","chalk"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/watchDeletes.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyCursorRule/index.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/prod/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport check from './check'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--shell', 'Opens a shell in Chrome developer tools')\n .option('--omit-cursor-rule', 'Omit the creation of the Orionjs Cursor rule')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // option to omit the creation of the orion cursor rule\n omitCursorRule?: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const start = () => {\n console.log(chalk.bold('=> Starting app...\\n'))\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n }\n }\n\n const restart = () => {\n stop()\n start()\n }\n\n return {\n restart,\n stop,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n let startCommand = process.env.START_COMMAND || 'tsx'\n\n const args = []\n\n if (process.env.START_COMMAND) {\n const [first, ...otherArgs] = process.env.START_COMMAND.split(' ')\n startCommand = first\n args.push(...otherArgs)\n\n console.log(`Using custom command: ${[startCommand, ...args].join(' ')}`)\n } else if (options.shell) {\n args.push('--inspect')\n }\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchDeletes} from './watchDeletes'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchDeletes()\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory() {\n try {\n const dirPath = path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n\n if (diagnostic.code === 6032 || diagnostic.code === 6031) {\n runner.stop()\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n return\n }\n }\n\n runner.restart()\n }\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport chokidar from 'chokidar'\n\nexport async function watchDeletes() {\n const projectPath = path.resolve('./app')\n const watcher = chokidar.watch(projectPath, {\n ignoreInitial: true,\n })\n\n watcher.on('unlink', async filepath => {\n if (!filepath.endsWith('.ts')) return\n\n const relative = path.relative(process.cwd(), filepath)\n const atBuildPath = path.resolve('.orion/build', relative.replace(/.ts$/, ''))\n try {\n fs.unlinkSync(`${atBuildPath}.js`)\n fs.unlinkSync(`${atBuildPath}.d.ts`)\n } catch (error) {\n console.log(\n `Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`,\n )\n }\n })\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport https from 'node:https'\nimport path from 'node:path'\nimport chalk from 'chalk'\n\nconst rules = [\n 'orionjs.mdx',\n 'orionjs-component.mdx',\n 'orionjs-repository.mdx',\n 'orionjs-schema.mdx',\n 'orionjs-services.mdx',\n 'orionjs-resolvers.mdx',\n 'orionjs-tov4.mdx',\n]\n\n// Function to download the file content\nconst downloadFile = (url: string): Promise<string> => {\n return new Promise((resolve, reject) => {\n https.get(url, response => {\n if (response.statusCode !== 200) {\n reject(new Error(`Failed to download, status code: ${response.statusCode}`))\n return\n }\n\n let data = ''\n response.on('data', chunk => {\n data += chunk\n })\n response.on('end', () => {\n resolve(data)\n })\n response.on('error', err => {\n reject(err)\n })\n })\n })\n}\n\nexport async function copyCursorRule() {\n const baseUrl = 'https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc'\n\n try {\n // Create target directory if it doesn't exist\n const targetDir = path.join(process.cwd(), '.cursor', 'rules')\n await fs.mkdir(targetDir, {recursive: true})\n\n // Process each rule file\n await Promise.all(\n rules.map(async rule => {\n // Change extension from .mdx to .mdc\n const targetFileName = rule.replace('.mdx', '.mdc')\n const targetFile = path.join(targetDir, targetFileName)\n\n // Construct source URL\n const sourceUrl = `${baseUrl}/${rule}`\n\n // console.log(chalk.gray(`=> ✨ Downloading ${chalk.cyan(rule)} to ${chalk.cyan(targetFileName)}...`))\n\n // Download the file content\n const content = await downloadFile(sourceUrl)\n\n // Write the content to the target file\n await fs.writeFile(targetFile, content, 'utf8')\n\n console.log(chalk.bold(`=> ✨ Successfully downloaded ${chalk.cyan(targetFileName)}`))\n }),\n )\n\n console.log(chalk.bold('=> ✨ All rule files have been successfully copied'))\n } catch (error) {\n console.error(chalk.red(`Error copying rule files: ${error.message}`))\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyCursorRule} from './copyCursorRule'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitCursorRule) {\n await copyCursorRule().catch(console.error)\n }\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n }\n\n if (!options.omitMcpServer && !options.omitCursorRule) {\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport {checkTs} from './checkTs'\n\nexport default async function (_, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n checkTs()\n runProd(command)\n}\n","import {spawn} from 'node:child_process'\n\nexport function runProd(command: any) {\n const args = [...command.args, './app/index.ts']\n spawn('tsx', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAW;AAClB,SAAQ,eAAc;;;ACFtB,SAAQ,YAAW;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,SAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,gBAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAC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","fs","ts","fs","path","ts","fs","ts","chalk","ts","fs","path","chalk","chokidar","ts","fs","path","chalk","fs","path","chalk","fs","path","chalk","fs","path","chalk","path","fs","chalk","chalk","chalk","spawn","chalk","chalk","chalk","chalk","chalk","execSync","checkTs","chalk","checkTs","chalk"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/core",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "main": "./dist/index.cjs",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [