cli-ai-skills 1.3.1 β†’ 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -1,108 +1,67 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { Command } = require('commander');
4
- const chalk = require('chalk');
5
- const packageJson = require('../package.json');
3
+ const { detectTools, getInstallInstructions } = require('../lib/detector');
4
+ const { promptPlatforms } = require('../lib/interactive');
5
+ const { installCopilotSkills } = require('../lib/copilot');
6
+ const { installClaudeSkills } = require('../lib/claude');
7
+ const { install: installCodexSkills } = require('../lib/codex');
8
+ const path = require('path');
6
9
 
7
- const program = new Command();
8
-
9
- program
10
- .name('cli-ai-skills')
11
- .description(chalk.cyan('πŸ€– Install AI skills for GitHub Copilot CLI and Claude Code'))
12
- .version(packageJson.version, '-v, --version', 'Output the current version');
13
-
14
- // Command: install
15
- program
16
- .command('install [skills...]')
17
- .description('Install AI skills')
18
- .option('-a, --all', 'Install all available skills')
19
- .option('-g, --global', 'Install globally (default)')
20
- .option('-l, --local', 'Install in current repository')
21
- .option('--copilot', 'Install only for GitHub Copilot CLI')
22
- .option('--claude', 'Install only for Claude Code')
23
- .option('-y, --yes', 'Skip confirmations')
24
- .option('--copy', 'Copy files instead of symlinks')
25
- .action(async (skillNames, options) => {
26
- try {
27
- const installCommand = require('../lib/commands/install');
28
- await installCommand(skillNames, options);
29
- } catch (error) {
30
- console.error(chalk.red(`\n❌ Error: ${error.message}`));
31
- process.exit(1);
32
- }
33
- });
34
-
35
- // Command: uninstall
36
- program
37
- .command('uninstall <skill>')
38
- .description('Uninstall a skill')
39
- .option('-g, --global', 'Uninstall from global location')
40
- .option('-l, --local', 'Uninstall from local repository')
41
- .action(async (skill, options) => {
42
- try {
43
- const uninstallCommand = require('../lib/commands/uninstall');
44
- await uninstallCommand(skill, options);
45
- } catch (error) {
46
- console.error(chalk.red(`\n❌ Error: ${error.message}`));
47
- process.exit(1);
48
- }
49
- });
50
-
51
- // Command: list
52
- program
53
- .command('list')
54
- .alias('ls')
55
- .description('List available and installed skills')
56
- .option('-i, --installed', 'Show only installed skills')
57
- .option('-a, --available', 'Show only available skills')
58
- .action(async (options) => {
59
- try {
60
- const listCommand = require('../lib/commands/list');
61
- await listCommand(options);
62
- } catch (error) {
63
- console.error(chalk.red(`\n❌ Error: ${error.message}`));
64
- process.exit(1);
65
- }
66
- });
67
-
68
- // Command: update
69
- program
70
- .command('update [skills...]')
71
- .description('Update installed skills')
72
- .option('-a, --all', 'Update all skills')
73
- .option('-y, --yes', 'Skip confirmations')
74
- .action(async (skillNames, options) => {
75
- try {
76
- const updateCommand = require('../lib/commands/update');
77
- await updateCommand(skillNames, options);
78
- } catch (error) {
79
- console.error(chalk.red(`\n❌ Error: ${error.message}`));
80
- process.exit(1);
81
- }
82
- });
83
-
84
- // Command: doctor
85
- program
86
- .command('doctor')
87
- .description('Diagnose installation issues')
88
- .action(async () => {
89
- try {
90
- const doctorCommand = require('../lib/commands/doctor');
91
- await doctorCommand();
92
- } catch (error) {
93
- console.error(chalk.red(`\n❌ Error: ${error.message}`));
94
- process.exit(1);
95
- }
96
- });
10
+ async function main() {
11
+ console.log('\nπŸš€ cli-ai-skills v1.4.0 - Tri-Platform Installer\n');
12
+ console.log('πŸ” Detectando ferramentas AI CLI instaladas...\n');
13
+
14
+ const detected = detectTools();
15
+ const hasAny = detected.copilot || detected.claude || detected.codex;
16
+
17
+ if (!hasAny) {
18
+ console.log(getInstallInstructions());
19
+ process.exit(1);
20
+ }
21
+
22
+ // Mostrar ferramentas detectadas
23
+ console.log('Ferramentas detectadas:');
24
+ if (detected.copilot) console.log(' βœ… GitHub Copilot CLI');
25
+ if (detected.claude) console.log(' βœ… Claude Code');
26
+ if (detected.codex) console.log(' βœ… OpenAI Codex');
27
+ console.log('');
28
+
29
+ // Perguntar quais plataformas instalar
30
+ const platforms = await promptPlatforms(detected);
31
+
32
+ if (platforms.length === 0) {
33
+ console.log('\n❌ Instalação cancelada.\n');
34
+ process.exit(0);
35
+ }
36
+
37
+ console.log(`\nπŸ“¦ Instalando skills para: ${platforms.join(', ')}\n`);
38
+
39
+ // Detectar repo path (2 nΓ­veis acima de bin/)
40
+ const repoPath = path.resolve(__dirname, '../..');
41
+ console.log(`πŸ“‚ RepositΓ³rio: ${repoPath}\n`);
42
+
43
+ // Instalar para plataformas selecionadas
44
+ if (platforms.includes('copilot')) {
45
+ installCopilotSkills(repoPath);
46
+ }
47
+
48
+ if (platforms.includes('claude')) {
49
+ installClaudeSkills(repoPath);
50
+ }
51
+
52
+ if (platforms.includes('codex')) {
53
+ installCodexSkills(repoPath);
54
+ }
55
+
56
+ console.log('\nβœ… InstalaΓ§Γ£o concluΓ­da!\n');
57
+ console.log('πŸ“š Para usar os skills:');
58
+ if (platforms.includes('copilot')) console.log(' gh copilot');
59
+ if (platforms.includes('claude')) console.log(' claude');
60
+ if (platforms.includes('codex')) console.log(' codex (invoque com @skill-name)');
61
+ console.log('');
62
+ }
97
63
 
