@followthecode/cli 1.0.5 → 1.0.7

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/ftc.js CHANGED
@@ -2,72 +2,70 @@
2
2
 
3
3
  const { spawn } = require('child_process');
4
4
  const path = require('path');
5
- const fs = require('fs');
6
5
 
7
- // Determina o executável baseado na plataforma
8
- function getExecutablePath() {
9
- const platform = process.platform;
10
- // Caminho base do executável
11
- const basePath = path.join(__dirname, 'publish');
12
- let executableName = 'ftc.cli';
13
- if (platform === 'win32') {
14
- executableName += '.exe';
15
- }
16
- const executablePath = path.join(basePath, executableName);
17
- if (!fs.existsSync(executablePath)) {
18
- console.error(`❌ Executável não encontrado: ${executablePath}`);
19
- console.error('Execute "npm run build" para compilar o projeto .NET');
20
- process.exit(1);
21
- }
22
- return executablePath;
23
- }
6
+ // Obtém o caminho do executável .NET
7
+ const executablePath = path.join(__dirname, 'publish', 'ftc.cli.exe');
8
+
9
+ // Argumentos passados para o comando
10
+ const args = process.argv.slice(2);
11
+
12
+ // Se não argumentos ou é --help, mostra o help customizado
13
+ if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
14
+ console.log(`
15
+ 🚀 Follow The Code CLI - Ferramenta de Análise de Repositórios Git
16
+
17
+ 📋 USO:
18
+ ftc <comando> [opções]
19
+
20
+ 📝 COMANDOS:
21
+ collect code <repo> Analisa um repositório Git e coleta dados
24
22
 
25
- function main() {
26
- const executablePath = getExecutablePath();
27
- const args = process.argv.slice(2);
23
+ 📊 OPÇÕES DE EXPORTAÇÃO:
24
+ --csv Exporta resultados em formato CSV
25
+ --json Exporta resultados em formato JSON
26
+ --export <destino> Define o destino da exportação
28
27
 
29
- // Help customizado amigável
30
- if (args.length === 0 || (args.length === 1 && (args[0] === '--help' || args[0] === '-h' || args[0] === '-?'))) {
31
- console.log('FTC - Ferramenta CLI para análise de repositórios Git');
32
- console.log('');
33
- console.log('Uso:');
34
- console.log(' ftc collect code <repository> [options]');
35
- console.log('');
36
- console.log('Argumentos:');
37
- console.log(' <repository> Caminho local ou URL do repositório Git');
38
- console.log('');
39
- console.log('Opções:');
40
- console.log(' -s, --startDate <startDate> Data inicial (yyyy-MM-dd)');
41
- console.log(' -e, --endDate <endDate> Data final (yyyy-MM-dd)');
42
- console.log(' -j, --json Exportar resultado em JSON');
43
- console.log(' -c, --csv Exportar resultado em CSV detalhado');
44
- console.log(' -x, --export <export> Destino de exportação: local:/caminho/arquivo.json ou s3');
45
- console.log(' -h, --help Mostra esta mensagem de ajuda');
46
- console.log('');
47
- console.log('Exemplos:');
48
- console.log(' ftc collect code https://github.com/user/repo');
49
- console.log(' ftc collect code https://github.com/user/repo --csv');
50
- console.log(' ftc collect code https://github.com/user/repo --json --export s3');
51
- console.log(' ftc collect code https://github.com/user/repo --csv --export local:./output.csv');
52
- console.log('');
53
- return;
54
- }
28
+ 🎯 DESTINOS DE EXPORTAÇÃO:
29
+ local:<caminho> Salva arquivo local (ex: local:./output.csv)
30
+ s3:<bucket>/<key> Envia para AWS S3 (ex: s3:meu-bucket/resultado.csv)
55
31
 
56
- // Executa o binário .NET
57
- const executableDir = path.dirname(executablePath);
58
- const child = spawn(executablePath, args, {
59
- stdio: 'inherit',
60
- cwd: executableDir
61
- });
62
- child.on('close', (code) => process.exit(code));
63
- child.on('error', (error) => {
64
- console.error('❌ Erro ao executar FTC CLI:', error.message);
65
- process.exit(1);
66
- });
32
+ 📖 EXEMPLOS:
33
+ ftc collect code https://github.com/user/repo --csv --export local:./resultado.csv
34
+ ftc collect code https://github.com/user/repo --json --export s3:meu-bucket/analise.json
35
+ ftc collect code https://github.com/user/repo --csv
36
+
37
+ 🔧 OPÇÕES GLOBAIS:
38
+ --help, -h Mostra esta ajuda
39
+ --version, -v Mostra a versão
40
+
41
+ 📚 MAIS INFORMAÇÕES:
42
+ Visite: https://github.com/your-org/follow-the-code
43
+ `);
44
+ process.exit(0);
67
45
  }
