@followthecode/cli 1.1.10 → 1.1.11
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/NODEJS-TROUBLESHOOTING.md +143 -0
- package/bin/ftc +85 -0
- package/bin/ftc.js +12 -0
- package/package.json +9 -5
- package/scripts/install-wrapper.js +74 -0
- package/scripts/set-permissions.js +22 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# 🔧 Troubleshooting - Problemas com Node.js no Linux
|
|
2
|
+
|
|
3
|
+
## ❌ Erro: `node: not found`
|
|
4
|
+
|
|
5
|
+
Se você está recebendo o erro `node: not found` após instalar o FTC CLI no Linux, isso significa que o Node.js não está instalado ou não está no PATH do sistema.
|
|
6
|
+
|
|
7
|
+
## 🔍 Diagnóstico
|
|
8
|
+
|
|
9
|
+
### 1. Verificar se o Node.js está instalado:
|
|
10
|
+
```bash
|
|
11
|
+
node --version
|
|
12
|
+
npm --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. Se o Node.js não estiver instalado:
|
|
16
|
+
|
|
17
|
+
#### Opção A: Instalar via NodeSource (Recomendado)
|
|
18
|
+
```bash
|
|
19
|
+
# Para Ubuntu/Debian
|
|
20
|
+
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
|
21
|
+
sudo apt-get install -y nodejs
|
|
22
|
+
|
|
23
|
+
# Para CentOS/RHEL/Fedora
|
|
24
|
+
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
|
|
25
|
+
sudo yum install -y nodejs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Opção B: Instalar via Snap
|
|
29
|
+
```bash
|
|
30
|
+
sudo snap install node --classic
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Opção C: Instalar via NVM (Node Version Manager)
|
|
34
|
+
```bash
|
|
35
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
36
|
+
source ~/.bashrc
|
|
37
|
+
nvm install --lts
|
|
38
|
+
nvm use --lts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Verificar o PATH:
|
|
42
|
+
```bash
|
|
43
|
+
echo $PATH
|
|
44
|
+
which node
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 🛠️ Soluções Alternativas
|
|
48
|
+
|
|
49
|
+
### Solução 1: Usar o Wrapper Shell (Recomendado para Linux sem Node.js)
|
|
50
|
+
|
|
51
|
+
O FTC CLI agora inclui um wrapper shell script que não depende do Node.js:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Execute diretamente o wrapper shell
|
|
55
|
+
ftc --help
|
|
56
|
+
|
|
57
|
+
# Ou use o comando alternativo
|
|
58
|
+
ftc-linux --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Solução 2: Instalar Node.js apenas para o usuário atual
|
|
62
|
+
|
|
63
|
+
Se você não tem permissões de administrador:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Baixar e instalar Node.js localmente
|
|
67
|
+
mkdir ~/.nodejs
|
|
68
|
+
cd ~/.nodejs
|
|
69
|
+
wget https://nodejs.org/dist/v18.17.0/node-v18.17.0-linux-x64.tar.xz
|
|
70
|
+
tar -xf node-v18.17.0-linux-x64.tar.xz
|
|
71
|
+
echo 'export PATH="$HOME/.nodejs/node-v18.17.0-linux-x64/bin:$PATH"' >> ~/.bashrc
|
|
72
|
+
source ~/.bashrc
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Solução 3: Usar o binário .NET diretamente
|
|
76
|
+
|
|
77
|
+
Se nenhuma das opções acima funcionar, você pode executar o binário .NET diretamente:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Navegar para o diretório de instalação
|
|
81
|
+
cd /usr/local/lib/node_modules/@followthecode/cli/bin/linux-x64
|
|
82
|
+
|
|
83
|
+
# Executar diretamente
|
|
84
|
+
./ftc.cli --help
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 🔧 Configuração Automática
|
|
88
|
+
|
|
89
|
+
O FTC CLI agora detecta automaticamente qual wrapper usar:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Reinstalar o pacote para executar a configuração automática
|
|
93
|
+
npm uninstall -g @followthecode/cli
|
|
94
|
+
npm install -g @followthecode/cli
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 📋 Verificação
|
|
98
|
+
|
|
99
|
+
Após a instalação, verifique se está funcionando:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Verificar se o comando está disponível
|
|
103
|
+
which ftc
|
|
104
|
+
|
|
105
|
+
# Testar o comando
|
|
106
|
+
ftc --help
|
|
107
|
+
|
|
108
|
+
# Verificar a versão
|
|
109
|
+
ftc --version
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 🆘 Ainda com Problemas?
|
|
113
|
+
|
|
114
|
+
Se você ainda está enfrentando problemas:
|
|
115
|
+
|
|
116
|
+
1. **Verifique as permissões**:
|
|
117
|
+
```bash
|
|
118
|
+
ls -la $(which ftc)
|
|
119
|
+
chmod +x $(which ftc)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. **Reinstale o pacote**:
|
|
123
|
+
```bash
|
|
124
|
+
npm uninstall -g @followthecode/cli
|
|
125
|
+
npm cache clean --force
|
|
126
|
+
npm install -g @followthecode/cli
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
3. **Execute o script de configuração manualmente**:
|
|
130
|
+
```bash
|
|
131
|
+
cd /usr/local/lib/node_modules/@followthecode/cli
|
|
132
|
+
node scripts/install-wrapper.js
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 📞 Suporte
|
|
136
|
+
|
|
137
|
+
Se nenhuma das soluções acima funcionar, abra uma issue no repositório do projeto com:
|
|
138
|
+
|
|
139
|
+
- Sistema operacional e versão
|
|
140
|
+
- Saída do comando `node --version`
|
|
141
|
+
- Saída do comando `npm --version`
|
|
142
|
+
- Mensagem de erro completa
|
|
143
|
+
- Conteúdo do arquivo `/etc/environment` (se aplicável)
|
package/bin/ftc
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Follow The Code CLI - Wrapper Shell Script
|
|
4
|
+
# Este script executa o binário .NET diretamente sem depender do Node.js
|
|
5
|
+
|
|
6
|
+
# Detecta a plataforma
|
|
7
|
+
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
8
|
+
ARCH=$(uname -m)
|
|
9
|
+
|
|
10
|
+
# Mapeia a plataforma para o diretório correto
|
|
11
|
+
case "$PLATFORM" in
|
|
12
|
+
"linux")
|
|
13
|
+
PLATFORM_DIR="linux-x64"
|
|
14
|
+
EXECUTABLE="ftc.cli"
|
|
15
|
+
;;
|
|
16
|
+
"darwin")
|
|
17
|
+
PLATFORM_DIR="osx-x64"
|
|
18
|
+
EXECUTABLE="ftc.cli"
|
|
19
|
+
;;
|
|
20
|
+
*)
|
|
21
|
+
echo "❌ Plataforma não suportada: $PLATFORM"
|
|
22
|
+
echo "💡 Plataformas suportadas: Linux, macOS"
|
|
23
|
+
exit 1
|
|
24
|
+
;;
|
|
25
|
+
esac
|
|
26
|
+
|
|
27
|
+
# Obtém o diretório do script
|
|
28
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
29
|
+
EXECUTABLE_PATH="$SCRIPT_DIR/$PLATFORM_DIR/$EXECUTABLE"
|
|
30
|
+
|
|
31
|
+
# Verifica se o executável existe
|
|
32
|
+
if [ ! -f "$EXECUTABLE_PATH" ]; then
|
|
33
|
+
echo "❌ Erro: Executável .NET não encontrado em: $EXECUTABLE_PATH"
|
|
34
|
+
echo "💡 Certifique-se de que o projeto foi compilado para todas as plataformas."
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Verifica permissões de execução
|
|
39
|
+
if [ ! -x "$EXECUTABLE_PATH" ]; then
|
|
40
|
+
echo "❌ Erro: Arquivo não tem permissões de execução: $EXECUTABLE_PATH"
|
|
41
|
+
echo "💡 Execute: chmod +x $EXECUTABLE_PATH"
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Se não há argumentos ou é --help, mostra o help
|
|
46
|
+
if [ $# -eq 0 ] || [[ "$*" == *"--help"* ]] || [[ "$*" == *"-h"* ]]; then
|
|
47
|
+
echo "
|
|
48
|
+
🚀 Follow The Code CLI - Ferramenta de Análise de Repositórios Git
|
|
49
|
+
|
|
50
|
+
📋 USO:
|
|
51
|
+
ftc <comando> [opções]
|
|
52
|
+
|
|
53
|
+
📝 COMANDOS:
|
|
54
|
+
collect code <repo> Analisa um repositório Git e coleta dados
|
|
55
|
+
|
|
56
|
+
📊 OPÇÕES DE EXPORTAÇÃO:
|
|
57
|
+
--csv Exporta resultados em formato CSV
|
|
58
|
+
--json Exporta resultados em formato JSON
|
|
59
|
+
--export <destino> Define o destino da exportação
|
|
60
|
+
|
|
61
|
+
🎯 DESTINOS DE EXPORTAÇÃO:
|
|
62
|
+
local:<caminho> Salva arquivo local (ex: local:./output.csv)
|
|
63
|
+
s3:<bucket>/<key> Envia para AWS S3 (ex: s3:meu-bucket/resultado.csv)
|
|
64
|
+
|
|
65
|
+
📖 EXEMPLOS:
|
|
66
|
+
ftc collect code https://github.com/user/repo --csv --export local:./resultado.csv
|
|
67
|
+
ftc collect code https://github.com/user/repo --json --export s3:meu-bucket/analise.json
|
|
68
|
+
ftc collect code https://github.com/user/repo --csv
|
|
69
|
+
|
|
70
|
+
🔧 OPÇÕES GLOBAIS:
|
|
71
|
+
--help, -h Mostra esta ajuda
|
|
72
|
+
--version, -v Mostra a versão
|
|
73
|
+
|
|
74
|
+
🌍 PLATAFORMAS SUPORTADAS:
|
|
75
|
+
Windows (x64), macOS (x64), Linux (x64)
|
|
76
|
+
|
|
77
|
+
📚 MAIS INFORMAÇÕES:
|
|
78
|
+
Visite: https://github.com/your-org/follow-the-code
|
|
79
|
+
"
|
|
80
|
+
exit 0
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# Executa o binário .NET
|
|
84
|
+
cd "$(dirname "$EXECUTABLE_PATH")"
|
|
85
|
+
exec "$EXECUTABLE_PATH" "$@"
|
package/bin/ftc.js
CHANGED
|
@@ -4,6 +4,18 @@ const { spawn } = require('child_process');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
|
|
7
|
+
// Verifica se o Node.js está disponível
|
|
8
|
+
function checkNodeAvailability() {
|
|
9
|
+
try {
|
|
10
|
+
// Tenta executar node --version
|
|
11
|
+
const { execSync } = require('child_process');
|
|
12
|
+
execSync('node --version', { stdio: 'pipe' });
|
|
13
|
+
return true;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
7
19
|
// Detecta a plataforma e arquitetura
|
|
8
20
|
const platform = process.platform;
|
|
9
21
|
const arch = process.arch;
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@followthecode/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"description": "CLI tool for Git repository analysis and data collection",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"publishConfig": {
|
|
8
|
-
"access": "
|
|
8
|
+
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
|
-
"ftc": "./bin/ftc.js"
|
|
11
|
+
"ftc": "./bin/ftc.js",
|
|
12
|
+
"ftc-linux": "./bin/ftc"
|
|
12
13
|
},
|
|
13
14
|
"scripts": {
|
|
14
15
|
"prepublishOnly": "npm run build",
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
"build:linux": "dotnet publish ftc.cli.csproj -c Release -r linux-x64 --self-contained true -o ./bin/linux-x64",
|
|
19
20
|
"copy-config": "node scripts/copy-config.js",
|
|
20
21
|
"set-permissions": "node scripts/set-permissions.js",
|
|
21
|
-
"postinstall": "node scripts/set-permissions.js",
|
|
22
|
+
"postinstall": "node scripts/set-permissions.js && node scripts/install-wrapper.js",
|
|
22
23
|
"fix-permissions": "node scripts/fix-permissions.js",
|
|
23
24
|
"test": "dotnet test",
|
|
24
25
|
"test-permissions": "node scripts/test-permissions.js",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
],
|
|
70
71
|
"files": [
|
|
71
72
|
"bin/ftc.js",
|
|
73
|
+
"bin/ftc",
|
|
72
74
|
"bin/win-x64/ftc.cli.exe",
|
|
73
75
|
"bin/win-x64/ftc.cli.dll",
|
|
74
76
|
"bin/win-x64/ftc.cli.deps.json",
|
|
@@ -86,10 +88,12 @@
|
|
|
86
88
|
"bin/linux-x64/*.dll",
|
|
87
89
|
"scripts/set-permissions.js",
|
|
88
90
|
"scripts/fix-permissions.js",
|
|
91
|
+
"scripts/install-wrapper.js",
|
|
89
92
|
"README.md",
|
|
90
93
|
"LICENSE",
|
|
91
94
|
"TROUBLESHOOTING.md",
|
|
92
|
-
"TESTING.md"
|
|
95
|
+
"TESTING.md",
|
|
96
|
+
"NODEJS-TROUBLESHOOTING.md"
|
|
93
97
|
],
|
|
94
98
|
"dependencies": {
|
|
95
99
|
"@followthecode/cli": "^1.0.1",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
console.log('🔧 Configurando wrapper do FTC CLI...');
|
|
8
|
+
|
|
9
|
+
// Detecta a plataforma
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
const isWindows = platform === 'win32';
|
|
12
|
+
|
|
13
|
+
// Verifica se o Node.js está disponível
|
|
14
|
+
function checkNodeAvailability() {
|
|
15
|
+
try {
|
|
16
|
+
execSync('node --version', { stdio: 'pipe' });
|
|
17
|
+
return true;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Caminhos dos wrappers
|
|
24
|
+
const ftcJsPath = path.join(__dirname, '..', 'bin', 'ftc.js');
|
|
25
|
+
const ftcShellPath = path.join(__dirname, '..', 'bin', 'ftc');
|
|
26
|
+
|
|
27
|
+
// Verifica qual wrapper usar
|
|
28
|
+
const nodeAvailable = checkNodeAvailability();
|
|
29
|
+
const ftcJsExists = fs.existsSync(ftcJsPath);
|
|
30
|
+
const ftcShellExists = fs.existsSync(ftcShellPath);
|
|
31
|
+
|
|
32
|
+
console.log(`📋 Detecção de ambiente:`);
|
|
33
|
+
console.log(` Plataforma: ${platform}`);
|
|
34
|
+
console.log(` Node.js disponível: ${nodeAvailable ? '✅ Sim' : '❌ Não'}`);
|
|
35
|
+
console.log(` Wrapper Node.js: ${ftcJsExists ? '✅ Existe' : '❌ Não existe'}`);
|
|
36
|
+
console.log(` Wrapper Shell: ${ftcShellExists ? '✅ Existe' : '❌ Não existe'}`);
|
|
37
|
+
|
|
38
|
+
// Recomenda o wrapper apropriado
|
|
39
|
+
if (nodeAvailable && ftcJsExists) {
|
|
40
|
+
console.log('✅ Usando wrapper Node.js (ftc.js)');
|
|
41
|
+
console.log('💡 Execute: ftc --help');
|
|
42
|
+
} else if (ftcShellExists) {
|
|
43
|
+
console.log('✅ Usando wrapper Shell (ftc)');
|
|
44
|
+
console.log('💡 Execute: ftc --help');
|
|
45
|
+
|
|
46
|
+
if (!nodeAvailable) {
|
|
47
|
+
console.log('⚠️ Node.js não encontrado, usando wrapper shell como fallback');
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
console.error('❌ Nenhum wrapper disponível!');
|
|
51
|
+
console.error('💡 Certifique-se de que o projeto foi compilado corretamente.');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Define permissões para os wrappers
|
|
56
|
+
if (ftcJsExists) {
|
|
57
|
+
try {
|
|
58
|
+
fs.chmodSync(ftcJsPath, 0o755);
|
|
59
|
+
console.log('✅ Permissões definidas para ftc.js');
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.warn('⚠️ Não foi possível definir permissões para ftc.js:', error.message);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (ftcShellExists) {
|
|
66
|
+
try {
|
|
67
|
+
fs.chmodSync(ftcShellPath, 0o755);
|
|
68
|
+
console.log('✅ Permissões definidas para ftc (shell)');
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.warn('⚠️ Não foi possível definir permissões para ftc (shell):', error.message);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log('🎉 Configuração concluída!');
|
|
@@ -59,4 +59,26 @@ if (fs.existsSync(ftcJsPath)) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// Define permissões para o wrapper shell script
|
|
63
|
+
const ftcShellPath = path.join('bin', 'ftc');
|
|
64
|
+
if (fs.existsSync(ftcShellPath)) {
|
|
65
|
+
try {
|
|
66
|
+
if (isWindows) {
|
|
67
|
+
try {
|
|
68
|
+
fs.chmodSync(ftcShellPath, 0o755);
|
|
69
|
+
console.log(`✅ Permissões definidas para ${ftcShellPath} (Windows)`);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.log(`✅ Arquivo preparado para ${ftcShellPath} (Windows - permissões não aplicáveis)`);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
fs.chmodSync(ftcShellPath, 0o755);
|
|
75
|
+
console.log(`✅ Permissões definidas para ${ftcShellPath}`);
|
|
76
|
+
}
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(`❌ Erro ao definir permissões para ${ftcShellPath}:`, error.message);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
console.warn(`⚠️ Wrapper shell script não encontrado: ${ftcShellPath}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
62
84
|
console.log('✅ Permissões de execução definidas com sucesso');
|