@followthecode/cli 1.1.8 → 1.1.10
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/README.md +47 -1
- package/TESTING.md +169 -0
- package/TROUBLESHOOTING.md +60 -0
- package/bin/ftc.js +18 -0
- package/bin/linux-x64/Microsoft.Extensions.Diagnostics.dll +0 -0
- package/bin/linux-x64/Microsoft.Extensions.Http.dll +0 -0
- package/bin/linux-x64/appsettings.json +0 -20
- package/bin/linux-x64/ftc.cli.deps.json +44 -0
- package/bin/linux-x64/ftc.cli.dll +0 -0
- package/bin/osx-x64/Microsoft.Extensions.Diagnostics.dll +0 -0
- package/bin/osx-x64/Microsoft.Extensions.Http.dll +0 -0
- package/bin/osx-x64/appsettings.json +0 -20
- package/bin/osx-x64/ftc.cli.deps.json +44 -0
- package/bin/osx-x64/ftc.cli.dll +0 -0
- package/bin/win-x64/Microsoft.Extensions.Diagnostics.dll +0 -0
- package/bin/win-x64/Microsoft.Extensions.Http.dll +0 -0
- package/bin/win-x64/appsettings.json +0 -20
- package/bin/win-x64/ftc.cli.deps.json +44 -0
- package/bin/win-x64/ftc.cli.dll +0 -0
- package/bin/win-x64/ftc.cli.exe +0 -0
- package/package.json +19 -4
- package/scripts/fix-permissions.js +58 -0
- package/scripts/set-permissions.js +62 -0
package/README.md
CHANGED
|
@@ -488,4 +488,50 @@ ftc code "./meu-repo" --csv --export s3://meu-bucket/analises/resultado.csv
|
|
|
488
488
|
- Se `--s3-bucket` não for informado, será usado o bucket padrão `ftc-analyzer`.
|
|
489
489
|
- Para JSON: Se `--s3-key` não for informado, será usado o padrão `analises/<nome_repositorio>-ano-mes-dia.json`.
|
|
490
490
|
- Para CSV: Se `--s3-key` não for informado, será usado o padrão `analises/<nome_repositorio>-ano-mes-dia.csv`.
|
|
491
|
-
- O parâmetro `--s3-region` pode ser usado para especificar a região AWS.
|
|
491
|
+
- O parâmetro `--s3-region` pode ser usado para especificar a região AWS.
|
|
492
|
+
|
|
493
|
+
## Exportação via API HTTP (x-apikey)
|
|
494
|
+
|
|
495
|
+
Agora é possível exportar arquivos diretamente para uma API HTTP utilizando o header `x-apikey`.
|
|
496
|
+
|
|
497
|
+
**Exemplo de configuração:**
|
|
498
|
+
|
|
499
|
+
```
|
|
500
|
+
api:https://sua-api.com/upload?apikey=SEU_API_KEY
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
- O arquivo será compactado (gzip) e enviado via POST para a URL informada.
|
|
504
|
+
- O header `x-apikey` será preenchido automaticamente com o valor fornecido.
|
|
505
|
+
- O header `x-provider` será enviado se especificado na URL.
|
|
506
|
+
- O conteúdo enviado será do tipo `application/octet-stream` com encoding `gzip`.
|
|
507
|
+
|
|
508
|
+
**Uso no código:**
|
|
509
|
+
|
|
510
|
+
```csharp
|
|
511
|
+
await ExportHelper.ExportDataAsync(
|
|
512
|
+
dados,
|
|
513
|
+
"api:https://sua-api.com/upload?apikey=SEU_API_KEY",
|
|
514
|
+
repoPath,
|
|
515
|
+
serviceProvider,
|
|
516
|
+
ExportFormat.Json
|
|
517
|
+
);
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Exemplo: Envio de arquivo compactado para o endpoint de commit-files
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
api:https://ftc-api.eximia.co/collect/commit-files?apikey=xpt-apikey&provider=Azure
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
- O arquivo será compactado (gzip) e enviado via POST.
|
|
527
|
+
- Headers enviados: x-apikey, x-provider
|
|
528
|
+
- Suporta CSV ou JSON.
|
|
529
|
+
- Formato: application/octet-stream com encoding gzip
|
|
530
|
+
|
|
531
|
+
### Exemplo: Consulta do last-sync via GET
|
|
532
|
+
|
|
533
|
+
```csharp
|
|
534
|
+
var client = new ApiKeyHttpGetClient(serviceProvider.GetRequiredService<IHttpClientFactory>(), "xpt-apikey");
|
|
535
|
+
var lastSync = await client.GetLastSyncAsync("https://ftc-api.eximia.co/collect/repositories/repo01/last-sync");
|
|
536
|
+
Console.WriteLine($"Última sincronização: {lastSync}");
|
|
537
|
+
```
|
package/TESTING.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# 🧪 Guia de Testes - Follow The Code CLI
|
|
2
|
+
|
|
3
|
+
## Testes de Permissões
|
|
4
|
+
|
|
5
|
+
### 1. **Teste Básico de Permissões**
|
|
6
|
+
```bash
|
|
7
|
+
cd contexts/ftc.cli
|
|
8
|
+
npm run test-permissions
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Este comando verifica:
|
|
12
|
+
- ✅ Permissões dos arquivos executáveis
|
|
13
|
+
- ✅ Existência dos arquivos
|
|
14
|
+
- ✅ Funcionamento dos scripts de correção
|
|
15
|
+
|
|
16
|
+
### 2. **Teste Completo do Build**
|
|
17
|
+
```bash
|
|
18
|
+
npm run build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Verifica todo o processo:
|
|
22
|
+
- 🔨 Compilação para todas as plataformas
|
|
23
|
+
- 📋 Cópia de configurações
|
|
24
|
+
- 🔐 Definição de permissões
|
|
25
|
+
|
|
26
|
+
### 3. **Teste Individual dos Scripts**
|
|
27
|
+
```bash
|
|
28
|
+
# Teste de cópia de configuração
|
|
29
|
+
npm run copy-config
|
|
30
|
+
|
|
31
|
+
# Teste de definição de permissões
|
|
32
|
+
npm run set-permissions
|
|
33
|
+
|
|
34
|
+
# Teste de correção manual
|
|
35
|
+
npm run fix-permissions
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 4. **Teste com Docker (Linux)**
|
|
39
|
+
```bash
|
|
40
|
+
# Requer Docker instalado
|
|
41
|
+
npm run test-linux
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Simula instalação em ambiente Linux limpo.
|
|
45
|
+
|
|
46
|
+
## Verificação Manual
|
|
47
|
+
|
|
48
|
+
### Verificar Permissões
|
|
49
|
+
```bash
|
|
50
|
+
# Linux/macOS
|
|
51
|
+
ls -la bin/linux-x64/ftc.cli
|
|
52
|
+
ls -la bin/osx-x64/ftc.cli
|
|
53
|
+
ls -la bin/ftc.js
|
|
54
|
+
|
|
55
|
+
# Deve mostrar: -rwxr-xr-x (755)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Testar Execução
|
|
59
|
+
```bash
|
|
60
|
+
# Teste do CLI
|
|
61
|
+
./bin/ftc.js --help
|
|
62
|
+
|
|
63
|
+
# Deve mostrar a ajuda do CLI
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Teste de Publicação
|
|
67
|
+
|
|
68
|
+
### 1. **Teste Local de Publicação**
|
|
69
|
+
```bash
|
|
70
|
+
# Simula publicação sem enviar para npm
|
|
71
|
+
npm run build
|
|
72
|
+
npm pack
|
|
73
|
+
|
|
74
|
+
# Verifica o conteúdo do pacote
|
|
75
|
+
tar -tzf followthecode-cli-*.tgz
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. **Teste de Instalação Local**
|
|
79
|
+
```bash
|
|
80
|
+
# Instala o pacote localmente
|
|
81
|
+
npm install -g ./followthecode-cli-*.tgz
|
|
82
|
+
|
|
83
|
+
# Testa a instalação
|
|
84
|
+
ftc --help
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Cenários de Teste
|
|
88
|
+
|
|
89
|
+
### ✅ **Cenário 1: Build Completo**
|
|
90
|
+
1. Execute `npm run build`
|
|
91
|
+
2. Verifique se todos os arquivos foram criados
|
|
92
|
+
3. Verifique permissões com `npm run test-permissions`
|
|
93
|
+
|
|
94
|
+
### ✅ **Cenário 2: Instalação Limpa**
|
|
95
|
+
1. Delete a pasta `bin/`
|
|
96
|
+
2. Execute `npm run build`
|
|
97
|
+
3. Verifique se as permissões foram definidas
|
|
98
|
+
|
|
99
|
+
### ✅ **Cenário 3: Correção Manual**
|
|
100
|
+
1. Remova permissões: `chmod -x bin/linux-x64/ftc.cli`
|
|
101
|
+
2. Execute `npm run fix-permissions`
|
|
102
|
+
3. Verifique se as permissões foram restauradas
|
|
103
|
+
|
|
104
|
+
### ✅ **Cenário 4: Teste Cross-Platform**
|
|
105
|
+
1. Execute em Windows
|
|
106
|
+
2. Execute em Linux (via Docker)
|
|
107
|
+
3. Execute em macOS (se disponível)
|
|
108
|
+
|
|
109
|
+
## Resultados Esperados
|
|
110
|
+
|
|
111
|
+
### ✅ **Sucesso**
|
|
112
|
+
```
|
|
113
|
+
🧪 Testando permissões de execução...
|
|
114
|
+
|
|
115
|
+
🔍 Verificando arquivos...
|
|
116
|
+
|
|
117
|
+
📁 bin/ftc.js
|
|
118
|
+
Permissões: 755
|
|
119
|
+
Executável: ✅ Sim
|
|
120
|
+
Tamanho: 2048 bytes
|
|
121
|
+
|
|
122
|
+
📁 bin/linux-x64/ftc.cli
|
|
123
|
+
Permissões: 755
|
|
124
|
+
Executável: ✅ Sim
|
|
125
|
+
Tamanho: 51200 bytes
|
|
126
|
+
|
|
127
|
+
📊 Resultado do teste:
|
|
128
|
+
✅ Todas as permissões estão corretas!
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### ❌ **Falha**
|
|
132
|
+
```
|
|
133
|
+
📁 bin/linux-x64/ftc.cli
|
|
134
|
+
Permissões: 644
|
|
135
|
+
Executável: ❌ Não
|
|
136
|
+
Tamanho: 51200 bytes
|
|
137
|
+
|
|
138
|
+
📊 Resultado do teste:
|
|
139
|
+
❌ Algumas permissões precisam ser corrigidas
|
|
140
|
+
💡 Execute: npm run fix-permissions
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Troubleshooting
|
|
144
|
+
|
|
145
|
+
### Problema: "Script não encontrado"
|
|
146
|
+
```bash
|
|
147
|
+
# Verifique se os scripts existem
|
|
148
|
+
ls -la scripts/
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Problema: "Permissão negada"
|
|
152
|
+
```bash
|
|
153
|
+
# No Linux/macOS
|
|
154
|
+
chmod +x scripts/*.js
|
|
155
|
+
chmod +x scripts/*.sh
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Problema: "Docker não encontrado"
|
|
159
|
+
```bash
|
|
160
|
+
# Instale Docker ou use apenas os testes Node.js
|
|
161
|
+
npm run test-permissions
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Próximos Passos
|
|
165
|
+
|
|
166
|
+
Após os testes:
|
|
167
|
+
1. ✅ Se tudo passar: Pronto para publicação
|
|
168
|
+
2. ❌ Se houver falhas: Corrija e teste novamente
|
|
169
|
+
3. 🔄 Para publicação: `npm run publish:patch`
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 🔧 Troubleshooting - Follow The Code CLI
|
|
2
|
+
|
|
3
|
+
## Problemas de Permissão no Linux
|
|
4
|
+
|
|
5
|
+
### Sintoma
|
|
6
|
+
Após instalar a CLI no Linux, você recebe um erro como:
|
|
7
|
+
```
|
|
8
|
+
bash: ./ftc.cli: Permission denied
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Solução Automática
|
|
12
|
+
Execute o comando de correção de permissões:
|
|
13
|
+
```bash
|
|
14
|
+
npm run fix-permissions
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Solução Manual
|
|
18
|
+
Se a solução automática não funcionar, execute manualmente:
|
|
19
|
+
```bash
|
|
20
|
+
chmod +x bin/linux-x64/ftc.cli
|
|
21
|
+
chmod +x bin/ftc.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Verificação
|
|
25
|
+
Para verificar se as permissões estão corretas:
|
|
26
|
+
```bash
|
|
27
|
+
ls -la bin/linux-x64/ftc.cli
|
|
28
|
+
ls -la bin/ftc.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
As permissões devem aparecer como `-rwxr-xr-x` (755).
|
|
32
|
+
|
|
33
|
+
## Outros Problemas Comuns
|
|
34
|
+
|
|
35
|
+
### Erro: "Executável .NET não encontrado"
|
|
36
|
+
Certifique-se de que o projeto foi compilado para todas as plataformas:
|
|
37
|
+
```bash
|
|
38
|
+
npm run build
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Erro: "Plataforma não suportada"
|
|
42
|
+
A CLI suporta apenas:
|
|
43
|
+
- Windows (x64)
|
|
44
|
+
- macOS (x64)
|
|
45
|
+
- Linux (x64)
|
|
46
|
+
|
|
47
|
+
### Problemas de Rede
|
|
48
|
+
Se houver problemas de conectividade, verifique:
|
|
49
|
+
- Configuração de proxy
|
|
50
|
+
- Firewall
|
|
51
|
+
- DNS
|
|
52
|
+
|
|
53
|
+
## Logs de Debug
|
|
54
|
+
Para obter mais informações sobre erros, execute:
|
|
55
|
+
```bash
|
|
56
|
+
ftc --help
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Suporte
|
|
60
|
+
Se os problemas persistirem, abra uma issue no repositório do projeto.
|
package/bin/ftc.js
CHANGED
|
@@ -75,6 +75,24 @@ if (!fs.existsSync(executablePath)) {
|
|
|
75
75
|
process.exit(1);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
// Verifica permissões de execução no Linux/macOS
|
|
79
|
+
if (platform !== 'win32') {
|
|
80
|
+
try {
|
|
81
|
+
const stats = fs.statSync(executablePath);
|
|
82
|
+
const isExecutable = (stats.mode & fs.constants.S_IXUSR) !== 0;
|
|
83
|
+
|
|
84
|
+
if (!isExecutable) {
|
|
85
|
+
console.error('❌ Erro: Arquivo não tem permissões de execução:', executablePath);
|
|
86
|
+
console.error('💡 Execute: npm run fix-permissions');
|
|
87
|
+
console.error('💡 Ou manualmente: chmod +x', executablePath);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('❌ Erro ao verificar permissões:', error.message);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
78
96
|
// Executa o binário .NET
|
|
79
97
|
const executableDir = path.dirname(executablePath);
|
|
80
98
|
const child = spawn(executablePath, args, {
|
|
Binary file
|
|
Binary file
|
|
@@ -29,27 +29,7 @@
|
|
|
29
29
|
"Args": {
|
|
30
30
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{ThreadId}] [{TraceId}/{SpanId}] {Message:lj}{NewLine}{Exception}"
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"Name": "OpenTelemetry",
|
|
35
|
-
"Args": {
|
|
36
|
-
"endpoint": "http://10.0.17.241:4317",
|
|
37
|
-
"protocol": "Grpc",
|
|
38
|
-
"timeout": 1000,
|
|
39
|
-
"batchSizeLimit": 10,
|
|
40
|
-
"period": 1
|
|
41
|
-
}
|
|
42
32
|
}
|
|
43
33
|
]
|
|
44
|
-
},
|
|
45
|
-
"OpenTelemetry": {
|
|
46
|
-
"ServiceName": "ftc.cli",
|
|
47
|
-
"OtlpEndpoint": "http://10.0.17.241:4317"
|
|
48
|
-
},
|
|
49
|
-
"AWS": {
|
|
50
|
-
"Region": "us-east-1",
|
|
51
|
-
"S3": {
|
|
52
|
-
"BucketName": "ftc-analyzer"
|
|
53
|
-
}
|
|
54
34
|
}
|
|
55
35
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"LibGit2Sharp": "0.27.0",
|
|
14
14
|
"Microsoft.Extensions.Configuration.Binder": "9.0.0",
|
|
15
15
|
"Microsoft.Extensions.Configuration.Json": "8.0.0",
|
|
16
|
+
"Microsoft.Extensions.Http": "8.0.0",
|
|
16
17
|
"OpenTelemetry": "1.11.2",
|
|
17
18
|
"OpenTelemetry.Exporter.OpenTelemetryProtocol": "1.11.2",
|
|
18
19
|
"OpenTelemetry.Extensions.Hosting": "1.11.2",
|
|
@@ -910,6 +911,19 @@
|
|
|
910
911
|
}
|
|
911
912
|
}
|
|
912
913
|
},
|
|
914
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
915
|
+
"dependencies": {
|
|
916
|
+
"Microsoft.Extensions.Configuration": "9.0.0",
|
|
917
|
+
"Microsoft.Extensions.Diagnostics.Abstractions": "9.0.0",
|
|
918
|
+
"Microsoft.Extensions.Options.ConfigurationExtensions": "9.0.0"
|
|
919
|
+
},
|
|
920
|
+
"runtime": {
|
|
921
|
+
"lib/net8.0/Microsoft.Extensions.Diagnostics.dll": {
|
|
922
|
+
"assemblyVersion": "8.0.0.0",
|
|
923
|
+
"fileVersion": "8.0.23.53103"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
913
927
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
914
928
|
"dependencies": {
|
|
915
929
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
@@ -970,6 +984,22 @@
|
|
|
970
984
|
}
|
|
971
985
|
}
|
|
972
986
|
},
|
|
987
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
988
|
+
"dependencies": {
|
|
989
|
+
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
|
990
|
+
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
991
|
+
"Microsoft.Extensions.Diagnostics": "8.0.0",
|
|
992
|
+
"Microsoft.Extensions.Logging": "9.0.0",
|
|
993
|
+
"Microsoft.Extensions.Logging.Abstractions": "9.0.0",
|
|
994
|
+
"Microsoft.Extensions.Options": "9.0.0"
|
|
995
|
+
},
|
|
996
|
+
"runtime": {
|
|
997
|
+
"lib/net8.0/Microsoft.Extensions.Http.dll": {
|
|
998
|
+
"assemblyVersion": "8.0.0.0",
|
|
999
|
+
"fileVersion": "8.0.23.53103"
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
973
1003
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
974
1004
|
"dependencies": {
|
|
975
1005
|
"Microsoft.Extensions.DependencyInjection": "9.0.0",
|
|
@@ -1420,6 +1450,13 @@
|
|
|
1420
1450
|
"path": "microsoft.extensions.dependencymodel/9.0.0",
|
|
1421
1451
|
"hashPath": "microsoft.extensions.dependencymodel.9.0.0.nupkg.sha512"
|
|
1422
1452
|
},
|
|
1453
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
1454
|
+
"type": "package",
|
|
1455
|
+
"serviceable": true,
|
|
1456
|
+
"sha512": "sha512-3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==",
|
|
1457
|
+
"path": "microsoft.extensions.diagnostics/8.0.0",
|
|
1458
|
+
"hashPath": "microsoft.extensions.diagnostics.8.0.0.nupkg.sha512"
|
|
1459
|
+
},
|
|
1423
1460
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
1424
1461
|
"type": "package",
|
|
1425
1462
|
"serviceable": true,
|
|
@@ -1455,6 +1492,13 @@
|
|
|
1455
1492
|
"path": "microsoft.extensions.hosting.abstractions/9.0.0",
|
|
1456
1493
|
"hashPath": "microsoft.extensions.hosting.abstractions.9.0.0.nupkg.sha512"
|
|
1457
1494
|
},
|
|
1495
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
1496
|
+
"type": "package",
|
|
1497
|
+
"serviceable": true,
|
|
1498
|
+
"sha512": "sha512-cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==",
|
|
1499
|
+
"path": "microsoft.extensions.http/8.0.0",
|
|
1500
|
+
"hashPath": "microsoft.extensions.http.8.0.0.nupkg.sha512"
|
|
1501
|
+
},
|
|
1458
1502
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
1459
1503
|
"type": "package",
|
|
1460
1504
|
"serviceable": true,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -29,27 +29,7 @@
|
|
|
29
29
|
"Args": {
|
|
30
30
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{ThreadId}] [{TraceId}/{SpanId}] {Message:lj}{NewLine}{Exception}"
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"Name": "OpenTelemetry",
|
|
35
|
-
"Args": {
|
|
36
|
-
"endpoint": "http://10.0.17.241:4317",
|
|
37
|
-
"protocol": "Grpc",
|
|
38
|
-
"timeout": 1000,
|
|
39
|
-
"batchSizeLimit": 10,
|
|
40
|
-
"period": 1
|
|
41
|
-
}
|
|
42
32
|
}
|
|
43
33
|
]
|
|
44
|
-
},
|
|
45
|
-
"OpenTelemetry": {
|
|
46
|
-
"ServiceName": "ftc.cli",
|
|
47
|
-
"OtlpEndpoint": "http://10.0.17.241:4317"
|
|
48
|
-
},
|
|
49
|
-
"AWS": {
|
|
50
|
-
"Region": "us-east-1",
|
|
51
|
-
"S3": {
|
|
52
|
-
"BucketName": "ftc-analyzer"
|
|
53
|
-
}
|
|
54
34
|
}
|
|
55
35
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"LibGit2Sharp": "0.27.0",
|
|
14
14
|
"Microsoft.Extensions.Configuration.Binder": "9.0.0",
|
|
15
15
|
"Microsoft.Extensions.Configuration.Json": "8.0.0",
|
|
16
|
+
"Microsoft.Extensions.Http": "8.0.0",
|
|
16
17
|
"OpenTelemetry": "1.11.2",
|
|
17
18
|
"OpenTelemetry.Exporter.OpenTelemetryProtocol": "1.11.2",
|
|
18
19
|
"OpenTelemetry.Extensions.Hosting": "1.11.2",
|
|
@@ -910,6 +911,19 @@
|
|
|
910
911
|
}
|
|
911
912
|
}
|
|
912
913
|
},
|
|
914
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
915
|
+
"dependencies": {
|
|
916
|
+
"Microsoft.Extensions.Configuration": "9.0.0",
|
|
917
|
+
"Microsoft.Extensions.Diagnostics.Abstractions": "9.0.0",
|
|
918
|
+
"Microsoft.Extensions.Options.ConfigurationExtensions": "9.0.0"
|
|
919
|
+
},
|
|
920
|
+
"runtime": {
|
|
921
|
+
"lib/net8.0/Microsoft.Extensions.Diagnostics.dll": {
|
|
922
|
+
"assemblyVersion": "8.0.0.0",
|
|
923
|
+
"fileVersion": "8.0.23.53103"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
913
927
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
914
928
|
"dependencies": {
|
|
915
929
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
@@ -970,6 +984,22 @@
|
|
|
970
984
|
}
|
|
971
985
|
}
|
|
972
986
|
},
|
|
987
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
988
|
+
"dependencies": {
|
|
989
|
+
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
|
990
|
+
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
991
|
+
"Microsoft.Extensions.Diagnostics": "8.0.0",
|
|
992
|
+
"Microsoft.Extensions.Logging": "9.0.0",
|
|
993
|
+
"Microsoft.Extensions.Logging.Abstractions": "9.0.0",
|
|
994
|
+
"Microsoft.Extensions.Options": "9.0.0"
|
|
995
|
+
},
|
|
996
|
+
"runtime": {
|
|
997
|
+
"lib/net8.0/Microsoft.Extensions.Http.dll": {
|
|
998
|
+
"assemblyVersion": "8.0.0.0",
|
|
999
|
+
"fileVersion": "8.0.23.53103"
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
973
1003
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
974
1004
|
"dependencies": {
|
|
975
1005
|
"Microsoft.Extensions.DependencyInjection": "9.0.0",
|
|
@@ -1420,6 +1450,13 @@
|
|
|
1420
1450
|
"path": "microsoft.extensions.dependencymodel/9.0.0",
|
|
1421
1451
|
"hashPath": "microsoft.extensions.dependencymodel.9.0.0.nupkg.sha512"
|
|
1422
1452
|
},
|
|
1453
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
1454
|
+
"type": "package",
|
|
1455
|
+
"serviceable": true,
|
|
1456
|
+
"sha512": "sha512-3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==",
|
|
1457
|
+
"path": "microsoft.extensions.diagnostics/8.0.0",
|
|
1458
|
+
"hashPath": "microsoft.extensions.diagnostics.8.0.0.nupkg.sha512"
|
|
1459
|
+
},
|
|
1423
1460
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
1424
1461
|
"type": "package",
|
|
1425
1462
|
"serviceable": true,
|
|
@@ -1455,6 +1492,13 @@
|
|
|
1455
1492
|
"path": "microsoft.extensions.hosting.abstractions/9.0.0",
|
|
1456
1493
|
"hashPath": "microsoft.extensions.hosting.abstractions.9.0.0.nupkg.sha512"
|
|
1457
1494
|
},
|
|
1495
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
1496
|
+
"type": "package",
|
|
1497
|
+
"serviceable": true,
|
|
1498
|
+
"sha512": "sha512-cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==",
|
|
1499
|
+
"path": "microsoft.extensions.http/8.0.0",
|
|
1500
|
+
"hashPath": "microsoft.extensions.http.8.0.0.nupkg.sha512"
|
|
1501
|
+
},
|
|
1458
1502
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
1459
1503
|
"type": "package",
|
|
1460
1504
|
"serviceable": true,
|
package/bin/osx-x64/ftc.cli.dll
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -29,27 +29,7 @@
|
|
|
29
29
|
"Args": {
|
|
30
30
|
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{ThreadId}] [{TraceId}/{SpanId}] {Message:lj}{NewLine}{Exception}"
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"Name": "OpenTelemetry",
|
|
35
|
-
"Args": {
|
|
36
|
-
"endpoint": "http://10.0.17.241:4317",
|
|
37
|
-
"protocol": "Grpc",
|
|
38
|
-
"timeout": 1000,
|
|
39
|
-
"batchSizeLimit": 10,
|
|
40
|
-
"period": 1
|
|
41
|
-
}
|
|
42
32
|
}
|
|
43
33
|
]
|
|
44
|
-
},
|
|
45
|
-
"OpenTelemetry": {
|
|
46
|
-
"ServiceName": "ftc.cli",
|
|
47
|
-
"OtlpEndpoint": "http://10.0.17.241:4317"
|
|
48
|
-
},
|
|
49
|
-
"AWS": {
|
|
50
|
-
"Region": "us-east-1",
|
|
51
|
-
"S3": {
|
|
52
|
-
"BucketName": "ftc-analyzer"
|
|
53
|
-
}
|
|
54
34
|
}
|
|
55
35
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"LibGit2Sharp": "0.27.0",
|
|
14
14
|
"Microsoft.Extensions.Configuration.Binder": "9.0.0",
|
|
15
15
|
"Microsoft.Extensions.Configuration.Json": "8.0.0",
|
|
16
|
+
"Microsoft.Extensions.Http": "8.0.0",
|
|
16
17
|
"OpenTelemetry": "1.11.2",
|
|
17
18
|
"OpenTelemetry.Exporter.OpenTelemetryProtocol": "1.11.2",
|
|
18
19
|
"OpenTelemetry.Extensions.Hosting": "1.11.2",
|
|
@@ -910,6 +911,19 @@
|
|
|
910
911
|
}
|
|
911
912
|
}
|
|
912
913
|
},
|
|
914
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
915
|
+
"dependencies": {
|
|
916
|
+
"Microsoft.Extensions.Configuration": "9.0.0",
|
|
917
|
+
"Microsoft.Extensions.Diagnostics.Abstractions": "9.0.0",
|
|
918
|
+
"Microsoft.Extensions.Options.ConfigurationExtensions": "9.0.0"
|
|
919
|
+
},
|
|
920
|
+
"runtime": {
|
|
921
|
+
"lib/net8.0/Microsoft.Extensions.Diagnostics.dll": {
|
|
922
|
+
"assemblyVersion": "8.0.0.0",
|
|
923
|
+
"fileVersion": "8.0.23.53103"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
913
927
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
914
928
|
"dependencies": {
|
|
915
929
|
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
@@ -970,6 +984,22 @@
|
|
|
970
984
|
}
|
|
971
985
|
}
|
|
972
986
|
},
|
|
987
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
988
|
+
"dependencies": {
|
|
989
|
+
"Microsoft.Extensions.Configuration.Abstractions": "9.0.0",
|
|
990
|
+
"Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0",
|
|
991
|
+
"Microsoft.Extensions.Diagnostics": "8.0.0",
|
|
992
|
+
"Microsoft.Extensions.Logging": "9.0.0",
|
|
993
|
+
"Microsoft.Extensions.Logging.Abstractions": "9.0.0",
|
|
994
|
+
"Microsoft.Extensions.Options": "9.0.0"
|
|
995
|
+
},
|
|
996
|
+
"runtime": {
|
|
997
|
+
"lib/net8.0/Microsoft.Extensions.Http.dll": {
|
|
998
|
+
"assemblyVersion": "8.0.0.0",
|
|
999
|
+
"fileVersion": "8.0.23.53103"
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
973
1003
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
974
1004
|
"dependencies": {
|
|
975
1005
|
"Microsoft.Extensions.DependencyInjection": "9.0.0",
|
|
@@ -1420,6 +1450,13 @@
|
|
|
1420
1450
|
"path": "microsoft.extensions.dependencymodel/9.0.0",
|
|
1421
1451
|
"hashPath": "microsoft.extensions.dependencymodel.9.0.0.nupkg.sha512"
|
|
1422
1452
|
},
|
|
1453
|
+
"Microsoft.Extensions.Diagnostics/8.0.0": {
|
|
1454
|
+
"type": "package",
|
|
1455
|
+
"serviceable": true,
|
|
1456
|
+
"sha512": "sha512-3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==",
|
|
1457
|
+
"path": "microsoft.extensions.diagnostics/8.0.0",
|
|
1458
|
+
"hashPath": "microsoft.extensions.diagnostics.8.0.0.nupkg.sha512"
|
|
1459
|
+
},
|
|
1423
1460
|
"Microsoft.Extensions.Diagnostics.Abstractions/9.0.0": {
|
|
1424
1461
|
"type": "package",
|
|
1425
1462
|
"serviceable": true,
|
|
@@ -1455,6 +1492,13 @@
|
|
|
1455
1492
|
"path": "microsoft.extensions.hosting.abstractions/9.0.0",
|
|
1456
1493
|
"hashPath": "microsoft.extensions.hosting.abstractions.9.0.0.nupkg.sha512"
|
|
1457
1494
|
},
|
|
1495
|
+
"Microsoft.Extensions.Http/8.0.0": {
|
|
1496
|
+
"type": "package",
|
|
1497
|
+
"serviceable": true,
|
|
1498
|
+
"sha512": "sha512-cWz4caHwvx0emoYe7NkHPxII/KkTI8R/LC9qdqJqnKv2poTJ4e2qqPGQqvRoQ5kaSA4FU5IV3qFAuLuOhoqULQ==",
|
|
1499
|
+
"path": "microsoft.extensions.http/8.0.0",
|
|
1500
|
+
"hashPath": "microsoft.extensions.http.8.0.0.nupkg.sha512"
|
|
1501
|
+
},
|
|
1458
1502
|
"Microsoft.Extensions.Logging/9.0.0": {
|
|
1459
1503
|
"type": "package",
|
|
1460
1504
|
"serviceable": true,
|
package/bin/win-x64/ftc.cli.dll
CHANGED
|
Binary file
|
package/bin/win-x64/ftc.cli.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@followthecode/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "CLI tool for Git repository analysis and data collection",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -12,12 +12,23 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
|
-
"build": "npm run build:win && npm run build:mac && npm run build:linux && npm run copy-config",
|
|
15
|
+
"build": "npm run build:win && npm run build:mac && npm run build:linux && npm run copy-config && npm run set-permissions",
|
|
16
16
|
"build:win": "dotnet publish ftc.cli.csproj -c Release -r win-x64 --self-contained true -o ./bin/win-x64",
|
|
17
17
|
"build:mac": "dotnet publish ftc.cli.csproj -c Release -r osx-x64 --self-contained true -o ./bin/osx-x64",
|
|
18
18
|
"build:linux": "dotnet publish ftc.cli.csproj -c Release -r linux-x64 --self-contained true -o ./bin/linux-x64",
|
|
19
|
-
"copy-config": "
|
|
19
|
+
"copy-config": "node scripts/copy-config.js",
|
|
20
|
+
"set-permissions": "node scripts/set-permissions.js",
|
|
21
|
+
"postinstall": "node scripts/set-permissions.js",
|
|
22
|
+
"fix-permissions": "node scripts/fix-permissions.js",
|
|
20
23
|
"test": "dotnet test",
|
|
24
|
+
"test-permissions": "node scripts/test-permissions.js",
|
|
25
|
+
"test-linux": "bash scripts/test-linux-permissions.sh",
|
|
26
|
+
"test-local-install": "node scripts/test-local-install.js",
|
|
27
|
+
"test-docker-real": "bash scripts/test-docker-real.sh",
|
|
28
|
+
"test-wsl": "wsl bash scripts/test-wsl-basic.sh",
|
|
29
|
+
"validate-wsl": "wsl bash scripts/validate-wsl.sh",
|
|
30
|
+
"validate-wsl-simple": "wsl bash scripts/validate-wsl-simple.sh",
|
|
31
|
+
"validate-wsl-no-sudo": "wsl bash scripts/validate-wsl-no-sudo.sh",
|
|
21
32
|
"clean": "dotnet clean",
|
|
22
33
|
"publish:patch": "node scripts/publish.js --patch",
|
|
23
34
|
"publish:minor": "node scripts/publish.js --minor",
|
|
@@ -73,8 +84,12 @@
|
|
|
73
84
|
"bin/linux-x64/ftc.cli.deps.json",
|
|
74
85
|
"bin/linux-x64/appsettings.json",
|
|
75
86
|
"bin/linux-x64/*.dll",
|
|
87
|
+
"scripts/set-permissions.js",
|
|
88
|
+
"scripts/fix-permissions.js",
|
|
76
89
|
"README.md",
|
|
77
|
-
"LICENSE"
|
|
90
|
+
"LICENSE",
|
|
91
|
+
"TROUBLESHOOTING.md",
|
|
92
|
+
"TESTING.md"
|
|
78
93
|
],
|
|
79
94
|
"dependencies": {
|
|
80
95
|
"@followthecode/cli": "^1.0.1",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
console.log('🔧 Corrigindo permissões de execução...');
|
|
7
|
+
|
|
8
|
+
// Função para definir permissões recursivamente
|
|
9
|
+
function setExecutablePermissions(dir) {
|
|
10
|
+
if (!fs.existsSync(dir)) {
|
|
11
|
+
console.warn(`⚠️ Diretório não encontrado: ${dir}`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const items = fs.readdirSync(dir);
|
|
16
|
+
|
|
17
|
+
items.forEach(item => {
|
|
18
|
+
const fullPath = path.join(dir, item);
|
|
19
|
+
const stat = fs.statSync(fullPath);
|
|
20
|
+
|
|
21
|
+
if (stat.isDirectory()) {
|
|
22
|
+
setExecutablePermissions(fullPath);
|
|
23
|
+
} else if (stat.isFile()) {
|
|
24
|
+
// Define permissões de execução para arquivos binários
|
|
25
|
+
const isExecutable = item === 'ftc.cli' || item === 'ftc.js' || item.endsWith('.exe');
|
|
26
|
+
|
|
27
|
+
if (isExecutable) {
|
|
28
|
+
try {
|
|
29
|
+
fs.chmodSync(fullPath, 0o755);
|
|
30
|
+
console.log(`✅ Permissões corrigidas: ${fullPath}`);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error(`❌ Erro ao corrigir permissões para ${fullPath}:`, error.message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Define permissões para os diretórios das plataformas
|
|
40
|
+
const platforms = ['linux-x64', 'osx-x64'];
|
|
41
|
+
platforms.forEach(platform => {
|
|
42
|
+
const platformDir = path.join('bin', platform);
|
|
43
|
+
setExecutablePermissions(platformDir);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Define permissões para o arquivo ftc.js
|
|
47
|
+
const ftcJsPath = path.join('bin', 'ftc.js');
|
|
48
|
+
if (fs.existsSync(ftcJsPath)) {
|
|
49
|
+
try {
|
|
50
|
+
fs.chmodSync(ftcJsPath, 0o755);
|
|
51
|
+
console.log(`✅ Permissões corrigidas: ${ftcJsPath}`);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(`❌ Erro ao corrigir permissões para ${ftcJsPath}:`, error.message);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log('✅ Correção de permissões concluída!');
|
|
58
|
+
console.log('💡 Se ainda houver problemas, execute manualmente: chmod +x bin/linux-x64/ftc.cli');
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
console.log('🔐 Definindo permissões de execução...');
|
|
6
|
+
|
|
7
|
+
// Detecta a plataforma
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const isWindows = platform === 'win32';
|
|
10
|
+
|
|
11
|
+
const platforms = [
|
|
12
|
+
{ dir: 'linux-x64', executable: 'ftc.cli' },
|
|
13
|
+
{ dir: 'osx-x64', executable: 'ftc.cli' }
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
platforms.forEach(platformConfig => {
|
|
17
|
+
const executablePath = path.join('bin', platformConfig.dir, platformConfig.executable);
|
|
18
|
+
|
|
19
|
+
if (fs.existsSync(executablePath)) {
|
|
20
|
+
try {
|
|
21
|
+
if (isWindows) {
|
|
22
|
+
// No Windows, tenta definir permissões mesmo assim
|
|
23
|
+
try {
|
|
24
|
+
fs.chmodSync(executablePath, 0o755);
|
|
25
|
+
console.log(`✅ Permissões definidas para ${executablePath} (Windows)`);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.log(`✅ Arquivo preparado para ${executablePath} (Windows - permissões não aplicáveis)`);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
// No Linux/macOS, define permissões reais
|
|
31
|
+
fs.chmodSync(executablePath, 0o755);
|
|
32
|
+
console.log(`✅ Permissões definidas para ${executablePath}`);
|
|
33
|
+
}
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error(`❌ Erro ao definir permissões para ${executablePath}:`, error.message);
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
console.warn(`⚠️ Executável não encontrado: ${executablePath}`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Também define permissões para o arquivo ftc.js
|
|
43
|
+
const ftcJsPath = path.join('bin', 'ftc.js');
|
|
44
|
+
if (fs.existsSync(ftcJsPath)) {
|
|
45
|
+
try {
|
|
46
|
+
if (isWindows) {
|
|
47
|
+
try {
|
|
48
|
+
fs.chmodSync(ftcJsPath, 0o755);
|
|
49
|
+
console.log(`✅ Permissões definidas para ${ftcJsPath} (Windows)`);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log(`✅ Arquivo preparado para ${ftcJsPath} (Windows - permissões não aplicáveis)`);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
fs.chmodSync(ftcJsPath, 0o755);
|
|
55
|
+
console.log(`✅ Permissões definidas para ${ftcJsPath}`);
|
|
56
|
+
}
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(`❌ Erro ao definir permissões para ${ftcJsPath}:`, error.message);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log('✅ Permissões de execução definidas com sucesso');
|