68
46
 
69
- if (require.main === module) {
70
- main();
47
+ // Verifica se o executável existe
48
+ const fs = require('fs');
49
+ if (!fs.existsSync(executablePath)) {
50
+ console.error('❌ Erro: Executável .NET não encontrado em:', executablePath);
51
+ console.error('💡 Certifique-se de que o projeto foi compilado corretamente.');
52
+ process.exit(1);
71
53
  }
72
54
 
73
- module.exports = { main, getExecutablePath };
55
+ // Executa o binário .NET
56
+ const executableDir = path.dirname(executablePath);
57
+ const child = spawn(executablePath, args, {
58
+ stdio: 'inherit',
59
+ cwd: executableDir
60
+ });
61
+
62
+ // Aguarda o processo terminar
63
+ child.on('close', (code) => {
64
+ process.exit(code);
65
+ });
66
+
67
+ // Trata erros
68
+ child.on('error', (error) => {
69
+ console.error('❌ Erro ao executar o CLI:', error.message);
70
+ process.exit(1);
71
+ });
@@ -0,0 +1,51 @@
1
+ {
2
+ "Serilog": {
3
+ "MinimumLevel": {
4
+ "Default": "Information",
5
+ "Override": {
6
+ "Microsoft": "Warning",
7
+ "System": "Warning"
8
+ }
9
+ },
10
+ "Enrich": [
11
+ "FromLogContext",
12
+ "WithThreadId",
13
+ "WithMachineName",
14
+ "WithEnvironmentUserName",
15
+ "WithExceptionDetails",
16
+ "WithOpenTelemetryTraceId",
17
+ "WithOpenTelemetrySpanId"
18
+ ],
19
+ "Properties": {
20
+ "ApplicationName": "FTC-CLI"
21
+ },
22
+ "WriteTo": [
23
+ {
24
+ "Name": "Console",
25
+ "Args": {
26
+ "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{ThreadId}] [{TraceId}/{SpanId}] {Message:lj}{NewLine}{Exception}"
27
+ }
28
+ },
29
+ {
30
+ "Name": "OpenTelemetry",
31
+ "Args": {
32
+ "endpoint": "http://10.0.17.241:4317",
33
+ "protocol": "Grpc",
34
+ "timeout": 1000,
35
+ "batchSizeLimit": 10,
36
+ "period": 1
37
+ }
38
+ }
39
+ ]
40
+ },
41
+ "OpenTelemetry": {
42
+ "ServiceName": "ftc.cli",
43
+ "OtlpEndpoint": "http://10.0.17.241:4317"
44
+ },
45
+ "AWS": {
46
+ "Region": "us-east-1",
47
+ "S3": {
48
+ "BucketName": "ftc-analyzer"
49
+ }
50
+ }
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@followthecode/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "CLI tool for Git repository analysis and data collection",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
@@ -55,6 +55,7 @@
55
55
  "files": [
56
56
  "bin/ftc.js",
57
57
  "bin/publish/ftc.cli.exe",
58
+ "bin/publish/appsettings.json",
58
59
  "README.md",
59
60
  "LICENSE"
60
61
  ],