gitpadi 2.0.6 → 2.1.1
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/.gitlab/duo/chat-rules.md +40 -0
- package/.gitlab/duo/mr-review-instructions.md +44 -0
- package/.gitlab-ci.yml +136 -0
- package/README.md +585 -57
- package/action.yml +21 -2
- package/dist/applicant-scorer.js +27 -105
- package/dist/cli.js +1082 -36
- package/dist/commands/apply-for-issue.js +396 -0
- package/dist/commands/bounty-hunter.js +441 -0
- package/dist/commands/contribute.js +245 -51
- package/dist/commands/gitlab-issues.js +87 -0
- package/dist/commands/gitlab-mrs.js +163 -0
- package/dist/commands/gitlab-pipelines.js +95 -0
- package/dist/commands/prs.js +3 -3
- package/dist/core/github.js +28 -0
- package/dist/core/gitlab.js +233 -0
- package/dist/gitlab-agents/ci-recovery-agent.js +173 -0
- package/dist/gitlab-agents/contributor-scoring-agent.js +159 -0
- package/dist/gitlab-agents/grade-assignment-agent.js +252 -0
- package/dist/gitlab-agents/mr-review-agent.js +200 -0
- package/dist/gitlab-agents/reminder-agent.js +164 -0
- package/dist/grade-assignment.js +262 -0
- package/dist/remind-contributors.js +127 -0
- package/dist/review-and-merge.js +125 -0
- package/examples/gitpadi.yml +152 -0
- package/package.json +20 -4
- package/src/applicant-scorer.ts +33 -141
- package/src/cli.ts +1119 -35
- package/src/commands/apply-for-issue.ts +452 -0
- package/src/commands/bounty-hunter.ts +529 -0
- package/src/commands/contribute.ts +264 -50
- package/src/commands/gitlab-issues.ts +87 -0
- package/src/commands/gitlab-mrs.ts +185 -0
- package/src/commands/gitlab-pipelines.ts +104 -0
- package/src/commands/prs.ts +3 -3
- package/src/core/github.ts +29 -0
- package/src/core/gitlab.ts +397 -0
- package/src/gitlab-agents/ci-recovery-agent.ts +201 -0
- package/src/gitlab-agents/contributor-scoring-agent.ts +196 -0
- package/src/gitlab-agents/grade-assignment-agent.ts +275 -0
- package/src/gitlab-agents/mr-review-agent.ts +231 -0
- package/src/gitlab-agents/reminder-agent.ts +203 -0
- package/src/grade-assignment.ts +283 -0
- package/src/remind-contributors.ts +159 -0
- package/src/review-and-merge.ts +143 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# GitPadi — GitLab Duo Chat Rules
|
|
2
|
+
|
|
3
|
+
These rules guide GitLab Duo Chat when operating within GitPadi-enabled projects.
|
|
4
|
+
|
|
5
|
+
## Project Context
|
|
6
|
+
|
|
7
|
+
GitPadi is an AI-powered contributor management system. This project uses the following automated agents:
|
|
8
|
+
|
|
9
|
+
- **Contributor Scoring**: Comment `@gitpadi score` on any issue to rank applicants
|
|
10
|
+
- **MR Review**: Assign GitPadi as reviewer or comment `@gitpadi review` on any MR
|
|
11
|
+
- **CI Recovery**: Automatically posts fix suggestions when a pipeline fails
|
|
12
|
+
- **Reminders**: Automated escalation for stale MRs (24h / 48h / 72h)
|
|
13
|
+
- **Assignment Grading**: Automatic grading for educational submissions
|
|
14
|
+
|
|
15
|
+
## Behavior Guidelines
|
|
16
|
+
|
|
17
|
+
1. When asked about contributor applications, direct users to comment on the relevant issue
|
|
18
|
+
2. When asked about code review, suggest assigning the GitPadi bot as reviewer
|
|
19
|
+
3. For CI failures, remind contributors that GitPadi will automatically post a recovery guide
|
|
20
|
+
4. For assignment submissions, remind students to use `Fixes #N` in their MR description
|
|
21
|
+
5. Always be encouraging and constructive in responses about code quality
|
|
22
|
+
|
|
23
|
+
## Scoring Criteria
|
|
24
|
+
|
|
25
|
+
Contributor scoring uses these categories (0-100 total):
|
|
26
|
+
- Application Quality (0-30)
|
|
27
|
+
- Technical Relevance (0-30)
|
|
28
|
+
- Enthusiasm & Clarity (0-20)
|
|
29
|
+
- Community Fit (0-20)
|
|
30
|
+
|
|
31
|
+
Tiers: S (80+), A (65+), B (50+), C (35+), D (<35)
|
|
32
|
+
|
|
33
|
+
## Assignment Grading Criteria
|
|
34
|
+
|
|
35
|
+
- CI Passing: 25 points
|
|
36
|
+
- Assignment Relevance: 25 points
|
|
37
|
+
- Test Coverage: 20 points
|
|
38
|
+
- Code Quality: 15 points
|
|
39
|
+
- Submission Format: 15 points
|
|
40
|
+
- Pass threshold: 40/100 (configurable)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# GitPadi — MR Review Standards
|
|
2
|
+
|
|
3
|
+
These instructions configure GitLab Duo's code review behavior for this project.
|
|
4
|
+
|
|
5
|
+
## Review Focus Areas
|
|
6
|
+
|
|
7
|
+
### Critical (Block merge)
|
|
8
|
+
- Exposed secrets, API keys, or credentials in any file
|
|
9
|
+
- SQL injection, XSS, or command injection vulnerabilities
|
|
10
|
+
- Breaking changes to public APIs without documentation
|
|
11
|
+
- Missing required tests for new features
|
|
12
|
+
|
|
13
|
+
### Warnings (Flag but allow)
|
|
14
|
+
- PRs/MRs larger than 500 lines without justification
|
|
15
|
+
- Source files added without corresponding tests
|
|
16
|
+
- Non-conventional commit messages
|
|
17
|
+
- Missing linked issue reference
|
|
18
|
+
|
|
19
|
+
### Suggestions (Informational)
|
|
20
|
+
- Code duplication that could be extracted
|
|
21
|
+
- Missing type annotations in TypeScript
|
|
22
|
+
- Performance improvements for O(n²) patterns
|
|
23
|
+
- Documentation improvements
|
|
24
|
+
|
|
25
|
+
## Commit Message Format
|
|
26
|
+
|
|
27
|
+
Conventional commits are required:
|
|
28
|
+
```
|
|
29
|
+
feat|fix|docs|style|refactor|test|chore|ci|perf|build|revert(scope): description
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Branch Naming
|
|
33
|
+
|
|
34
|
+
- Features: `feat/description` or `feature/description`
|
|
35
|
+
- Fixes: `fix/issue-N` or `fix/description`
|
|
36
|
+
- Assignments: `assignment-N` or `hw-N`
|
|
37
|
+
|
|
38
|
+
## Auto-merge Eligibility
|
|
39
|
+
|
|
40
|
+
MRs are eligible for auto-merge when:
|
|
41
|
+
1. All CI pipeline jobs pass
|
|
42
|
+
2. No critical security issues
|
|
43
|
+
3. At least one reviewer approval (or GitPadi review verdict: APPROVE)
|
|
44
|
+
4. MR is not a draft
|
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# GitPadi — GitLab CI/CD Pipeline
|
|
2
|
+
# Defines jobs for all 5 GitPadi Duo Agent Platform integrations.
|
|
3
|
+
# Agents run on merge request events and scheduled triggers.
|
|
4
|
+
|
|
5
|
+
stages:
|
|
6
|
+
- review
|
|
7
|
+
- grade
|
|
8
|
+
- notify
|
|
9
|
+
|
|
10
|
+
variables:
|
|
11
|
+
NODE_VERSION: "20"
|
|
12
|
+
GITLAB_HOST: ${CI_SERVER_URL}
|
|
13
|
+
GITLAB_PROJECT_PATH: ${CI_PROJECT_PATH}
|
|
14
|
+
|
|
15
|
+
.agent_base:
|
|
16
|
+
image: node:20-alpine
|
|
17
|
+
before_script:
|
|
18
|
+
- apk add --no-cache git
|
|
19
|
+
- npm ci --silent
|
|
20
|
+
rules:
|
|
21
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
22
|
+
- if: $CI_PIPELINE_SOURCE == "web"
|
|
23
|
+
|
|
24
|
+
# ── AI MR Review ────────────────────────────────────────────────────────
|
|
25
|
+
# Triggered on every MR — reviews code quality with Claude
|
|
26
|
+
mr-review:
|
|
27
|
+
extends: .agent_base
|
|
28
|
+
stage: review
|
|
29
|
+
script:
|
|
30
|
+
- |
|
|
31
|
+
export AI_FLOW_CONTEXT=$(cat <<EOF
|
|
32
|
+
{
|
|
33
|
+
"project_id": $CI_PROJECT_ID,
|
|
34
|
+
"project_path": "$CI_PROJECT_PATH",
|
|
35
|
+
"mr_iid": $CI_MERGE_REQUEST_IID,
|
|
36
|
+
"title": "$CI_MERGE_REQUEST_TITLE",
|
|
37
|
+
"description": "$CI_MERGE_REQUEST_DESCRIPTION",
|
|
38
|
+
"source_branch": "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME",
|
|
39
|
+
"target_branch": "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME",
|
|
40
|
+
"author": "$GITLAB_USER_LOGIN"
|
|
41
|
+
}
|
|
42
|
+
EOF
|
|
43
|
+
)
|
|
44
|
+
- npx tsx src/gitlab-agents/mr-review-agent.ts
|
|
45
|
+
allow_failure: true
|
|
46
|
+
rules:
|
|
47
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
48
|
+
|
|
49
|
+
# ── CI Failure Recovery ─────────────────────────────────────────────────
|
|
50
|
+
# Triggered when a pipeline fails — diagnoses the failure with Claude
|
|
51
|
+
ci-recovery:
|
|
52
|
+
extends: .agent_base
|
|
53
|
+
stage: review
|
|
54
|
+
script:
|
|
55
|
+
- |
|
|
56
|
+
export AI_FLOW_CONTEXT=$(cat <<EOF
|
|
57
|
+
{
|
|
58
|
+
"project_id": $CI_PROJECT_ID,
|
|
59
|
+
"project_path": "$CI_PROJECT_PATH",
|
|
60
|
+
"mr_iid": ${CI_MERGE_REQUEST_IID:-0},
|
|
61
|
+
"pipeline_id": $CI_PIPELINE_ID,
|
|
62
|
+
"title": "$CI_MERGE_REQUEST_TITLE",
|
|
63
|
+
"source_branch": "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME",
|
|
64
|
+
"author": "$GITLAB_USER_LOGIN"
|
|
65
|
+
}
|
|
66
|
+
EOF
|
|
67
|
+
)
|
|
68
|
+
- npx tsx src/gitlab-agents/ci-recovery-agent.ts
|
|
69
|
+
rules:
|
|
70
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
71
|
+
when: on_failure
|
|
72
|
+
|
|
73
|
+
# ── Assignment Grading ──────────────────────────────────────────────────
|
|
74
|
+
# Triggered on MRs in assignment repos — grades with Claude
|
|
75
|
+
grade-assignment:
|
|
76
|
+
extends: .agent_base
|
|
77
|
+
stage: grade
|
|
78
|
+
script:
|
|
79
|
+
- |
|
|
80
|
+
export AI_FLOW_CONTEXT=$(cat <<EOF
|
|
81
|
+
{
|
|
82
|
+
"project_id": $CI_PROJECT_ID,
|
|
83
|
+
"project_path": "$CI_PROJECT_PATH",
|
|
84
|
+
"mr_iid": $CI_MERGE_REQUEST_IID,
|
|
85
|
+
"title": "$CI_MERGE_REQUEST_TITLE",
|
|
86
|
+
"description": "$CI_MERGE_REQUEST_DESCRIPTION",
|
|
87
|
+
"source_branch": "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME",
|
|
88
|
+
"author": "$GITLAB_USER_LOGIN",
|
|
89
|
+
"pipeline_status": "$CI_JOB_STATUS"
|
|
90
|
+
}
|
|
91
|
+
EOF
|
|
92
|
+
)
|
|
93
|
+
- npx tsx src/gitlab-agents/grade-assignment-agent.ts
|
|
94
|
+
rules:
|
|
95
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
96
|
+
if: $GITPADI_ASSIGNMENT_MODE == "true"
|
|
97
|
+
|
|
98
|
+
# ── Escalating Reminders (Scheduled) ───────────────────────────────────
|
|
99
|
+
# Run daily via scheduled pipeline: Settings > CI/CD > Schedules
|
|
100
|
+
# Set cron to: "0 9 * * *" (9am daily)
|
|
101
|
+
reminder-cycle:
|
|
102
|
+
image: node:20-alpine
|
|
103
|
+
stage: notify
|
|
104
|
+
before_script:
|
|
105
|
+
- apk add --no-cache git
|
|
106
|
+
- npm ci --silent
|
|
107
|
+
script:
|
|
108
|
+
- npx tsx src/gitlab-agents/reminder-agent.ts
|
|
109
|
+
rules:
|
|
110
|
+
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
111
|
+
variables:
|
|
112
|
+
GITLAB_TOKEN: $GITPADI_REMINDER_TOKEN
|
|
113
|
+
|
|
114
|
+
# ── Contributor Scoring (Web trigger) ──────────────────────────────────
|
|
115
|
+
# Triggered via API or GitLab Duo agent mention "@gitpadi score"
|
|
116
|
+
score-applicant:
|
|
117
|
+
image: node:20-alpine
|
|
118
|
+
stage: notify
|
|
119
|
+
before_script:
|
|
120
|
+
- apk add --no-cache git
|
|
121
|
+
- npm ci --silent
|
|
122
|
+
script:
|
|
123
|
+
- |
|
|
124
|
+
export AI_FLOW_CONTEXT=$(cat <<EOF
|
|
125
|
+
{
|
|
126
|
+
"project_id": $CI_PROJECT_ID,
|
|
127
|
+
"project_path": "$CI_PROJECT_PATH",
|
|
128
|
+
"issue_iid": ${ISSUE_IID:-0},
|
|
129
|
+
"title": "$ISSUE_TITLE",
|
|
130
|
+
"description": "$ISSUE_DESCRIPTION"
|
|
131
|
+
}
|
|
132
|
+
EOF
|
|
133
|
+
)
|
|
134
|
+
- npx tsx src/gitlab-agents/contributor-scoring-agent.ts
|
|
135
|
+
rules:
|
|
136
|
+
- if: $CI_PIPELINE_SOURCE == "web" && $GITPADI_ACTION == "score"
|