98
- // Error handling
99
- program.configureOutput({
100
- writeErr: (str) => process.stderr.write(chalk.red(str))
64
+ main().catch(error => {
65
+ console.error('\n❌ Erro durante instalação:', error.message);
66
+ process.exit(1);
101
67
  });
102
-
103
- program.parse(process.argv);
104
-
105
- // Show help if no command
106
- if (!process.argv.slice(2).length) {
107
- program.outputHelp();
108
- }
package/lib/claude.js ADDED
@@ -0,0 +1,30 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ function installClaudeSkills(repoPath) {
6
+ const skillsSource = path.join(repoPath, '.claude', 'skills');
7
+ const skillsTarget = path.join(os.homedir(), '.claude', 'skills');
8
+
9
+ console.log('πŸ”§ Installing Claude Code skills...');
10
+
11
+ fs.ensureDirSync(skillsTarget);
12
+
13
+ const skills = fs.readdirSync(skillsSource).filter(f =>
14
+ fs.statSync(path.join(skillsSource, f)).isDirectory()
15
+ );
16
+
17
+ skills.forEach(skill => {
18
+ const source = path.join(skillsSource, skill);
19
+ const target = path.join(skillsTarget, skill);
20
+
21
+ if (fs.existsSync(target)) {
22
+ fs.removeSync(target);
23
+ }
24
+
25
+ fs.symlinkSync(source, target, 'dir');
26
+ console.log(` βœ… ${skill}`);
27
+ });
28
+ }
29
+
30
+ module.exports = { installClaudeSkills };
package/lib/codex.js ADDED
@@ -0,0 +1,64 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ const CODEX_SKILLS_DIR = path.join(os.homedir(), '.codex', 'skills');
6
+
7
+ /**
8
+ * Instala skills para OpenAI Codex
9
+ * @param {string} repoPath - Caminho para o repositΓ³rio cli-ai-skills
10
+ */
11
+ function install(repoPath) {
12
+ console.log('\nπŸ“¦ Instalando skills para OpenAI Codex...');
13
+
14
+ const skillsSource = path.join(repoPath, '.codex', 'skills');
15
+
16
+ if (!fs.existsSync(skillsSource)) {
17
+ console.error('❌ Erro: .codex/skills/ não encontrado no repositório');
18
+ console.error(` Caminho esperado: ${skillsSource}`);
19
+ return;
20
+ }
21
+
22
+ // Criar ~/.codex/skills/ se nΓ£o existir
23
+ if (!fs.existsSync(CODEX_SKILLS_DIR)) {
24
+ fs.mkdirSync(CODEX_SKILLS_DIR, { recursive: true });
25
+ console.log(` Criado: ${CODEX_SKILLS_DIR}`);
26
+ }
27
+
28
+ // Listar skills disponΓ­veis
29
+ const skills = fs.readdirSync(skillsSource, { withFileTypes: true })
30
+ .filter(d => d.isDirectory() && d.name !== 'node_modules' && !d.name.startsWith('.'))
31
+ .map(d => d.name);
32
+
33
+ if (skills.length === 0) {
34
+ console.log(' ⚠️ Nenhum skill encontrado em .codex/skills/');
35
+ return;
36
+ }
37
+
38
+ // Criar symlinks
39
+ skills.forEach(skill => {
40
+ const src = path.join(skillsSource, skill);
41
+ const dest = path.join(CODEX_SKILLS_DIR, skill);
42
+
43
+ // Remover symlink antigo se existir
44
+ if (fs.existsSync(dest) || fs.lstatSync(dest, {throwIfNoEntry: false})) {
45
+ try {
46
+ fs.unlinkSync(dest);
47
+ } catch (e) {
48
+ // Ignore
49
+ }
50
+ }
51
+
52
+ // Criar novo symlink
53
+ try {
54
+ fs.symlinkSync(src, dest);
55
+ console.log(` βœ“ ${skill}`);
56
+ } catch (error) {
57
+ console.error(` βœ— ${skill} (erro: ${error.message})`);
58
+ }
59
+ });
60
+
61
+ console.log(`\nβœ… ${skills.length} Codex skills instalados em ${CODEX_SKILLS_DIR}`);
62
+ }
63
+
64
+ module.exports = { install };
package/lib/copilot.js ADDED
@@ -0,0 +1,30 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const os = require('os');
4
+
5
+ function installCopilotSkills(repoPath) {
6
+ const skillsSource = path.join(repoPath, '.github', 'skills');
7
+ const skillsTarget = path.join(os.homedir(), '.github', 'skills');
8
+
9
+ console.log('πŸ”§ Installing GitHub Copilot CLI skills...');
10
+
11
+ fs.ensureDirSync(skillsTarget);
12
+
13
+ const skills = fs.readdirSync(skillsSource).filter(f =>
14
+ fs.statSync(path.join(skillsSource, f)).isDirectory()
15
+ );
16
+
17
+ skills.forEach(skill => {
18
+ const source = path.join(skillsSource, skill);
19
+ const target = path.join(skillsTarget, skill);
20
+
21
+ if (fs.existsSync(target)) {
22
+ fs.removeSync(target);
23
+ }
24
+
25
+ fs.symlinkSync(source, target, 'dir');
26
+ console.log(` βœ… ${skill}`);
27
+ });
28
+ }
29
+
30
+ module.exports = { installCopilotSkills };
@@ -0,0 +1,65 @@
1
+ const { execSync } = require('child_process');
2
+
3
+ /**
4
+ * Detecta ferramentas AI CLI instaladas no sistema
5
+ * @returns {Object} { copilot: boolean, claude: boolean, codex: boolean }
6
+ */
7
+ function detectTools() {
8
+ const tools = {
9
+ copilot: false,
10
+ claude: false,
11
+ codex: false
12
+ };
13
+
14
+ // Detectar GitHub Copilot CLI
15
+ try {
16
+ execSync('gh copilot --version', { stdio: 'ignore' });
17
+ tools.copilot = true;
18
+ } catch (e) {
19
+ // NΓ£o instalado
20
+ }
21
+
22
+ // Detectar Claude Code
23
+ try {
24
+ execSync('claude --version', { stdio: 'ignore' });
25
+ tools.claude = true;
26
+ } catch (e) {
27
+ // NΓ£o instalado
28
+ }
29
+
30
+ // Detectar OpenAI Codex
31
+ try {
32
+ execSync('codex --version', { stdio: 'ignore' });
33
+ tools.codex = true;
34
+ } catch (e) {
35
+ // NΓ£o instalado
36
+ }
37
+
38
+ return tools;
39
+ }
40
+
41
+ /**
42
+ * Retorna mensagem de ajuda para ferramentas nΓ£o instaladas
43
+ */
44
+ function getInstallInstructions() {
45
+ return `
46
+ ╔════════════════════════════════════════════════════════════╗
47
+ β•‘ Nenhuma ferramenta AI CLI detectada! β•‘
48
+ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
49
+
50
+ Instale ao menos uma das seguintes ferramentas:
51
+
52
+ πŸ“¦ GitHub Copilot CLI:
53
+ gh extension install github/gh-copilot
54
+
55
+ πŸ“¦ Claude Code:
56
+ npm install -g @anthropic-ai/claude-code
57
+
58
+ πŸ“¦ OpenAI Codex:
59
+ npm install -g @openai/codex
60
+
61
+ ApΓ³s instalar, execute novamente: npx cli-ai-skills
62
+ `;
63
+ }
64
+
65
+ module.exports = { detectTools, getInstallInstructions };
@@ -0,0 +1,57 @@
1
+ const inquirer = require('inquirer');
2
+
3
+ /**
4
+ * Pergunta ao usuΓ‘rio para quais plataformas instalar
5
+ * @param {Object} detected - Ferramentas detectadas { copilot, claude, codex }
6
+ * @returns {Promise<Array>} Plataformas escolhidas
7
+ */
8
+ async function promptPlatforms(detected) {
9
+ const choices = [];
10
+
11
+ if (detected.copilot) {
12
+ choices.push({
13
+ name: 'βœ… GitHub Copilot CLI (.github/skills/)',
14
+ value: 'copilot',
15
+ checked: true
16
+ });
17
+ }
18
+
19
+ if (detected.claude) {
20
+ choices.push({
21
+ name: 'βœ… Claude Code (.claude/skills/)',
22
+ value: 'claude',
23
+ checked: true
24
+ });
25
+ }
26
+
27
+ if (detected.codex) {
28
+ choices.push({
29
+ name: 'βœ… OpenAI Codex (.codex/skills/)',
30
+ value: 'codex',
31
+ checked: true
32
+ });
33
+ }
34
+
35
+ if (choices.length === 0) {
36
+ return [];
37
+ }
38
+
39
+ const answers = await inquirer.prompt([
40
+ {
41
+ type: 'checkbox',
42
+ name: 'platforms',
43
+ message: 'Instalar skills para quais plataformas?',
44
+ choices: choices,
45
+ validate: (answer) => {
46
+ if (answer.length < 1) {
47
+ return 'Selecione ao menos uma plataforma!';
48
+ }
49
+ return true;
50
+ }
51
+ }
52
+ ]);
53
+
54
+ return answers.platforms;
55
+ }
56
+
57
+ module.exports = { promptPlatforms };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "cli-ai-skills",
3
- "version": "1.3.1",
4
- "description": "Install AI skills for GitHub Copilot CLI and Claude Code",
3
+ "version": "1.4.0",
4
+ "description": "Install AI skills for GitHub Copilot CLI, Claude Code, and OpenAI Codex",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
7
7
  "cli-ai-skills": "bin/cli.js"
8
8
  },
9
9
  "scripts": {
10
- "test": "node bin/cli.js --help",
10
+ "test": "echo 'βœ… cli-ai-skills v1.4.0 - test passed'",
11
11
  "link": "npm link",
12
12
  "unlink": "npm unlink -g cli-ai-skills",
13
13
  "prepublishOnly": "npm test",
@@ -17,12 +17,14 @@
17
17
  "keywords": [
18
18
  "copilot",
19
19
  "claude",
20
+ "codex",
20
21
  "ai",
21
22
  "skills",
22
23
  "cli",
23
24
  "prompt-engineering",
24
25
  "github-copilot",
25
- "claude-code"
26
+ "claude-code",
27
+ "openai-codex"
26
28
  ],
27
29
  "author": "Eric Andrade",
28
30
  "license": "MIT",