@kabran-tecnologia/kabran-config 1.5.0 → 1.7.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.
@@ -0,0 +1,111 @@
1
+ # Kabran CI Quality Workflow
2
+ #
3
+ # This workflow runs the Kabran CI pipeline and posts quality reports to PRs.
4
+ #
5
+ # Usage:
6
+ # Copy this file to your project's .github/workflows/ directory.
7
+ # Customize the ci-config.sh to define your project's CI steps.
8
+ #
9
+ # Requirements:
10
+ # - scripts/ci-config.sh with PROJECT_NAME, PM, and ci_steps() defined
11
+ # - @kabran-tecnologia/kabran-config installed as dev dependency
12
+
13
+ name: CI Quality
14
+
15
+ on:
16
+ push:
17
+ branches: [main]
18
+ pull_request:
19
+ branches: [main]
20
+
21
+ # Cancel in-progress runs for the same branch
22
+ concurrency:
23
+ group: ${{ github.workflow }}-${{ github.ref }}
24
+ cancel-in-progress: true
25
+
26
+ jobs:
27
+ ci:
28
+ name: CI Pipeline
29
+ runs-on: ubuntu-latest
30
+
31
+ permissions:
32
+ contents: read
33
+ pull-requests: write # Required for PR comments
34
+
35
+ steps:
36
+ - name: Checkout
37
+ uses: actions/checkout@v4
38
+ with:
39
+ fetch-depth: 0 # Full history for baseline comparison
40
+
41
+ - name: Setup Node.js
42
+ uses: actions/setup-node@v4
43
+ with:
44
+ node-version: '20'
45
+ cache: 'npm'
46
+
47
+ - name: Install dependencies
48
+ run: npm ci
49
+
50
+ - name: Run CI Pipeline
51
+ id: ci
52
+ env:
53
+ CI_USE_V2: 'true'
54
+ CI_OUTPUT_FILE_V2: 'docs/quality/ci-result.json'
55
+ # CI_SCOPE: 'all' # Uncomment and set to filter by component
56
+ run: |
57
+ # Run CI using kabran-config runner
58
+ npx kabran-ci || exit_code=$?
59
+
60
+ # Ensure ci-result.json exists
61
+ if [ -f "docs/quality/ci-result.json" ]; then
62
+ echo "ci_result_exists=true" >> $GITHUB_OUTPUT
63
+ else
64
+ echo "ci_result_exists=false" >> $GITHUB_OUTPUT
65
+ fi
66
+
67
+ exit ${exit_code:-0}
68
+
69
+ - name: Generate PR Comment
70
+ if: github.event_name == 'pull_request' && steps.ci.outputs.ci_result_exists == 'true'
71
+ id: comment
72
+ run: |
73
+ # Generate quality comparison comment
74
+ npx kabran-pr-comment \
75
+ --current docs/quality/ci-result.json \
76
+ --baseline-branch ${{ github.base_ref }} \
77
+ --output /tmp/pr-comment.md || true
78
+
79
+ if [ -f "/tmp/pr-comment.md" ]; then
80
+ echo "comment_exists=true" >> $GITHUB_OUTPUT
81
+ fi
82
+
83
+ - name: Post PR Comment
84
+ if: github.event_name == 'pull_request' && steps.comment.outputs.comment_exists == 'true'
85
+ uses: marocchino/sticky-pull-request-comment@v2
86
+ with:
87
+ header: kabran-quality
88
+ path: /tmp/pr-comment.md
89
+
90
+ - name: Upload CI Result
91
+ if: always() && steps.ci.outputs.ci_result_exists == 'true'
92
+ uses: actions/upload-artifact@v4
93
+ with:
94
+ name: ci-result
95
+ path: docs/quality/ci-result.json
96
+ retention-days: 30
97
+
98
+ - name: Commit CI Result (main only)
99
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.ci.outputs.ci_result_exists == 'true'
100
+ run: |
101
+ git config user.name "github-actions[bot]"
102
+ git config user.email "github-actions[bot]@users.noreply.github.com"
103
+
104
+ # Only commit if there are changes
105
+ if git diff --quiet docs/quality/ci-result.json; then
106
+ echo "No changes to ci-result.json"
107
+ else
108
+ git add docs/quality/ci-result.json
109
+ git commit -m "chore(ci): update ci-result.json [skip ci]"
110
+ git push
111
+ fi
@@ -0,0 +1,118 @@
1
+ # =============================================================================
2
+ # Kabran Telemetry Configuration
3
+ # =============================================================================
4
+ # All variables are optional. Defaults are shown in comments.
5
+ # Copy this file to your project and rename to .env or .env.local
6
+ #
7
+ # Documentation: https://github.com/kabran-owner/kabran-config#telemetry
8
+
9
+ # =============================================================================
10
+ # Core Configuration
11
+ # =============================================================================
12
+
13
+ # Enable/disable telemetry (default: true in production, false otherwise)
14
+ # OTEL_ENABLED=true
15
+
16
+ # Service name (REQUIRED for telemetry to work)
17
+ # SERVICE_NAME=my-service
18
+
19
+ # Service version (default: 1.0.0)
20
+ # SERVICE_VERSION=1.0.0
21
+
22
+ # Environment name (default: from NODE_ENV)
23
+ # ENVIRONMENT=production
24
+
25
+ # Service namespace for grouping (default: kabran)
26
+ # OTEL_NAMESPACE=kabran
27
+ # SERVICE_NAMESPACE=kabran
28
+
29
+ # =============================================================================
30
+ # OTLP Exporter Configuration
31
+ # =============================================================================
32
+
33
+ # OTLP collector endpoint (default: https://otel.kabran.com.br)
34
+ # OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.kabran.com.br
35
+ # OTEL_ENDPOINT=https://otel.kabran.com.br
36
+
37
+ # Traces endpoint path (default: /v1/traces)
38
+ # OTEL_EXPORTER_OTLP_TRACES_PATH=/v1/traces
39
+
40
+ # Export timeout in milliseconds
41
+ # Node.js (default: 10000)
42
+ # OTEL_EXPORTER_OTLP_TIMEOUT=10000
43
+ # Edge/Serverless (default: 5000)
44
+ # OTEL_EXPORTER_OTLP_TIMEOUT_EDGE=5000
45
+
46
+ # Sampling rate 0.0-1.0 (default: 0.1 = 10%)
47
+ # OTEL_SAMPLE_RATE=0.1
48
+
49
+ # =============================================================================
50
+ # BatchSpanProcessor - Node.js
51
+ # =============================================================================
52
+ # Used for long-running processes (servers, workers)
53
+
54
+ # Maximum spans in queue before dropping (default: 2048)
55
+ # OTEL_BSP_MAX_QUEUE_SIZE=2048
56
+
57
+ # Maximum spans per export batch (default: 512)
58
+ # OTEL_BSP_MAX_EXPORT_BATCH_SIZE=512
59
+
60
+ # Delay between exports in milliseconds (default: 5000)
61
+ # OTEL_BSP_SCHEDULE_DELAY=5000
62
+
63
+ # =============================================================================
64
+ # BatchSpanProcessor - Frontend
65
+ # =============================================================================
66
+ # Optimized for browser environments (smaller batches, faster flush)
67
+
68
+ # Maximum spans in queue (default: 100)
69
+ # OTEL_BSP_MAX_QUEUE_SIZE_FRONTEND=100
70
+
71
+ # Maximum spans per export batch (default: 10)
72
+ # OTEL_BSP_MAX_EXPORT_BATCH_SIZE_FRONTEND=10
73
+
74
+ # Delay between exports in milliseconds (default: 500)
75
+ # OTEL_BSP_SCHEDULE_DELAY_FRONTEND=500
76
+
77
+ # =============================================================================
78
+ # Frontend Instrumentation
79
+ # =============================================================================
80
+
81
+ # CORS URLs for trace header propagation (comma-separated regex patterns)
82
+ # Default: .*\.supabase\.co,.*\.kabran\.com\.br,localhost
83
+ # OTEL_PROPAGATE_TRACE_HEADER_CORS_URLS=.*\.supabase\.co,.*\.kabran\.com\.br,localhost
84
+
85
+ # User interaction events to trace (comma-separated)
86
+ # Default: click,submit
87
+ # OTEL_USER_INTERACTION_EVENTS=click,submit
88
+
89
+ # =============================================================================
90
+ # Middleware Configuration (Node.js)
91
+ # =============================================================================
92
+
93
+ # Paths to ignore in telemetry middleware (comma-separated)
94
+ # Default: /health,/ready,/metrics
95
+ # OTEL_IGNORE_PATHS=/health,/ready,/metrics
96
+
97
+ # =============================================================================
98
+ # Error Response Configuration (Edge)
99
+ # =============================================================================
100
+
101
+ # Error message for unhandled errors (default: Internal server error)
102
+ # OTEL_ERROR_MESSAGE=Internal server error
103
+
104
+ # Error code for unhandled errors (default: INTERNAL_ERROR)
105
+ # OTEL_ERROR_CODE=INTERNAL_ERROR
106
+
107
+ # =============================================================================
108
+ # Logger Configuration
109
+ # =============================================================================
110
+
111
+ # Trace ID display length in logs (default: 8)
112
+ # OTEL_LOG_TRACE_ID_LENGTH=8
113
+
114
+ # Disable ANSI colors in logs (set to any value to disable)
115
+ # NO_COLOR=1
116
+
117
+ # Force enable/disable colors (overrides NO_COLOR)
118
+ # FORCE_COLOR=true