@mokoconsulting/mcp-mokogitea-api 1.2.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.
Files changed (86) hide show
  1. package/.gitattributes +94 -0
  2. package/.gitmessage +9 -0
  3. package/.mokogitea/ISSUE_TEMPLATE/adr.md +110 -0
  4. package/.mokogitea/ISSUE_TEMPLATE/bug_report.md +48 -0
  5. package/.mokogitea/ISSUE_TEMPLATE/config.yml +18 -0
  6. package/.mokogitea/ISSUE_TEMPLATE/documentation.md +52 -0
  7. package/.mokogitea/ISSUE_TEMPLATE/enterprise_support.md +85 -0
  8. package/.mokogitea/ISSUE_TEMPLATE/feature_request.md +51 -0
  9. package/.mokogitea/ISSUE_TEMPLATE/firewall-request.md +190 -0
  10. package/.mokogitea/ISSUE_TEMPLATE/mcp_api_integration.md +48 -0
  11. package/.mokogitea/ISSUE_TEMPLATE/mcp_connection_issue.md +67 -0
  12. package/.mokogitea/ISSUE_TEMPLATE/mcp_tool_request.md +49 -0
  13. package/.mokogitea/ISSUE_TEMPLATE/question.md +82 -0
  14. package/.mokogitea/ISSUE_TEMPLATE/rfc.md +126 -0
  15. package/.mokogitea/ISSUE_TEMPLATE/security.md +51 -0
  16. package/.mokogitea/ISSUE_TEMPLATE/version.md +24 -0
  17. package/.mokogitea/auto-assign.yml +76 -0
  18. package/.mokogitea/auto-dev-issue.yml +207 -0
  19. package/.mokogitea/auto-release.yml +337 -0
  20. package/.mokogitea/branch-protection.yml +251 -0
  21. package/.mokogitea/changelog-validation.yml +101 -0
  22. package/.mokogitea/codeql-analysis.yml +115 -0
  23. package/.mokogitea/copilot-agent.yml +44 -0
  24. package/.mokogitea/deploy-demo.yml +734 -0
  25. package/.mokogitea/deploy-dev.yml +700 -0
  26. package/.mokogitea/enterprise-firewall-setup.yml +758 -0
  27. package/.mokogitea/manifest.xml +25 -0
  28. package/.mokogitea/mcp-auto-release.yml +278 -0
  29. package/.mokogitea/mcp-build-test.yml +65 -0
  30. package/.mokogitea/mcp-sdk-check.yml +109 -0
  31. package/.mokogitea/mcp-tool-inventory.yml +61 -0
  32. package/.mokogitea/pr-branch-check.yml +90 -0
  33. package/.mokogitea/repository-cleanup.yml +525 -0
  34. package/.mokogitea/standards-compliance.yml +2614 -0
  35. package/.mokogitea/sync-version-on-merge.yml +133 -0
  36. package/.mokogitea/workflows/auto-assign.yml +76 -0
  37. package/.mokogitea/workflows/auto-bump.yml +66 -0
  38. package/.mokogitea/workflows/auto-dev-issue.yml +207 -0
  39. package/.mokogitea/workflows/auto-release.yml +341 -0
  40. package/.mokogitea/workflows/branch-cleanup.yml +48 -0
  41. package/.mokogitea/workflows/cascade-dev.yml +10 -0
  42. package/.mokogitea/workflows/changelog-validation.yml +101 -0
  43. package/.mokogitea/workflows/ci-generic.yml +204 -0
  44. package/.mokogitea/workflows/cleanup.yml +87 -0
  45. package/.mokogitea/workflows/codeql-analysis.yml +115 -0
  46. package/.mokogitea/workflows/copilot-agent.yml +44 -0
  47. package/.mokogitea/workflows/deploy-manual.yml +126 -0
  48. package/.mokogitea/workflows/enterprise-firewall-setup.yml +758 -0
  49. package/.mokogitea/workflows/gitleaks.yml +96 -0
  50. package/.mokogitea/workflows/issue-branch.yml +73 -0
  51. package/.mokogitea/workflows/mcp-auto-release.yml +280 -0
  52. package/.mokogitea/workflows/mcp-build-test.yml +65 -0
  53. package/.mokogitea/workflows/mcp-sdk-check.yml +109 -0
  54. package/.mokogitea/workflows/mcp-tool-inventory.yml +61 -0
  55. package/.mokogitea/workflows/notify.yml +70 -0
  56. package/.mokogitea/workflows/npm-publish.yml +51 -0
  57. package/.mokogitea/workflows/pr-check.yml +508 -0
  58. package/.mokogitea/workflows/pre-release.yml +11 -0
  59. package/.mokogitea/workflows/repo-health.yml +711 -0
  60. package/.mokogitea/workflows/repository-cleanup.yml +525 -0
  61. package/.mokogitea/workflows/security-audit.yml +82 -0
  62. package/.mokogitea/workflows/standards-compliance.yml +2614 -0
  63. package/.mokogitea/workflows/sync-version-on-merge.yml +130 -0
  64. package/.mokogitea/workflows/update-server.yml +312 -0
  65. package/CHANGELOG.md +145 -0
  66. package/CLAUDE.md +43 -0
  67. package/CONTRIBUTING.md +161 -0
  68. package/README.md +286 -0
  69. package/SECURITY.md +91 -0
  70. package/automation/ci-issue-reporter.sh +237 -0
  71. package/config.example.json +13 -0
  72. package/dist/client.d.ts +15 -0
  73. package/dist/client.js +104 -0
  74. package/dist/config.d.ts +4 -0
  75. package/dist/config.js +48 -0
  76. package/dist/index.d.ts +3 -0
  77. package/dist/index.js +1119 -0
  78. package/dist/types.d.ts +20 -0
  79. package/dist/types.js +16 -0
  80. package/package.json +34 -0
  81. package/scripts/setup.mjs +40 -0
  82. package/src/client.ts +120 -0
  83. package/src/config.ts +58 -0
  84. package/src/index.ts +1712 -0
  85. package/src/types.ts +37 -0
  86. package/tsconfig.json +19 -0
