Skip to content

Commit af15cfd

Browse files
committed
chore: improve self-healing ci docs and integrations
Made-with: Cursor
1 parent 84557d9 commit af15cfd

89 files changed

Lines changed: 4364 additions & 1970 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copy to .env and fill in values. Never commit .env.
2+
3+
# --- GitHub App (required for apps/github-app and worker GitHub API calls) ---
4+
GITHUB_APP_ID=
5+
# PEM contents with literal \n newlines, or path-style single line
6+
GITHUB_PRIVATE_KEY=
7+
GITHUB_WEBHOOK_SECRET=
8+
9+
# --- Anthropic (required for diagnosis unless SELF_HEALING_DRY_RUN=true) ---
10+
ANTHROPIC_API_KEY=
11+
12+
# --- Temporal ---
13+
TEMPORAL_SERVER_URL=127.0.0.1:7233
14+
TEMPORAL_NAMESPACE=default
15+
TEMPORAL_TASK_QUEUE=self-healing-ci
16+
TEMPORAL_TLS_ENABLED=false
17+
TEMPORAL_CONNECTION_TIMEOUT=10000
18+
TEMPORAL_MAX_RETRIES=3
19+
20+
# --- Redis (deduplication, workflow state; optional — falls back if unavailable) ---
21+
REDIS_URL=redis://127.0.0.1:6379
22+
23+
# --- Self-healing controls ---
24+
SELF_HEALING_ENABLED=true
25+
SELF_HEALING_DRY_RUN=false
26+
SELF_HEALING_MAX_RUNS_PER_DAY=20
27+
SELF_HEALING_AUTO_MERGE=false
28+
# Comma-separated substrings; workflow name must contain one (case-insensitive). Empty = default (ci,test,build,lint)
29+
SELF_HEALING_WORKFLOW_ALLOWLIST=
30+
PATCH_BACKEND=github
31+
# run-tests activity: command and wall-clock timeout
32+
SELF_HEALING_TEST_COMMAND=pnpm test
33+
SELF_HEALING_TEST_TIMEOUT_MS=600000
34+
# auto | http | docker | local | disabled — see README for backend selection
35+
SELF_HEALING_TEST_EXECUTION_MODE=auto
36+
# Absolute path to a repo checkout (local shell tests, and default host mount for Docker Freestyle)
37+
SELF_HEALING_TEST_WORKDIR=
38+
# In auto mode, use @self-healing-ci/freestyle Docker backend when true (needs Docker + WORKDIR)
39+
FREESTYLE_USE_DOCKER=false
40+
# Host path to bind into the test container (defaults to SELF_HEALING_TEST_WORKDIR)
41+
FREESTYLE_HOST_WORKSPACE=
42+
FREESTYLE_DOCKER_IMAGE=node
43+
FREESTYLE_DOCKER_TAG=20-bookworm
44+
FREESTYLE_CONTAINER_WORKSPACE=/workspace
45+
FREESTYLE_CONTAINER_WORKDIR=/workspace
46+
FREESTYLE_DOCKER_SOCKET=
47+
FREESTYLE_RETRY_COUNT=2
48+
49+
# --- Optional: Morph API (when PATCH_BACKEND=morph) ---
50+
MORPH_API_KEY=
51+
MORPH_API_URL=https://api.morph.dev
52+
53+
# --- Optional: Freestyle HTTP API (POST /v1/test-runs) ---
54+
FREESTYLE_API_KEY=
55+
FREESTYLE_API_URL=https://api.freestyle.dev
56+
57+
# --- Optional: Lean proofs (HTTP or local @self-healing-ci/lean) ---
58+
LEAN_PROOFS_EXECUTION_MODE=auto
59+
LEAN_LOCAL_WORKSPACE=/tmp/lean-proofs
60+
LEAN_LOCAL_TIMEOUT_MS=120000
61+
LEAN_API_KEY=
62+
LEAN_API_URL=https://api.lean.dev
63+
64+
# --- Ops / observability ---
65+
LOG_LEVEL=info
66+
METRICS_PORT=9090
67+
JAEGER_ENDPOINT=http://localhost:14268/api/traces
68+
OPSGENIE_API_KEY=
69+
# Optional: POST CloudEvents 1.0 JSON to this URL (Bearer token optional)
70+
CLOUDEVENTS_INGEST_URL=
71+
CLOUDEVENTS_INGEST_TOKEN=
72+
73+
# --- AWS (deduplication DynamoDB fallback) ---
74+
AWS_REGION=us-east-1
75+
DYNAMODB_TABLE=self-healing-ci-dedup
76+
77+
# --- App servers ---
78+
PORT=3000
79+
HOST=0.0.0.0

