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 +62 -103
- package/lib/claude.js +30 -0
- package/lib/codex.js +64 -0
- package/lib/copilot.js +30 -0
- package/lib/detector.js +65 -0
- package/lib/interactive.js +57 -0
- package/package.json +6 -4
package/bin/cli.js
CHANGED
|
@@ -1,108 +1,67 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
.
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
.
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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 };
|
package/lib/detector.js
ADDED
|
@@ -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.
|
|
4
|
-
"description": "Install AI skills for GitHub Copilot CLI and
|
|
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": "
|
|
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",
|