g360-cli 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "g360-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tool for bootstrapping G360 ecosystem projects",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -9,7 +9,15 @@
9
9
  },
10
10
  "scripts": {
11
11
  "prepublishOnly": "node -e \"console.log('Use: npm install -g g360-cli')\"",
12
- "test": "echo \"No tests configured\""
12
+ "test": "echo \"No tests configured\"",
13
+ "build": "npm run build:portable",
14
+ "build:portable": "pkg . --targets node18-win-x64 --output dist/g360.exe"
15
+ },
16
+ "pkg": {
17
+ "assets": [
18
+ "src/assets/**/*"
19
+ ],
20
+ "outputPath": "dist"
13
21
  },
14
22
  "keywords": [
15
23
  "g360",
@@ -26,6 +34,9 @@
26
34
  "inquirer": "^9.2.15",
27
35
  "ora": "^7.0.1"
28
36
  },
37
+ "devDependencies": {
38
+ "pkg": "^5.8.1"
39
+ },
29
40
  "engines": {
30
41
  "node": ">=18.0.0"
31
42
  }
@@ -0,0 +1,10 @@
1
+ @echo off
2
+ :: Script para ejecucion portable e independiente
3
+ title G360 Python Portable - %CD%
4
+
5
+ echo [G360] Iniciando aplicacion portable...
6
+
7
+ :: Aseguramos que se use el entorno sincronizado
8
+ uv run python src/main.py
9
+
10
+ if %errorlevel% neq 0 pause
@@ -0,0 +1,19 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ echo [G360] Verificando entorno de desarrollo Python (uv)...
5
+
6
+ where uv >nul 2>nul
7
+ if %errorlevel% neq 0 (
8
+ echo [G360] uv no detectado. Iniciando instalacion automatica...
9
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
10
+ set "PATH=%USERPROFILE%\.cargo\bin;%PATH%"
11
+ echo [G360] uv instalado correctamente.
12
+ ) else (
13
+ echo [G360] uv ya esta instalado.
14
+ )
15
+
16
+ echo [G360] Sincronizando dependencias y entorno virtual...
17
+ uv sync
18
+ echo [G360] Entorno listo. Puedes usar 'uv run python src/main.py' para probar.
19
+ pause
@@ -4,6 +4,7 @@ import path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { manifest } from '../lib/manifest.js';
6
6
  import { progress } from '../lib/progress.js';
7
+ import { setSkill } from './set-skill.js';
7
8
 
8
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
10
 
@@ -48,8 +49,15 @@ export async function init(name, options) {
48
49
  const progressBar = progress('Creating project...');
49
50
 
50
51
  try {
52
+ // Asegurar que el directorio base existe
53
+ await fs.ensureDir(path.dirname(targetDir));
54
+
51
55
  await fs.copy(templateDir, targetDir);
52
56
  await manifest.init(targetDir, { name, template, version: '1.0.0' });
57
+
58
+ // Aplicar el skill pasando el directorio destino explícitamente
59
+ await setSkill(skill, { force: true, verbose: options.verbose, cwd: targetDir });
60
+
53
61
  progressBar.stop();
54
62
 
55
63
  console.log(chalk.green('\n✅ Project created successfully!\n'));
@@ -7,19 +7,21 @@
7
7
  import chalk from 'chalk';
8
8
  import fs from 'fs-extra';
9
9
  import path from 'path';
10
+ import { fileURLToPath } from 'url';
10
11
 
11
- const SKILLS_PATH = path.join(process.cwd(), 'g360-cli/src/assets/config/g360-skills.json');
12
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
+ const SKILLS_PATH = path.resolve(__dirname, '../assets/config/g360-skills.json');
12
14
 
13
15
  export async function setSkill(skillName, options) {
14
- const { verbose = false } = options;
16
+ const { verbose = false, cwd = process.cwd() } = options;
17
+ const isInternalCall = options.cwd !== undefined;
15
18
 
16
19
  console.log(chalk.bold.cyan('\n🎨 G360 Skill Selector\n'));
17
20
 
18
21
  // Cargar skills disponibles
19
22
  let skillsConfig;
20
23
  try {
21
- const cliPath = path.join(process.cwd(), 'g360-cli/src/assets/config/g360-skills.json');
22
- skillsConfig = await fs.readJson(cliPath);
24
+ skillsConfig = await fs.readJson(SKILLS_PATH);
23
25
  } catch (error) {
24
26
  console.error(chalk.red('❌ No se pudo cargar la configuración de skills'));
25
27
  return;
@@ -38,7 +40,7 @@ export async function setSkill(skillName, options) {
38
40
  }
39
41
 
40
42
  // Verificar si existe skill.json en el proyecto
41
- const skillJsonPath = path.join(process.cwd(), 'skill.json');
43
+ const skillJsonPath = path.join(cwd, 'skill.json');
42
44
 
43
45
  if (fs.existsSync(skillJsonPath)) {
44
46
  console.log(chalk.yellow('⚠️ El proyecto ya tiene un skill configurado.'));
@@ -1,14 +1,23 @@
1
1
  import chalk from 'chalk';
2
2
  import { execSync } from 'child_process';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const pkgPath = path.resolve(__dirname, '../../package.json');
3
9
 
4
10
  export async function update(options) {
5
11
  const { check = false } = options;
6
12
 
7
- console.log(chalk.bold.cyan('\n⬆️ G360 Update\n'));
13
+ // Detectar si estamos corriendo en modo portable (pkg)
14
+ const isPortable = process.pkg !== undefined;
8
15
 
16
+ console.log(chalk.bold.cyan('\n⬆️ G360 Update\n'));
17
+ const { version: currentVersion } = fs.readJsonSync(pkgPath);
18
+
9
19
  if (check) {
10
20
  try {
11
- const currentVersion = '1.0.0';
12
21
  console.log(chalk.gray(`Current version: ${currentVersion}`));
13
22
  console.log(chalk.gray('Check npm for latest version...'));
14
23
  console.log(chalk.yellow('\nUse: npm install -g g360-cli@latest to update'));
@@ -18,6 +27,12 @@ export async function update(options) {
18
27
  return;
19
28
  }
20
29
 
30
+ if (isPortable) {
31
+ console.log(chalk.cyan('🚀 Estás usando la versión portable de G360-CLI.'));
32
+ console.log(chalk.yellow('Para actualizar, descarga el nuevo binario desde el repositorio oficial.'));
33
+ return;
34
+ }
35
+
21
36
  try {
22
37
  console.log(chalk.yellow('Installing latest g360-cli...\n'));
23
38
  execSync('npm install -g g360-cli', { stdio: 'inherit' });