.eslintrc.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,34 @@ module.exports = {
1515
'prefer-const': 'error',
1616
'no-var': 'error',
1717
},
18-
ignorePatterns: ['dist/', 'node_modules/', '*.js', '*.ts'],
18+
ignorePatterns: [
19+
'dist/',
20+
'node_modules/',
21+
'coverage/',
22+
'.eslintrc.js',
23+
'commitlint.config.js',
24+
'jest.config.js',
25+
'**/*.d.ts',
26+
],
27+
overrides: [
28+
{
29+
files: ['**/*.ts'],
30+
excludedFiles: ['**/*.d.ts'],
31+
parser: '@typescript-eslint/parser',
32+
parserOptions: {
33+
ecmaVersion: 2022,
34+
sourceType: 'module',
35+
},
36+
plugins: ['@typescript-eslint'],
37+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
38+
rules: {
39+
'@typescript-eslint/no-unused-vars': [
40+
'warn',
41+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
42+
],
43+
'@typescript-eslint/no-explicit-any': 'warn',
44+
'no-undef': 'off',
45+
},
46+
},
47+
],
1948
};

.github/pull_request_template.md

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,52 @@
11
## Description
22

3-
<!-- Provide a clear and concise description of the changes -->
4-
5-
## Type of Change
6-
7-
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
8-
- [ ] ✨ New feature (non-breaking change which adds functionality)
9-
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
10-
- [ ] 📚 Documentation update
11-
- [ ] 🔧 Refactoring (no functional changes)
12-
- [ ] ⚡ Performance improvement
13-
- [ ] 🧪 Test addition or update
14-
- [ ] 🔒 Security improvement
15-
- [ ] 🏗️ Build system change
16-
- [ ] 🔄 CI/CD change
17-
- [ ] 🎨 Style change (formatting, missing semi colons, etc; no logic change)
18-
- [ ] 🧹 Chore (updates to dependencies, etc)
19-
20-
## Scope
21-
22-
<!-- Select the scope of your changes -->
23-
24-
- [ ] github-app - GitHub App listener and webhook handling
25-
- [ ] temporal - Temporal.io workflow orchestration
26-
- [ ] claude - Claude AI integration for diagnosis
27-
- [ ] morph - Morph API integration for code patching
28-
- [ ] freestyle - Freestyle testing framework
29-
- [ ] lean - Lean 4 formal verification
30-
- [ ] diagnosis - Root cause analysis engine
31-
- [ ] patching - Automated code patching
32-
- [ ] testing - Test framework and execution
33-
- [ ] proofs - Formal proof generation
34-
- [ ] merge - Auto-merge functionality
35-
- [ ] observability - Metrics, tracing, and monitoring
36-
- [ ] security - Security hardening and compliance
37-
- [ ] docs - Documentation updates
38-
- [ ] deps - Dependency updates
3+
<!-- Clear description of the change -->
4+
5+
## Type of change
6+
7+
- [ ] Bug fix (non-breaking)
8+
- [ ] New feature (non-breaking)
9+
- [ ] Breaking change
10+
- [ ] Documentation only
11+
- [ ] Refactor (no behavior change)
12+
- [ ] Performance
13+
- [ ] Tests
14+
- [ ] Security
15+
- [ ] Build / CI
16+
- [ ] Style (formatting only)
17+
- [ ] Chore (deps, tooling)
18+
19+
## Scope (check all that apply)
20+
21+
- [ ] `apps/github-app`
22+
- [ ] `apps/temporal-worker`
23+
- [ ] `services/claude`
24+
- [ ] `services/morph`
25+
- [ ] `services/freestyle`
26+
- [ ] `services/lean`
27+
- [ ] Docs
28+
- [ ] CI / GitHub Actions
29+
- [ ] Root tooling or config
3930