@@ -0,0 +1,204 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # FILE INFORMATION
6
+ # DEFGROUP: Gitea.Workflow
7
+ # INGROUP: MokoStandards.CI
8
+ # REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-Generic
9
+ # PATH: /.gitea/workflows/ci-generic.yml
10
+ # VERSION: 01.00.00
11
+ # BRIEF: CI pipeline — lint, validate, and test for generic projects (PHP + Node.js)
12
+
13
+ name: "Generic: Project CI"
14
+
15
+ on:
16
+ push:
17
+ branches:
18
+ - main
19
+ - dev
20
+ - dev/**
21
+ - rc/**
22
+ - version/**
23
+ pull_request:
24
+ branches:
25
+ - main
26
+ - dev
27
+ - dev/**
28
+ - rc/**
29
+ workflow_dispatch:
30
+
31
+ permissions:
32
+ contents: read
33
+
34
+ env:
35
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
36
+
37
+ jobs:
38
+ # ── Lint & Validate ───────────────────────────────────────────────────
39
+ lint:
40
+ name: Lint & Validate
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - name: Checkout
45
+ uses: actions/checkout@v4
46
+
47
+ - name: Detect toolchain
48
+ id: detect
49
+ run: |
50
+ HAS_PHP=false
51
+ HAS_NODE=false
52
+ [ -f "composer.json" ] && HAS_PHP=true
53
+ [ -f "package.json" ] && HAS_NODE=true
54
+ echo "has_php=$HAS_PHP" >> "$GITHUB_OUTPUT"
55
+ echo "has_node=$HAS_NODE" >> "$GITHUB_OUTPUT"
56
+ echo "Toolchain: PHP=$HAS_PHP Node=$HAS_NODE"
57
+
58
+ - name: Setup PHP
59
+ if: steps.detect.outputs.has_php == 'true'
60
+ run: |
61
+ if ! command -v php &> /dev/null; then
62
+ sudo apt-get update -qq
63
+ sudo apt-get install -y -qq php-cli php-mbstring php-xml >/dev/null 2>&1
64
+ fi
65
+ php -v
66
+
67
+ - name: Setup Node.js
68
+ if: steps.detect.outputs.has_node == 'true'
69
+ uses: actions/setup-node@v4
70
+ with:
71
+ node-version: '20'
72
+
73
+ - name: Install PHP dependencies
74
+ if: steps.detect.outputs.has_php == 'true'
75
+ run: |
76
+ if [ -f "composer.json" ]; then
77
+ composer install --no-interaction --prefer-dist --quiet 2>/dev/null || true
78
+ fi
79
+
80
+ - name: Install Node.js dependencies
81
+ if: steps.detect.outputs.has_node == 'true'
82
+ run: |
83
+ if [ -f "package.json" ]; then
84
+ npm ci --quiet 2>/dev/null || npm install --quiet 2>/dev/null || true
85
+ fi
86
+
87
+ - name: PHP syntax check
88
+ if: steps.detect.outputs.has_php == 'true'
89
+ run: |
90
+ ERRORS=0
91
+ while IFS= read -r -d '' file; do
92
+ if ! php -l "$file" 2>&1 | grep -q "No syntax errors"; then
93
+ echo "::error file=${file}::PHP syntax error"
94
+ ERRORS=$((ERRORS + 1))
95
+ fi
96
+ done < <(find . -name "*.php" -not -path "./.git/*" -not -path "./vendor/*" -not -path "./node_modules/*" -print0)
97
+
98
+ echo "## PHP Lint" >> $GITHUB_STEP_SUMMARY
99
+ if [ "$ERRORS" -eq 0 ]; then
100
+ echo "All PHP files passed syntax check." >> $GITHUB_STEP_SUMMARY
101
+ else
102
+ echo "${ERRORS} file(s) with syntax errors." >> $GITHUB_STEP_SUMMARY
103
+ exit 1
104
+ fi
105
+
106
+ - name: TypeScript/JavaScript lint
107
+ if: steps.detect.outputs.has_node == 'true'
108
+ run: |
109
+ if [ -f "node_modules/.bin/eslint" ]; then
110
+ npx eslint src/ --quiet 2>&1 || { echo "::error::ESLint errors found"; exit 1; }
111
+ echo "## ESLint" >> $GITHUB_STEP_SUMMARY
112
+ echo "All files passed ESLint." >> $GITHUB_STEP_SUMMARY
113
+ elif [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] || [ -f "eslint.config.js" ]; then
114
+ echo "::warning::ESLint config found but eslint not installed"
115
+ else
116
+ echo "No ESLint configured — skipping"
117
+ fi
118
+
119
+ - name: TypeScript compile check
120
+ if: steps.detect.outputs.has_node == 'true'
121
+ run: |
122
+ if [ -f "tsconfig.json" ] && [ -f "node_modules/.bin/tsc" ]; then
123
+ npx tsc --noEmit 2>&1 || { echo "::error::TypeScript compilation errors"; exit 1; }
124
+ echo "## TypeScript" >> $GITHUB_STEP_SUMMARY
125
+ echo "TypeScript compilation passed." >> $GITHUB_STEP_SUMMARY
126
+ fi
127
+
128
+ - name: PHPStan static analysis
129
+ if: steps.detect.outputs.has_php == 'true'
130
+ run: |
131
+ if [ -f "phpstan.neon" ] && [ -f "vendor/bin/phpstan" ]; then
132
+ vendor/bin/phpstan analyse --no-progress 2>&1 || { echo "::warning::PHPStan found issues"; }
133
+ fi
134
+
135
+ # ── Tests ─────────────────────────────────────────────────────────────
136
+ test:
137
+ name: Tests
138
+ runs-on: ubuntu-latest
139
+ needs: lint
140
+
141
+ steps:
142
+ - name: Checkout
143
+ uses: actions/checkout@v4
144
+
145
+ - name: Detect toolchain
146
+ id: detect
147
+ run: |
148
+ HAS_PHP=false
149
+ HAS_NODE=false
150
+ [ -f "composer.json" ] && HAS_PHP=true
151
+ [ -f "package.json" ] && HAS_NODE=true
152
+ echo "has_php=$HAS_PHP" >> "$GITHUB_OUTPUT"
153
+ echo "has_node=$HAS_NODE" >> "$GITHUB_OUTPUT"
154
+
155
+ - name: Setup PHP
156
+ if: steps.detect.outputs.has_php == 'true'
157
+ run: |
158
+ if ! command -v php &> /dev/null; then
159
+ sudo apt-get update -qq
160
+ sudo apt-get install -y -qq php-cli php-mbstring php-xml >/dev/null 2>&1
161
+ fi
162
+
163
+ - name: Setup Node.js
164
+ if: steps.detect.outputs.has_node == 'true'
165
+ uses: actions/setup-node@v4
166
+ with:
167
+ node-version: '20'
168
+
169
+ - name: Install dependencies
170
+ run: |
171
+ [ -f "composer.json" ] && composer install --no-interaction --prefer-dist --quiet 2>/dev/null || true
172
+ [ -f "package.json" ] && { npm ci --quiet 2>/dev/null || npm install --quiet 2>/dev/null || true; }
173
+
174
+ - name: Run PHP tests
175
+ if: steps.detect.outputs.has_php == 'true'
176
+ run: |
177
+ if [ -f "vendor/bin/phpunit" ]; then
178
+ vendor/bin/phpunit --testdox 2>&1
179
+ echo "## PHPUnit" >> $GITHUB_STEP_SUMMARY
180
+ echo "Tests passed." >> $GITHUB_STEP_SUMMARY
181
+ elif [ -f "phpunit.xml" ] || [ -f "phpunit.xml.dist" ]; then
182
+ echo "::warning::PHPUnit config found but phpunit not installed"
183
+ else
184
+ echo "No PHPUnit configured — skipping"
185
+ fi
186
+
187
+ - name: Run Node.js tests
188
+ if: steps.detect.outputs.has_node == 'true'
189
+ run: |
190
+ if jq -e '.scripts.test' package.json > /dev/null 2>&1; then
191
+ npm test 2>&1
192
+ echo "## Node.js Tests" >> $GITHUB_STEP_SUMMARY
193
+ echo "Tests passed." >> $GITHUB_STEP_SUMMARY
194
+ else
195
+ echo "No test script in package.json — skipping"
196
+ fi
197
+
198
+ - name: Build check
199
+ run: |
200
+ if [ -f "Makefile" ]; then
201
+ make build 2>&1 || echo "::warning::Build failed or not configured"
202
+ elif [ -f "package.json" ] && jq -e '.scripts.build' package.json > /dev/null 2>&1; then
203
+ npm run build 2>&1 || echo "::warning::Build failed"
204
+ fi
@@ -0,0 +1,87 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # FILE INFORMATION
6
+ # DEFGROUP: Gitea.Workflow
7
+ # INGROUP: MokoStandards.Maintenance
8
+ # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards
9
+ # PATH: /.gitea/workflows/cleanup.yml
10
+ # VERSION: 01.00.00
11
+ # BRIEF: Scheduled cleanup — delete merged branches and old workflow runs
12
+
13
+ name: "Universal: Repository Cleanup"
14
+
15
+ on:
16
+ schedule:
17
+ - cron: '0 3 * * 0' # Weekly on Sunday at 03:00 UTC
18
+ workflow_dispatch:
19
+
20
+ permissions:
21
+ contents: write
22
+
23
+ env:
24
+ GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
25
+
26
+ jobs:
27
+ cleanup:
28
+ name: Clean Merged Branches
29
+ runs-on: ubuntu-latest
30
+
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+ with:
35
+ fetch-depth: 0
36
+ token: ${{ secrets.GA_TOKEN }}
37
+
38
+ - name: Delete merged branches
39
+ env:
40
+ GA_TOKEN: ${{ secrets.GA_TOKEN }}
41
+ run: |
42
+ echo "=== Merged Branch Cleanup ==="
43
+ API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
44
+
45
+ # List branches via API
46
+ BRANCHES=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
47
+ "${API}/branches?limit=50" | jq -r '.[].name')
48
+
49
+ DELETED=0
50
+ for BRANCH in $BRANCHES; do
51
+ # Skip protected branches
52
+ case "$BRANCH" in
53
+ main|master|develop|release/*|hotfix/*) continue ;;
54
+ esac
55
+
56
+ # Check if branch is merged into main
57
+ if git merge-base --is-ancestor "origin/${BRANCH}" origin/main 2>/dev/null; then
58
+ echo " Deleting merged branch: ${BRANCH}"
59
+ curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
60
+ "${API}/branches/${BRANCH}" 2>/dev/null || true
61
+ DELETED=$((DELETED + 1))
62
+ fi
63
+ done
64
+
65
+ echo "Deleted ${DELETED} merged branch(es)"
66
+
67
+ - name: Clean old workflow runs
68
+ env:
69
+ GA_TOKEN: ${{ secrets.GA_TOKEN }}
70
+ run: |
71
+ echo "=== Workflow Run Cleanup ==="
72
+ API="${GITEA_URL}/api/v1/repos/${{ github.repository }}"
73
+ CUTOFF=$(date -d "30 days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -v-30d +%Y-%m-%dT%H:%M:%SZ)
74
+
75
+ # Get old completed runs
76
+ RUNS=$(curl -sS -H "Authorization: token ${GA_TOKEN}" \
77
+ "${API}/actions/runs?status=completed&limit=50" | \
78
+ jq -r ".workflow_runs[] | select(.created_at < \"${CUTOFF}\") | .id" 2>/dev/null)
79
+
80
+ DELETED=0
81
+ for RUN_ID in $RUNS; do
82
+ curl -sS -X DELETE -H "Authorization: token ${GA_TOKEN}" \
83
+ "${API}/actions/runs/${RUN_ID}" 2>/dev/null || true
84
+ DELETED=$((DELETED + 1))
85
+ done
86
+
87
+ echo "Deleted ${DELETED} old workflow run(s)"
@@ -0,0 +1,115 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # This file is part of a Moko Consulting project.
4
+ #
5
+ # SPDX-License-Identifier: GPL-3.0-or-later
6
+ #
7
+ # FILE INFORMATION
8
+ # DEFGROUP: GitHub.Workflow.Template
9
+ # INGROUP: MokoStandards.Security
10
+ # REPO: https://github.com/mokoconsulting-tech/MokoStandards
11
+ # PATH: /templates/workflows/generic/codeql-analysis.yml.template
12
+ # VERSION: 04.05.00
13
+ # BRIEF: CodeQL security scanning workflow (generic — all repo types)
14
+ # NOTE: Deployed to .mokogitea/workflows/codeql-analysis.yml in governed repos.
15
+ # CodeQL does not support PHP directly; JavaScript scans JSON/YAML/shell.
16
+ # For PHP-specific security scanning see standards-compliance.yml.
17
+
18
+ name: "Universal: CodeQL Analysis"
19
+
20
+ on:
21
+ push:
22
+ branches:
23
+ - main
24
+ - dev/**
25
+ - rc/**
26
+ - version/**
27
+ pull_request:
28
+ branches:
29
+ - main
30
+ - dev/**
31
+ - rc/**
32
+ schedule:
33
+ # Weekly on Monday at 06:00 UTC
34
+ - cron: '0 6 * * 1'
35
+ workflow_dispatch:
36
+
37
+ permissions:
38
+ actions: read
39
+ contents: read
40
+ security-events: write
41
+ pull-requests: read
42
+
43
+ jobs:
44
+ analyze:
45
+ name: Analyze (${{ matrix.language }})
46
+ runs-on: ubuntu-latest
47
+ timeout-minutes: 360
48
+
49
+ strategy:
50
+ fail-fast: false
51
+ matrix:
52
+ # CodeQL does not support PHP. Use 'javascript' to scan JSON, YAML,
53
+ # and shell scripts. Add 'actions' to scan GitHub Actions workflows.
54
+ language: ['javascript', 'actions']
55
+
56
+ steps:
57
+ - name: Checkout repository
58
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59
+
60
+ - name: Initialize CodeQL
61
+ uses: github/codeql-action/init@v3
62
+ with:
63
+ languages: ${{ matrix.language }}
64
+ queries: security-extended,security-and-quality
65
+
66
+ - name: Autobuild
67
+ uses: github/codeql-action/autobuild@v3
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v3
71
+ with:
72
+ category: "/language:${{ matrix.language }}"
73
+ upload: true
74
+ output: sarif-results
75
+ wait-for-processing: true
76
+
77
+ - name: Upload SARIF results
78
+ if: always()
79
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.5.0
80
+ with:
81
+ name: codeql-results-${{ matrix.language }}
82
+ path: sarif-results
83
+ retention-days: 30
84
+
85
+ - name: Step summary
86
+ if: always()
87
+ run: |
88
+ echo "### 🔍 CodeQL — ${{ matrix.language }}" >> $GITHUB_STEP_SUMMARY
89
+ echo "" >> $GITHUB_STEP_SUMMARY
90
+ URL="https://github.com/${{ github.repository }}/security/code-scanning"
91
+ echo "See the [Security tab]($URL) for findings." >> $GITHUB_STEP_SUMMARY
92
+ echo "" >> $GITHUB_STEP_SUMMARY
93
+ echo "| Severity | SLA |" >> $GITHUB_STEP_SUMMARY
94
+ echo "|----------|-----|" >> $GITHUB_STEP_SUMMARY
95
+ echo "| Critical | 7 days |" >> $GITHUB_STEP_SUMMARY
96
+ echo "| High | 14 days |" >> $GITHUB_STEP_SUMMARY
97
+ echo "| Medium | 30 days |" >> $GITHUB_STEP_SUMMARY
98
+ echo "| Low | 60 days / next release |" >> $GITHUB_STEP_SUMMARY
99
+
100
+ summary:
101
+ name: Security Scan Summary
102
+ runs-on: ubuntu-latest
103
+ needs: analyze
104
+ if: always()
105
+
106
+ steps:
107
+ - name: Summary
108
+ run: |
109
+ echo "### 🛡️ CodeQL Complete" >> $GITHUB_STEP_SUMMARY
110
+ echo "" >> $GITHUB_STEP_SUMMARY
111
+ echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
112
+ echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
113
+ SECURITY_URL="https://github.com/${{ github.repository }}/security"
114
+ echo "" >> $GITHUB_STEP_SUMMARY
115
+ echo "📊 [View all security alerts]($SECURITY_URL)" >> $GITHUB_STEP_SUMMARY
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
2
+ # SPDX-LICENSE-IDENTIFIER: GPL-3.0-or-later
3
+ #
4
+ # GitHub Actions workflow for Copilot coding agent
5
+ # This workflow demonstrates how to use the firewall configuration
6
+
7
+ name: "MCP: Copilot Agent"
8
+
9
+ on:
10
+ pull_request:
11
+ types: [opened, synchronize, reopened]
12
+ issue_comment:
13
+ types: [created]
14
+
15
+ permissions:
16
+ contents: write
17
+ pull-requests: write
18
+ issues: write
19
+
20
+ jobs:
21
+ copilot-agent:
22
+ name: Run Copilot Coding Agent
23
+ runs-on: ubuntu-latest
24
+
25
+ steps:
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v4
28
+ with:
29
+ fetch-depth: 0
30
+
31
+ - name: Configure Copilot Firewall
32
+ run: |
33
+ echo "Configuring firewall allowlist for enterprise-ready sites..."
34
+ bash .github/copilot/setup-firewall.sh
35
+ echo "Firewall configuration completed"
36
+
37
+ - name: Run Copilot Agent
38
+ uses: github/copilot-swe-agent@v1
39
+ with:
40
+ token: ${{ secrets.GITHUB_TOKEN }}
41
+ issue_number: ${{ github.event.issue.number || github.event.pull_request.number }}
42
+ env:
43
+ # Environment variables are set by setup-firewall.sh
44
+ COPILOT_FIREWALL_ALLOWLIST: ${{ env.COPILOT_FIREWALL_ALLOWLIST }}
@@ -0,0 +1,126 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # FILE INFORMATION
6
+ # DEFGROUP: Gitea.Workflow
7
+ # INGROUP: MokoStandards.Deploy
8
+ # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
9
+ # PATH: /templates/workflows/joomla/deploy-manual.yml.template
10
+ # VERSION: 04.07.00
11
+ # BRIEF: Manual SFTP deploy to dev server for Joomla repos
12
+
13
+ name: "Universal: Deploy to Dev (Manual)"
14
+
15
+ on:
16
+ workflow_dispatch:
17
+ inputs:
18
+ clear_remote:
19
+ description: 'Delete all remote files before uploading'
20
+ required: false
21
+ default: 'false'
22
+ type: boolean
23
+
24
+ env:
25
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
26
+
27
+ permissions:
28
+ contents: read
29
+
30
+ jobs:
31
+ deploy:
32
+ name: SFTP Deploy to Dev
33
+ runs-on: ubuntu-latest
34
+
35
+ steps:
36
+ - name: Checkout repository
37
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38
+
39
+ - name: Setup PHP
40
+ run: |
41
+ php -v && composer --version
42
+
43
+ - name: Setup MokoStandards tools
44
+ env:
45
+ GA_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
46
+ MOKO_CLONE_TOKEN: ${{ secrets.GA_TOKEN || secrets.GA_TOKEN || github.token }}
47
+ MOKO_CLONE_HOST: ${{ secrets.GA_TOKEN && 'git.mokoconsulting.tech/MokoConsulting' || 'github.com/mokoconsulting-tech' }}
48
+ COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GA_TOKEN || github.token }}"}}'
49
+ run: |
50
+ git clone --depth 1 --branch main --quiet \
51
+ "https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoStandards-API.git" \
52
+ /tmp/mokostandards-api 2>/dev/null || true
53
+ if [ -d "/tmp/mokostandards-api" ] && [ -f "/tmp/mokostandards-api/composer.json" ]; then
54
+ cd /tmp/mokostandards-api && composer install --no-dev --no-interaction --quiet 2>/dev/null || true
55
+ fi
56
+
57
+ - name: Check FTP configuration
58
+ id: check
59
+ env:
60
+ HOST: ${{ vars.DEV_FTP_HOST }}
61
+ PATH_VAR: ${{ vars.DEV_FTP_PATH }}
62
+ PORT: ${{ vars.DEV_FTP_PORT }}
63
+ run: |
64
+ if [ -z "$HOST" ] || [ -z "$PATH_VAR" ]; then
65
+ echo "DEV_FTP_HOST or DEV_FTP_PATH not configured -- cannot deploy"
66
+ echo "skip=true" >> "$GITHUB_OUTPUT"
67
+ exit 0
68
+ fi
69
+ echo "skip=false" >> "$GITHUB_OUTPUT"
70
+ echo "host=$HOST" >> "$GITHUB_OUTPUT"
71
+
72
+ REMOTE="${PATH_VAR%/}"
73
+ echo "remote=$REMOTE" >> "$GITHUB_OUTPUT"
74
+
75
+ [ -z "$PORT" ] && PORT="22"
76
+ echo "port=$PORT" >> "$GITHUB_OUTPUT"
77
+
78
+ - name: Deploy via SFTP
79
+ if: steps.check.outputs.skip != 'true'
80
+ env:
81
+ SFTP_KEY: ${{ secrets.DEV_FTP_KEY }}
82
+ SFTP_PASS: ${{ secrets.DEV_FTP_PASSWORD }}
83
+ SFTP_USER: ${{ vars.DEV_FTP_USERNAME }}
84
+ run: |
85
+ SOURCE_DIR="src"
86
+ [ ! -d "$SOURCE_DIR" ] && SOURCE_DIR="htdocs"
87
+ [ ! -d "$SOURCE_DIR" ] && { echo "No src/ or htdocs/ -- nothing to deploy"; exit 0; }
88
+
89
+ printf '{"host":"%s","port":%s,"username":"%s","remotePath":"%s"' \
90
+ "${{ steps.check.outputs.host }}" "${{ steps.check.outputs.port }}" "$SFTP_USER" "${{ steps.check.outputs.remote }}" \
91
+ > /tmp/sftp-config.json
92
+
93
+ if [ -n "$SFTP_KEY" ]; then
94
+ echo "$SFTP_KEY" > /tmp/deploy_key
95
+ chmod 600 /tmp/deploy_key
96
+ printf ',"privateKeyPath":"/tmp/deploy_key"}' >> /tmp/sftp-config.json
97
+ else
98
+ printf ',"password":"%s"}' "$SFTP_PASS" >> /tmp/sftp-config.json
99
+ fi
100
+
101
+ DEPLOY_ARGS=(--path . --src-dir "$SOURCE_DIR" --config /tmp/sftp-config.json)
102
+ [ "${{ inputs.clear_remote }}" = "true" ] && DEPLOY_ARGS+=(--clear-remote)
103
+
104
+ PLATFORM=$(php /tmp/mokostandards-api/cli/platform_detect.php --path . 2>/dev/null || true)
105
+ if [ "$PLATFORM" = "waas-component" ] && [ -f "/tmp/mokostandards-api/deploy/deploy-joomla.php" ]; then
106
+ php /tmp/mokostandards-api/deploy/deploy-joomla.php "${DEPLOY_ARGS[@]}"
107
+ else
108
+ php /tmp/mokostandards-api/deploy/deploy-sftp.php "${DEPLOY_ARGS[@]}"
109
+ fi
110
+
111
+ rm -f /tmp/deploy_key /tmp/sftp-config.json
112
+
113
+ - name: Summary
114
+ if: always()
115
+ run: |
116
+ if [ "${{ steps.check.outputs.skip }}" = "true" ]; then
117
+ echo "### Deploy Skipped -- FTP not configured" >> $GITHUB_STEP_SUMMARY
118
+ else
119
+ echo "### Manual Dev Deploy Complete" >> $GITHUB_STEP_SUMMARY
120
+ echo "" >> $GITHUB_STEP_SUMMARY
121
+ echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
122
+ echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
123
+ echo "| Host | \`${{ steps.check.outputs.host }}\` |" >> $GITHUB_STEP_SUMMARY
124
+ echo "| Remote | \`${{ steps.check.outputs.remote }}\` |" >> $GITHUB_STEP_SUMMARY
125
+ echo "| Clear | ${{ inputs.clear_remote }} |" >> $GITHUB_STEP_SUMMARY
126
+ fi