-
Notifications
You must be signed in to change notification settings - Fork 0
feat: automated repository management system #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fbb71a2
0264c39
95eeda6
3f88698
81cef64
b37f7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: AI PR Reviewer | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| review: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Workflow security hardening: add
🧰 Tools🪛 zizmor (1.26.1)[warning] 15-18: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 16-16: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 📍 Affects 3 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run AI PR Review | ||
| run: npm run ai:pr-review | ||
| env: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| BASE_REF: ${{ github.base_ref }} | ||
|
|
||
| - name: Check if PR review comment exists | ||
| id: check_file | ||
| run: | | ||
| if [ -f pr-review-comment.md ]; then | ||
| echo "exists=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "exists=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Comment PR | ||
| uses: thollander/actions-comment-pull-request@v3 | ||
|
Check failure on line 45 in .github/workflows/ai-pr-reviewer.yml
|
||
| if: success() && steps.check_file.outputs.exists == 'true' | ||
| with: | ||
| file-path: pr-review-comment.md | ||
| comment-tag: ai-pr-review | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Continuous Improvement Loop | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 0 * * *' # Run daily at midnight | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
Comment on lines
+8
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
The 🧰 Tools🪛 zizmor (1.26.1)[error] 9-9: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level (excessive-permissions) [error] 10-10: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level (excessive-permissions) [warning] 9-9: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| jobs: | ||
| improve: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run Continuous Improvement | ||
| run: npm run ai:improve | ||
| env: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||
| name: Generate Documentation | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||
| generate: | ||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||
| node-version: 22 | ||||||||||||||||||||||||||||||
| cache: 'npm' | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Generate Diagrams | ||||||||||||||||||||||||||||||
| run: npm run generate:diagrams | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Generate Knowledge Graph | ||||||||||||||||||||||||||||||
| run: npm run generate:knowledge-graph | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - name: Commit changes | ||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||||||||||||||||||||||||||||||
| git config --local user.name "github-actions[bot]" | ||||||||||||||||||||||||||||||
| git add docs/ | ||||||||||||||||||||||||||||||
| git commit -m "docs: auto-generate architecture and knowledge graph" || echo "No changes to commit" | ||||||||||||||||||||||||||||||
| git push origin HEAD || echo "No changes to push" | ||||||||||||||||||||||||||||||
|
Comment on lines
+34
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Don't swallow non-"no changes" errors in commit/push step.
🛡️ Proposed fix - name: Commit changes
run: |
git config --local user.email "github-actions[bot]`@users.noreply.github.com`"
git config --local user.name "github-actions[bot]"
git add docs/
- git commit -m "docs: auto-generate architecture and knowledge graph" || echo "No changes to commit"
- git push origin HEAD || echo "No changes to push"
+ git diff --staged --quiet || git commit -m "docs: auto-generate architecture and knowledge graph"
+ git push origin HEAD📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: AI Issue Triage | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened] | ||
|
|
||
| permissions: | ||
| issues: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| triage: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run AI Triage | ||
| run: npm run ai:triage | ||
| env: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Self-Healing Repository | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 4 * * 1' # Every Monday at 4:00 AM | ||
| workflow_dispatch: | ||
|
Comment on lines
+3
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win Missing concurrency limits in both workflows. Neither workflow defines a
🧰 Tools🪛 zizmor (1.26.1)[warning] 3-6: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting (concurrency-limits) 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Overly broad workflow-level permissions across both workflows. Permissions are declared at the workflow level, granting all jobs more access than needed. Move to job-level scope with least privilege. zizmor flags these as excessive.
🧰 Tools🪛 zizmor (1.26.1)[error] 9-9: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level (excessive-permissions) [error] 10-10: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level (excessive-permissions) [warning] 9-9: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| jobs: | ||
| fix: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Missing
🧰 Tools🪛 zizmor (1.26.1)[warning] 16-17: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 17-17: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Unpinned GitHub Actions across both workflows. All action references use mutable tags (
🧰 Tools🪛 zizmor (1.26.1)[warning] 16-17: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 17-17: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run fixes | ||
| run: npm run fix | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v6 | ||
|
Check failure on line 32 in .github/workflows/self-healing.yml
|
||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: 'chore: auto-fix repository issues' | ||
| title: 'chore: automated self-healing fixes' | ||
| body: 'Automated fixes applied by the repository self-healing workflow.' | ||
| branch: 'auto-fix' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # AI Assistant Guidelines | ||
|
|
||
| Welcome to the Intelli-Credit Terminal repository. This document outlines guidelines for AI assistants contributing to or managing this repository. | ||
|
|
||
| ## Automation First | ||
|
|
||
| Every repetitive task that can be automated must be automated. You should actively look for opportunities to automate workflows, fix issues, and improve repository health. | ||
|
|
||
| ## Self-Healing | ||
|
|
||
| The repository supports self-healing automation. AI assistants should proactively execute self-healing tasks. | ||
| Use the `npm run fix` command to automatically resolve linting, formatting, and other auto-fixable issues. | ||
|
|
||
| ## Pre-commit Validation | ||
|
|
||
| Before proposing any changes (commits, pull requests, etc.), you **must** validate the state of the repository using the following commands: | ||
|
|
||
| - `npm run format`: Check and format code. | ||
| - `npm run lint`: Run ESLint and ensure there are no linting errors. | ||
| - `npm test`: Run the test suite and ensure all tests pass. | ||
|
|
||
| Ensure `npm audit` is checked and resolve issues using `npm audit fix` where applicable. | ||
|
|
||
| ## Security and Conventions | ||
|
|
||
| - **Command Execution:** When executing commands in Node.js automation scripts, always use `execFileSync` from the `node:child_process` module instead of `execSync`. Avoid concatenated strings to prevent command injection. Do not use shell pipes (`|`) in `execFileSync`; implement the logic natively in Node.js. | ||
| - **Logging:** Do not use `console.log`. Use `console.info`, `console.warn`, or `console.error` instead. | ||
| - **Actions Variables:** In GitHub Actions workflows, properly reference environment variables (e.g., `$BASE_REF`) in run scripts rather than injecting them directly using `${{ }}` to prevent command injection vulnerabilities. Use kebab-case inputs for the `thollander/actions-comment-pull-request@v3` action (e.g., `file-path`, `comment-tag`). | ||
| - **Git Diffs:** When generating git diffs in GitHub Actions triggered by `pull_request` events, use `git diff origin/$BASE_REF...HEAD` instead of `$HEAD_REF`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Architecture Diagram | ||
|
|
||
| ```mermaid | ||
| graph TD; | ||
| Client-->Serverless_API; | ||
| Serverless_API-->Gemini; | ||
| Serverless_API-->MCP_Tools; | ||
| MCP_Tools-->Bureau_Mock; | ||
| ``` | ||
|
|
||
| Generated dynamically by continuous docs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Knowledge Graph | ||
|
|
||
| This is a generated knowledge graph placeholder mapping relationships between: | ||
|
|
||
| - AI Services (Analyze Core -> Gemini API) | ||
| - Components (Data Ingestion -> Verification Engine -> Five Cs Analysis) | ||
| - Automation (Self-Healing -> PR Review -> Triage) | ||
|
|
||
| Detailed nodes and edges will be populated dynamically from source analysis. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
Add concurrency limits to prevent duplicate review runs.
Without a
concurrencyblock, multiple review runs can execute simultaneously for the same PR (e.g., on rapid pushes). This wastes API quota and may produce duplicate comments.⚡ Proposed fix
on: pull_request: types: [opened, synchronize, reopened] +concurrency: + group: ai-pr-review-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions:📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 3-5: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting
(concurrency-limits)
🤖 Prompt for AI Agents
Source: Linters/SAST tools