4031
## Testing
4132

42-
<!-- Describe the tests that you ran to verify your changes -->
33+
<!-- How you verified the change -->
4334

44-
- [ ] Unit tests pass
45-
- [ ] Integration tests pass
46-
- [ ] End-to-end tests pass
47-
- [ ] Type checking passes
48-
- [ ] Linting passes
49-
- [ ] Security scans pass
50-
- [ ] Performance benchmarks pass
35+
- [ ] Unit tests pass (`pnpm test` where relevant)
36+
- [ ] Typecheck passes (`pnpm type-check` or package `tsc --noEmit`)
37+
- [ ] Lint passes (`pnpm lint`)
38+
- [ ] Ran full `pnpm validate` at repo root
5139

5240
## Checklist
5341

54-
- [ ] My code follows the style guidelines of this project
55-
- [ ] I have performed a self-review of my own code
56-
- [ ] I have commented my code, particularly in hard-to-understand areas
57-
- [ ] I have made corresponding changes to the documentation
58-
- [ ] My changes generate no new warnings
59-
- [ ] I have added tests that prove my fix is effective or that my feature works
60-
- [ ] New and existing unit tests pass locally with my changes
61-
- [ ] Any dependent changes have been merged and published in downstream modules
62-
- [ ] I have updated the changelog if appropriate
63-
- [ ] I have added/updated security documentation if applicable
64-
65-
## Breaking Changes
66-
67-
<!-- If this PR contains breaking changes, describe them here -->
68-
69-
## Additional Notes
42+
- [ ] Self-review completed
43+
- [ ] Documentation updated (README / `docs/` if behavior or env vars changed)
44+
- [ ] No new avoidable warnings; tests added or updated where appropriate
7045

71-
<!-- Add any other context about the pull request here -->
46+
## Breaking changes
7247

73-
## Related Issues
48+
<!-- If any, describe migration -->
7449

75-
<!-- Link to any related issues -->
50+
## Related issues
7651

77-
Closes #
52+
<!-- Closes # -->

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 20
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: pnpm/action-setup@v4
17+
with:
18+
version: 8
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'pnpm'
24+
25+
- name: Install dependencies
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Build Claude service (types for worker)
29+
run: pnpm --filter @self-healing-ci/claude run build
30+
31+
- name: Build Freestyle and Lean (worker optional backends)
32+
run: |
33+
pnpm --filter @self-healing-ci/freestyle run build
34+
pnpm --filter @self-healing-ci/lean run build
35+
36+
- name: Typecheck
37+
run: |
38+
pnpm --filter @self-healing-ci/temporal-worker exec tsc --noEmit
39+
pnpm --filter @self-healing-ci/github-app exec tsc --noEmit
40+
41+
- name: Lint
42+
run: |
43+
pnpm --filter @self-healing-ci/temporal-worker run lint
44+
pnpm --filter @self-healing-ci/github-app run lint
45+
46+
- name: Test
47+
run: |
48+
pnpm --filter @self-healing-ci/temporal-worker test
49+
pnpm --filter @self-healing-ci/github-app test
50+
51+
- name: Audit (informational)
52+
run: pnpm audit --audit-level=high
53+
continue-on-error: true

0 commit comments

Comments
 (0)